summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2026-05-31 11:36:15 +0300
committerEli Zaretskii <eliz@gnu.org>2026-05-31 11:36:15 +0300
commit64f4ce7b2d9d8bf8c291b8b6993f9b4ced51814c (patch)
tree7e2230f2aa85d5f2d492a93836b63c26eb363a95 /src
parent3a0bce8f0283a7f095cfd66a1c7b6b2c35e2eaaf (diff)
Allow optionally disabling the use of TABs for TTY cursor movement
* src/term.c (syms_of_term) <tty-cursor-movement-use-TAB>: New var. <tty-cursor-movement-use-TAB-BS>: Doc fix. * src/cm.c (calccost): Use it to disable use of TABs for cursor motion on text terminals. * etc/NEWS: Announce the new variable.
Diffstat (limited to 'src')
-rw-r--r--src/cm.c3
-rw-r--r--src/term.c13
2 files changed, 14 insertions, 2 deletions
diff --git a/src/cm.c b/src/cm.c
index 4693b69c26e..f453fc2650a 100644
--- a/src/cm.c
+++ b/src/cm.c
@@ -225,7 +225,8 @@ x:
goto dodelta; /* skip all the tab junk */
}
/* Tabs (the toughie) */
- if (tty->Wcm->cc_tab >= BIG || !tty->Wcm->cm_usetabs)
+ if (!tty_cursor_movement_use_TAB
+ || tty->Wcm->cc_tab >= BIG || !tty->Wcm->cm_usetabs)
goto olddelta; /* forget it! */
/*
diff --git a/src/term.c b/src/term.c
index 1a5ed74d698..8777a3b6a65 100644
--- a/src/term.c
+++ b/src/term.c
@@ -5263,9 +5263,20 @@ On TTY frames, as a display optimization, Emacs may move to a position
by "overshooting" with TAB characters and one BACKSPACE character, when
this is more efficient. This combination can interfere with the
functioning of some software, such as screen readers. Set this to
-non-nil to enable this optimization. */);
+non-nil to enable this optimization.
+If `tty-cursor-movement-use-TAB' is nil, this variable has no effect,
+as Emacs will never use TABs for cursor movement. */);
tty_cursor_movement_use_TAB_BS = 0;
+ DEFVAR_BOOL ("tty-cursor-movement-use-TAB", tty_cursor_movement_use_TAB,
+ doc: /* Whether TTY frames may use TAB for cursor motion.
+On TTY frames, as a display optimization, Emacs may move cursor to a
+position with TAB characters, when this is more efficient. This might
+produce wrong results if the hardware tabs of the terminal were set to
+be of different width than Emacs expects. Set this to nil to disable
+using TABs for cursor motion. */);
+ tty_cursor_movement_use_TAB = 1;
+
defsubr (&Stty_display_color_p);
defsubr (&Stty_display_color_cells);
defsubr (&Stty_no_underline);