aboutsummaryrefslogtreecommitdiffstats
path: root/src/composite.c
diff options
context:
space:
mode:
authorGregory Heytings2022-08-04 21:19:36 +0200
committerGregory Heytings2022-08-04 21:19:36 +0200
commit5a79bb2aed617f5b0ecf8e20ec958682e72fcc75 (patch)
tree78f8f67e887cefc78d026b5ac775aceebde315ff /src/composite.c
parentb335e1a0469105bb55b9741ae3106dc0a6023ce2 (diff)
parenta95c5baa6a556059a434b9973a4454d414c15928 (diff)
downloademacs-5a79bb2aed617f5b0ecf8e20ec958682e72fcc75.tar.gz
emacs-5a79bb2aed617f5b0ecf8e20ec958682e72fcc75.zip
Merge branch 'feature/long-lines-improvements'
Diffstat (limited to 'src/composite.c')
-rw-r--r--src/composite.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/composite.c b/src/composite.c
index 0f90b92a785..a13839939b8 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -1021,7 +1021,11 @@ composition_compute_stop_pos (struct composition_it *cmp_it, ptrdiff_t charpos,
1021 /* But we don't know where to stop the searching. */ 1021 /* But we don't know where to stop the searching. */
1022 endpos = NILP (string) ? BEGV - 1 : -1; 1022 endpos = NILP (string) ? BEGV - 1 : -1;
1023 /* Usually we don't reach ENDPOS because we stop searching 1023 /* Usually we don't reach ENDPOS because we stop searching
1024 at an uncomposable character (NL, LRE, etc). */ 1024 at an uncomposable character (NL, LRE, etc). In buffers
1025 with long lines, however, NL might be far away, so
1026 pretend that the buffer is smaller. */
1027 if (current_buffer->long_line_optimizations_p)
1028 endpos = get_closer_narrowed_begv (cmp_it->parent_it->w, charpos);
1025 } 1029 }
1026 } 1030 }
1027 cmp_it->id = -1; 1031 cmp_it->id = -1;
@@ -1580,7 +1584,6 @@ find_automatic_composition (ptrdiff_t pos, ptrdiff_t limit, ptrdiff_t backlim,
1580 Lisp_Object window; 1584 Lisp_Object window;
1581 struct window *w; 1585 struct window *w;
1582 bool need_adjustment = 0; 1586 bool need_adjustment = 0;
1583 ptrdiff_t narrowed_begv;
1584 1587
1585 window = Fget_buffer_window (Fcurrent_buffer (), Qnil); 1588 window = Fget_buffer_window (Fcurrent_buffer (), Qnil);
1586 if (NILP (window)) 1589 if (NILP (window))
@@ -1597,11 +1600,14 @@ find_automatic_composition (ptrdiff_t pos, ptrdiff_t limit, ptrdiff_t backlim,
1597 } 1600 }
1598 else 1601 else
1599 head = backlim; 1602 head = backlim;
1600 /* In buffers with very long lines, this function becomes very 1603 if (current_buffer->long_line_optimizations_p)
1601 slow. Pretend that the buffer is narrowed to make it fast. */ 1604 {
1602 narrowed_begv = get_narrowed_begv (w, window_point (w)); 1605 /* In buffers with very long lines, this function becomes very
1603 if (narrowed_begv && pos > narrowed_begv) 1606 slow. Pretend that the buffer is narrowed to make it fast. */
1604 head = narrowed_begv; 1607 ptrdiff_t begv = get_closer_narrowed_begv (w, window_point (w));
1608 if (pos > begv)
1609 head = begv;
1610 }
1605 tail = ZV; 1611 tail = ZV;
1606 stop = GPT; 1612 stop = GPT;
1607 cur.pos_byte = CHAR_TO_BYTE (cur.pos); 1613 cur.pos_byte = CHAR_TO_BYTE (cur.pos);