diff options
Diffstat (limited to 'src/composite.c')
-rw-r--r-- | src/composite.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/composite.c b/src/composite.c index 4d69702171f..d8998b5a1f3 100644 --- a/src/composite.c +++ b/src/composite.c @@ -1576,6 +1576,7 @@ find_automatic_composition (ptrdiff_t pos, ptrdiff_t limit, ptrdiff_t backlim, Lisp_Object window; struct window *w; bool need_adjustment = 0; + ptrdiff_t narrowed_begv; window = Fget_buffer_window (Fcurrent_buffer (), Qnil); if (NILP (window)) @@ -1586,6 +1587,11 @@ find_automatic_composition (ptrdiff_t pos, ptrdiff_t limit, ptrdiff_t backlim, if (NILP (string)) { head = backlim < 0 ? BEGV : backlim, tail = ZV, stop = GPT; + /* In buffers with very long lines, this function becomes very + slow. Pretend that the buffer is narrowed to make it fast. */ + narrowed_begv = get_narrowed_begv (w); + if (pos > narrowed_begv) + head = narrowed_begv; cur.pos_byte = CHAR_TO_BYTE (cur.pos); cur.p = BYTE_POS_ADDR (cur.pos_byte); } |