summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGregory Heytings <gregory@heytings.org>2023-03-29 14:47:32 +0000
committerGregory Heytings <gregory@heytings.org>2023-03-29 16:50:21 +0200
commit2093e010dc14148455480d607b2f06ee43b1e6e0 (patch)
treeb8de5846821b9583a16625c1fc29500055153a00 /src
parent974e4f3333311b557754e2fdbaa75b0c1077fc61 (diff)
downloademacs-2093e010dc14148455480d607b2f06ee43b1e6e0.tar.gz
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.
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c8
1 files 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);
}