Kean Johnston <kean(a)armory.com> writes:
All,
Attached is a small patch for console mode. It fixes two
things. One, it fixes the cursor shape, as the termcap
entries are reversed in the source (this has bugged me
litterally for years, Im sorry I never submitted a patch
sooner).
The second part of the patch is to disable auto-margins
if the terminal can, and uses them. This solves another
problem I've had for a long time, where the screen could
become corrupted under certain circumstances if the
minibuffer display was too long.
The patch is against 21.5.21, but the same could (and
should) be done for 21.4 if there's to be another release
of that.
APPROVE COMMIT 21.4
Kean,
Thanks for the patch. I committed it with the following entry in src/ChangeLog:
2005-11-27 Kean Johnston <kean(a)armory.com>
* redisplay-tty.c (set_tty_modes):
(reset_tty_modes): disable auto-margins if the terminal supports
them.
(init_tty_for_redisplay): fix cursor shape.
This patch will appear in 21.4.18.
Thank you,
Vin
Kean
--- src/redisplay-tty.c.jkj 2005-01-24 15:34:07.000000000 -0800
+++ src/redisplay-tty.c 2005-07-12 14:01:45.000000000 -0700
@@ -874,6 +874,9 @@
OUTPUT1_IF (c, TTY_SD (c).init_motion);
OUTPUT1_IF (c, TTY_SD (c).cursor_visible);
OUTPUT1_IF (c, TTY_SD (c).keypad_on);
+
+ if (TTY_FLAGS (c).auto_margins)
+ OUTPUT1_IF (c, TTY_SD (c).disable_auto_margins);
}
/*****************************************************************************
@@ -892,6 +895,9 @@
OUTPUT1_IF (c, TTY_SD (c).cursor_normal);
OUTPUT1_IF (c, TTY_SD (c).end_motion);
+ if (TTY_FLAGS (c).auto_margins)
+ OUTPUT1_IF (c, TTY_SD (c).enable_auto_margins);
+
{
Lisp_Object frm = CONSOLE_SELECTED_FRAME (c);
@@ -1197,12 +1203,14 @@
TTY_SD (c).audio_bell = "\07";
}
- TTY_SD (c).cursor_visible = tgetstr ("ve", &bufptr);
- TTY_SD (c).cursor_normal = tgetstr ("vs", &bufptr);
+ TTY_SD (c).cursor_visible = tgetstr ("vs", &bufptr);
+ TTY_SD (c).cursor_normal = tgetstr ("ve", &bufptr);
TTY_SD (c).init_motion = tgetstr ("ti", &bufptr);
TTY_SD (c).end_motion = tgetstr ("te", &bufptr);
TTY_SD (c).keypad_on = tgetstr ("ks", &bufptr);
TTY_SD (c).keypad_off = tgetstr ("ke", &bufptr);
+ TTY_SD (c).disable_auto_margins = tgetstr ("RA", &bufptr);
+ TTY_SD (c).enable_auto_margins = tgetstr ("SA", &bufptr);
/*
@@ -1215,6 +1223,7 @@
TTY_FLAGS (c).memory_below_frame = tgetflag ("db");
TTY_FLAGS (c).standout_width = tgetnum ("sg");
TTY_FLAGS (c).underline_width = tgetnum ("ug");
+ TTY_FLAGS (c).auto_margins = tgetflag ("am");
if (TTY_FLAGS (c).standout_width == -1)
TTY_FLAGS (c).standout_width = 0;
--- src/console-tty-impl.h.jkj 2002-06-20 14:18:24.000000000 -0700
+++ src/console-tty-impl.h 2005-07-12 14:01:51.000000000 -0700
@@ -81,6 +81,8 @@
character info */
unsigned int flow_control :1; /* Nonzero means use ^S/^Q as
cretinous flow control. */
+ unsigned int auto_margins :1; /* Nonzero means terminal wraps when
+ writing to the last column */
int standout_width; /* # of spaces printed when
change to standout mode */
int underline_width; /* # of spaces printed when
@@ -174,6 +176,9 @@
const char *keypad_off; /* rmkx, ke */
const char *orig_pair; /* op, op */
+
+ const char *disable_auto_margins; /* rmam, RA */
+ const char *enable_auto_margins; /* smam, SA */
} sd;
/* costs of various operations */