emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scratch/long-lines-cleanup 2093e010dc1: Fix cursor motion in character-o


From: Gregory Heytings
Subject: scratch/long-lines-cleanup 2093e010dc1: Fix cursor motion in character-only terminals
Date: Wed, 29 Mar 2023 10:50:43 -0400 (EDT)

branch: scratch/long-lines-cleanup
commit 2093e010dc14148455480d607b2f06ee43b1e6e0
Author: Gregory Heytings <gregory@heytings.org>
Commit: Gregory Heytings <gregory@heytings.org>

    Fix cursor motion in character-only terminals
    
    * src/xdisp.c (get_narrowed_width): Subtract 1 from
    window_body_width to account for the '\' line wrapping indication.
---
 src/xdisp.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/xdisp.c b/src/xdisp.c
index a4d02529563..880d1b0f1fa 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -3580,10 +3580,14 @@ init_iterator (struct it *it, struct window *w,
 static int
 get_narrowed_width (struct window *w)
 {
+  bool term = EQ (Fterminal_live_p (Qnil), Qt);
   /* In a character-only terminal, only one font size is used, so we
      can use a smaller factor.  */
-  int fact = EQ (Fterminal_live_p (Qnil), Qt) ? 2 : 3;
-  int width = window_body_width (w, WINDOW_BODY_IN_CANONICAL_CHARS);
+  int fact = term ? 2 : 3;
+  /* In a character-only terminal, subtract 1 from the width for the
+     '\' line wrapping character.  */
+  int width = window_body_width (w, WINDOW_BODY_IN_CANONICAL_CHARS)
+    - (term ? 1 : 0);
   return fact * max (1, width);
 }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]