From 94c10c426e305037126cf75cc5cf23c9f8df4664 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 13 Aug 2022 16:59:22 +0300 Subject: Speed up display of long lines under 'truncate-lines' * src/xdisp.c (partial_line_height): Return zero for long and truncated lines. (fast_move_it_horizontally): New function. (hscroll_window_tree, display_line): Use 'fast_move_it_horizontally' in preference to 'move_it_in_display_line_to', when dealing with long and truncated lines. (redisplay_internal): Optimize "optimization 3" for long and truncated lines. * src/buffer.c (syms_of_buffer) : New variable. * etc/NEWS: Announce 'large-hscroll-threshold'. --- src/buffer.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index e5601af5051..6ab516d5f51 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -6442,6 +6442,24 @@ If nil, these display shortcuts will always remain disabled. There is no reason to change that value except for debugging purposes. */); XSETFASTINT (Vlong_line_threshold, 10000); + DEFVAR_INT ("large-hscroll-threshold", large_hscroll_threshold, + doc: /* Horizontal scroll of truncated lines above which to use redisplay shortcuts. + +The value should be a positive integer. + +Shortcuts in the display code intended to speed up redisplay for long +and truncated lines will automatically be enabled when a line's +horizontal scroll amount is or about to become larger than the value +of this variable. + +This variable has effect only in buffers which contain one or more +lines whose length is above `long-line-threshold', which see. +To disable redisplay shortcuts for long truncated line, set this +variable to `most-positive-fixnum'. + +There is no reason to change that value except for debugging purposes. */); + large_hscroll_threshold = 10000; + defsubr (&Sbuffer_live_p); defsubr (&Sbuffer_list); defsubr (&Sget_buffer); -- cgit v1.2.1 From 23561f9665609bcb4cbe89a993a70eeccbec600e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 14 Aug 2022 13:48:11 -0700 Subject: Work around Bug#57211 * src/buffer.c (Fgenerate_new_buffer_name): Allocate a bigger buffer. --- src/buffer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index 6ab516d5f51..98066a2eb60 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1160,7 +1160,8 @@ is first appended to NAME, to speed up finding a non-existent buffer. */) genbase = name; else { - char number[sizeof "-999999"]; + enum { bug_52711 = true }; /* https://bugs.gnu.org/57211 */ + char number[bug_52711 ? INT_BUFSIZE_BOUND (int) + 1 : sizeof "-999999"]; EMACS_INT r = get_random (); eassume (0 <= r); int i = r % 1000000; -- cgit v1.2.1