From: Gregory Heytings Date: Wed, 29 Mar 2023 14:47:32 +0000 (+0000) Subject: Fix cursor motion in character-only terminals X-Git-Tag: emacs-29.0.91~11^2~6 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=2093e010dc14148455480d607b2f06ee43b1e6e0;p=emacs.git 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. --- 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); }