repo: rxvt-unicode-sixel action: commit revision: path_from: revision_from: 2562068c19a5bc8da707b72bdb28fed02b8c1e78: path_to: revision_to:
commit 2562068c19a5bc8da707b72bdb28fed02b8c1e78 Author: Emanuele GiaquintaDate: Tue Mar 26 14:16:46 2013 +0000 Add support for the set cursor style (DECSCUSR) control function. diff --git a/Changes b/Changes
--- a/Changes +++ b/Changes @@ -30,6 +30,8 @@ TODO: provide something like % for easy access for parse_keysym TODO: description into --help output? TODO: rxvt -help => (see rxvt-XXX(1))? + - add support for the set cursor style (DECSCUSR) control + function. - honour cursorColor also when the cursor style is underline. 9.18 Sun Mar 24 15:33:35 CET 2013 diff --git a/doc/rxvt.7.pod b/doc/rxvt.7.pod
--- a/doc/rxvt.7.pod +++ b/doc/rxvt.7.pod @@ -1282,7 +1282,7 @@ Switch to Alternate Character Set Shift In (Ctrl-O), invokes the G0 character set (the default). Switch to Standard Character Set -=item B<< C>> +=item B<< C >> Space Character @@ -1632,6 +1632,20 @@ Device Status Report (DSR) =end table +=item B<< C >> + +Set Cursor Style (DESCUSR) + +=begin table + + B<< C >> Blink Block + B<< C >> Blink Block + B<< C >> Steady Block + B<< C >> Blink Underline + B<< C >> Steady Underline + +=end table + =item B<< C >> Set Scrolling Region [top;bottom] diff --git a/src/command.C b/src/command.C
--- a/src/command.C
+++ b/src/command.C
@@ -2801,7 +2801,7 @@ static const unsigned char csi_defaults[] =
void ecb_hot
rxvt_term::process_csi_seq ()
{
- unicode_t ch, priv, i;
+ unicode_t ch, priv, prev_ch, i;
unsigned int nargs, p;
int n, ndef;
int arg[ESC_ARGS] = { };
@@ -2817,6 +2817,7 @@ rxvt_term::process_csi_seq ()
ch = cmd_getc ();
}
+ prev_ch = 0;
/* read any numerical arguments */
for (n = -1; ch < CSI_ICH; )
{
@@ -2836,6 +2837,7 @@ rxvt_term::process_csi_seq ()
else if (IS_CONTROL (ch))
process_nonprinting (ch);
+ prev_ch = ch;
ch = cmd_getc ();
}
@@ -3079,6 +3081,11 @@ rxvt_term::process_csi_seq ()
priv_modes |= PrivMode_LFNL;
break;
+ case CSI_71: // DESCUSR: set cursor style
+ if (prev_ch == ' ')
+ set_cursor_style (arg[0]);
+ break;
+
/*
* PRIVATE USE beyond this point. All CSI_7? sequences here
*/
@@ -3993,6 +4000,22 @@ rxvt_term::process_sgr_mode (unsigned int nargs, const int *arg)
}
}
}
+
+void
+rxvt_term::set_cursor_style (int style)
+{
+ if (!IN_RANGE_INC (style, 0, 4))
+ return;
+
+ set_option (Opt_cursorUnderline, style >= 3);
+
+#ifdef CURSOR_BLINK
+ set_option (Opt_cursorBlink, !style || (style & 1));
+ cursor_blink_reset ();
+#endif
+
+ want_refresh = 1;
+}
/*}}} */
/* ------------------------------------------------------------------------- */
diff --git a/src/rxvt.h b/src/rxvt.h
--- a/src/rxvt.h +++ b/src/rxvt.h @@ -1402,6 +1402,7 @@ struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen int privcases (int mode, unsigned long bit); void process_terminal_mode (int mode, int priv, unsigned int nargs, const int *arg); void process_sgr_mode (unsigned int nargs, const int *arg); + void set_cursor_style (int style); // init.C void init (stringvec *argv, stringvec *envv); void init (int argc, const char *const *argv, const char *const *envv);
-----END OF PAGE-----