Speed up find_field when called from outside a field
* src/editfns.c (find_field): Speed up the field functions when called from outside a field (bug#52593). (In some cursory tests, this makes the called-from-outside-a-field case about 3x faster.)
This commit is contained in:
@@ -437,6 +437,27 @@ find_field (Lisp_Object pos, Lisp_Object merge_at_boundary,
|
||||
|
||||
after_field
|
||||
= get_char_property_and_overlay (pos, Qfield, Qnil, NULL);
|
||||
|
||||
/* We're not in a field, so find the prev/next area with a field
|
||||
property. */
|
||||
if (NILP (after_field))
|
||||
{
|
||||
if (beg)
|
||||
{
|
||||
Lisp_Object p = Fprevious_single_char_property_change (pos, Qfield,
|
||||
Qnil,
|
||||
beg_limit);
|
||||
*beg = NILP (p) ? BEGV : XFIXNAT (p);
|
||||
}
|
||||
if (end)
|
||||
{
|
||||
Lisp_Object p = Fnext_single_char_property_change (pos, Qfield, Qnil,
|
||||
end_limit);
|
||||
*end = NILP (p) ? ZV : XFIXNAT (p);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
before_field
|
||||
= (XFIXNAT (pos) > BEGV
|
||||
? get_char_property_and_overlay (make_fixnum (XFIXNUM (pos) - 1),
|
||||
|
||||
Reference in New Issue
Block a user