Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 May 2018 14:21:20 +0000 (UTC)
From:      =?UTF-8?Q?Jean-S=c3=a9bastien_P=c3=a9dron?= <dumbbell@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r333925 - head/sys/teken
Message-ID:  <201805201421.w4KELKmY067883@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dumbbell
Date: Sun May 20 14:21:20 2018
New Revision: 333925
URL: https://svnweb.freebsd.org/changeset/base/333925

Log:
  teken, vt(4): Parse the "Cursor style" escape sequence
  
  The escape sequence (e.g. `^[[2 q`) was unsupported before and the
  letter `q` was displayed as a typed character. The sequence is used by
  Neovim for instance.
  
  Now, it is properly parsed. However, it is ignored, so it won't change
  the cursor style.
  
  Because the escape sequence contains a space character, the
  `gensequences` script had to be modified to support that. In the
  `sequences` file, a space is represented as the string `SP`.

Modified:
  head/sys/teken/gensequences
  head/sys/teken/sequences
  head/sys/teken/teken_subr.h

Modified: head/sys/teken/gensequences
==============================================================================
--- head/sys/teken/gensequences	Sun May 20 06:14:12 2018	(r333924)
+++ head/sys/teken/gensequences	Sun May 20 14:21:20 2018	(r333925)
@@ -35,10 +35,19 @@ function die(msg) {
 function cchar(str) {
 	if (str == "^[")
 		return "\\x1B";
+	if (str == "SP")
+		return " ";
 
 	return str;
 }
 
+function csequence(str) {
+	if (str == "SP")
+		return " ";
+
+	return str;
+}
+
 BEGIN {
 FS = "\t+"
 
@@ -57,7 +66,7 @@ while (getline > 0) {
 	prefix = "";
 	l_prefix_name[""] = "teken_state_init";
 	for (i = 1; i < nsequences; i++) {
-		n = prefix sequence[i];
+		n = prefix csequence(sequence[i]);
 		l_prefix_parent[n] = prefix;
 		l_prefix_suffix[n] = sequence[i];
 		if (!l_prefix_name[n])

Modified: head/sys/teken/sequences
==============================================================================
--- head/sys/teken/sequences	Sun May 20 06:14:12 2018	(r333924)
+++ head/sys/teken/sequences	Sun May 20 14:21:20 2018	(r333925)
@@ -48,6 +48,7 @@ CUF	Cursor Forward				^[ [ a		n
 CUP	Cursor Position				^[ [ H		n n
 CUP	Cursor Position				^[ [ f		n n
 CUU	Cursor Up				^[ [ A		n
+CS	Cursor style				^[ [ SP q	r
 DA1	Primary Device Attributes		^[ [ c		r
 DA2	Secondary Device Attributes		^[ [ > c	r
 DC	Delete character			^[ [ P		n

Modified: head/sys/teken/teken_subr.h
==============================================================================
--- head/sys/teken/teken_subr.h	Sun May 20 06:14:12 2018	(r333924)
+++ head/sys/teken/teken_subr.h	Sun May 20 14:21:20 2018	(r333925)
@@ -372,6 +372,25 @@ teken_subr_cursor_up(teken_t *t, unsigned int nrows)
 }
 
 static void
+teken_subr_cursor_style(teken_t *t, unsigned int style)
+{
+
+	/* TODO */
+
+	/*
+	 * CSI Ps SP q
+	 *   Set cursor style (DECSCUSR), VT520.
+	 *     Ps = 0  -> blinking block.
+	 *     Ps = 1  -> blinking block (default).
+	 *     Ps = 2  -> steady block.
+	 *     Ps = 3  -> blinking underline.
+	 *     Ps = 4  -> steady underline.
+	 *     Ps = 5  -> blinking bar (xterm).
+	 *     Ps = 6  -> steady bar (xterm).
+	 */
+}
+
+static void
 teken_subr_delete_character(const teken_t *t, unsigned int ncols)
 {
 	teken_rect_t tr;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201805201421.w4KELKmY067883>