From 950ff21e17af487b205ea0b666be015790114fa7 Mon Sep 17 00:00:00 2001 From: Roberto E. Vargas Caballero Date: Thu, 8 Nov 2012 17:15:26 +0100 Subject: Fix bug restoring cursor position Sequences like DECSC, DECRC, ESC [?1047l or ESC [?1047h save and restore cursor attributes, than taken from vt100 manual are: Save Cursor (DECSC) ESC 7 =========================== Saves the following in terminal memory. - cursor position - graphic rendition - character set shift state - state of wrap flag - state of origin mode Restore Cursor (DECRC) ESC 8 =========================== Restores the states described for (DECSC) above. If none of these characteristics were saved, the cursor moves to home position; origin mode is reset; no character attributes are assigned; and the default character set mapping is established. This implies that hide attribute of the cursor should not be saved/restored in these sequences. The best way to fix this problem is moving hide attribute into the terminal mode, instead of having it in the cursor state. --- st.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)--- st.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/st.c b/st.c index 2ad13ef..67fa790 100644 --- a/st.c +++ b/st.c @@ -96,8 +96,7 @@ enum cursor_movement { enum cursor_state { CURSOR_DEFAULT = 0, - CURSOR_HIDE = 1, - CURSOR_WRAPNEXT = 2 + CURSOR_WRAPNEXT = 1, }; enum glyph_state { @@ -115,7 +114,8 @@ enum term_mode { MODE_MOUSEMOTION = 64, MODE_MOUSE = 32|64, MODE_REVERSE = 128, - MODE_KBDLOCK = 256 + MODE_KBDLOCK = 256, + MODE_HIDE = 512 }; enum escape_state { @@ -1464,8 +1464,8 @@ tsetmode(bool priv, bool set, int *args, int narg) { case 0: /* Error (IGNORED) */ case 12: /* att610 -- Start blinking cursor (IGNORED) */ break; - case 25: - MODBIT(term.c.state, !set, CURSOR_HIDE); + case 25: /* DECTCEM -- Text Cursor Enable Mode */ + MODBIT(term.mode, !set, MODE_HIDE); break; case 1000: /* 1000,1002: enable xterm mouse report */ MODBIT(term.mode, set, MODE_MOUSEBTN); @@ -2505,7 +2505,7 @@ xdrawcursor(void) { } /* draw the new one */ - if(!(term.c.state & CURSOR_HIDE)) { + if(!(IS_SET(MODE_HIDE))) { if(!(xw.state & WIN_FOCUSED)) g.bg = defaultucs; -- cgit v1.2.3