Do not enter locked narrowing when it would span the whole buffer

* src/xdisp.c (handle_fontified_prop):
* src/keyboard.c (safe_run_hooks_maybe_narrowed): Add condition.
This commit is contained in:
Gregory Heytings 2022-11-28 01:20:46 +00:00
parent 99463478e5
commit 56ab6203fa
2 changed files with 9 additions and 5 deletions

View file

@ -1912,9 +1912,12 @@ safe_run_hooks_maybe_narrowed (Lisp_Object hook, struct window *w)
if (current_buffer->long_line_optimizations_p
&& long_line_locked_narrowing_region_size > 0)
narrow_to_region_locked (make_fixnum (get_locked_narrowing_begv (PT)),
make_fixnum (get_locked_narrowing_zv (PT)),
hook);
{
ptrdiff_t begv = get_locked_narrowing_begv (PT);
ptrdiff_t zv = get_locked_narrowing_zv (PT);
if (begv != BEG || zv != Z)
narrow_to_region_locked (make_fixnum (begv), make_fixnum (zv), hook);
}
run_hook_with_args (2, ((Lisp_Object []) {hook, hook}),
safe_run_hook_funcall);

View file

@ -4404,8 +4404,9 @@ handle_fontified_prop (struct it *it)
begv = get_locked_narrowing_begv (charpos);
zv = get_locked_narrowing_zv (charpos);
}
narrow_to_region_locked (make_fixnum (begv), make_fixnum (zv),
Qfontification_functions);
if (begv != BEG || zv != Z)
narrow_to_region_locked (make_fixnum (begv), make_fixnum (zv),
Qfontification_functions);
}
/* Don't allow Lisp that runs from 'fontification-functions'