bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#21692: 24.3; Feature request - allow setting cursor shape in termina


From: Random832
Subject: bug#21692: 24.3; Feature request - allow setting cursor shape in terminals
Date: Thu, 15 Oct 2015 19:55:15 -0400

(The Emacs I am sending on is version 24.3, but I have confirmed on the
help-gnu-emacs mailing list that this feature does not exist in any
version)

Many terminal emulators in use today (including xterm, tmux, konsole,
iterm2, putty, teraterm, and the linux console) allow you to select the
cursor shape (and blink mode, and color) using various escape sequences.

There is, however, no standardization in termcap/terminfo for these
capabilities. Tmux provides some extension codes that it uses to detect
how to translate its own notion of the cursor attributes to the physical
terminal's, but they're not generally present in terminfo databases.

To implement this, Emacs could provide a way for the user to define a
function that accepts a cursor-type and cursor color (or two different
functions, though in some cases such as Linux both may be needed to
construct a single escape sequence) and returns an escape sequence that
Emacs will emit to the tty. Emacs could then call that function whenever
the cursor type changes,

A simple example that would generate the DECSCUSR sequence supported by
the VT520, xterm, iTerm2, teraterm, and tmux would be:

(defun make-cursor-esc-dec (ctype ccolor)
  (if ctype
      (format "\e[?25h\e[%d q"
              (cond
               ((eq ctype 'box) 1)
               ((eq ctype 'hbar) 3)
               ((eq ctype 'bar) 5) ; extension, not on the VT520
               (t 0)))
    "\e[?25l\e[0 q")) ; set the shape to default so that if emacs
                      ; crashes while the cursor is invisible,
                      ; reset(1) will put it back to normal.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]