Fix the age old problem of TTY cursor being reset on exit
authorSteve Youngs <steve@sxemacs.org>
Sun, 6 Jan 2013 02:21:45 +0000 (12:21 +1000)
committerSteve Youngs <steve@sxemacs.org>
Sun, 6 Jan 2013 02:21:45 +0000 (12:21 +1000)
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 <steve@sxemacs.org>
src/ui/TTY/console-tty.h
src/ui/TTY/redisplay-tty.c

index 707881f..fc4718d 100644 (file)
@@ -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 */
index a907ce0..65ecc1d 100644 (file)
@@ -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.