From 1b6e2638f91b3a7a1f30f2791b5434dff7931747 Mon Sep 17 00:00:00 2001 From: Steve Youngs Date: Sun, 6 Jan 2013 12:21:45 +1000 Subject: [PATCH] Fix the age old problem of TTY cursor being reset on exit This changeset stops SXEmacs from resetting the text cursor to block on exit on a Linux console. It is actually still reset, but it is reset correctly and now you'll end up with a "normal" cursor instead of a "very visible" one. One side-effect of this change is that SXEmacs on a console will now use a block cursor, but that just adds consistency because that is how things are in X11 and Xterm anyway. * src/ui/TTY/console-tty.h (struct tty_console): Add `cursor_invisible_' and `hard_cursor_' for invisible and hard to see cursors. * src/ui/TTY/redisplay-tty.c (init_tty_for_redisplay): Set cursor_visible_ to "vs" and cursor_normal_ to "ve" like they should be according to terminfo(5). Also add cursor_invisible_ ("vi"), and hard_cursor_ ("HC"). Signed-off-by: Steve Youngs --- src/ui/TTY/console-tty.h | 2 ++ src/ui/TTY/redisplay-tty.c | 14 ++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/ui/TTY/console-tty.h b/src/ui/TTY/console-tty.h index 707881f..fc4718d 100644 --- a/src/ui/TTY/console-tty.h +++ b/src/ui/TTY/console-tty.h @@ -182,7 +182,9 @@ struct tty_console { const char *audio_bell_; /* bel, bl */ const char *cursor_visible_; /* cvvis, vs */ + const char *cursor_invisible_; /* civis, vi */ const char *cursor_normal_; /* cnorm, ve */ + const char *hard_cursor_; /* chts, HC */ const char *init_motion_; /* smcup, ti */ const char *end_motion_; /* rmcup, te */ const char *keypad_on_; /* smkx, ks */ diff --git a/src/ui/TTY/redisplay-tty.c b/src/ui/TTY/redisplay-tty.c index a907ce0..65ecc1d 100644 --- a/src/ui/TTY/redisplay-tty.c +++ b/src/ui/TTY/redisplay-tty.c @@ -1155,12 +1155,14 @@ int init_tty_for_redisplay(struct device *d, char *terminal_type) 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).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).cursor_visible_ = tgetstr("vs", &bufptr); + TTY_SD(c).cursor_invisible_ = tgetstr("vi", &bufptr); + TTY_SD(c).cursor_normal_ = tgetstr("ve", &bufptr); + TTY_SD(c).hard_cursor_ = tgetstr("HC", &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); /* * Initialize additional terminal information. -- 2.25.1