Skip to content Skip to sidebar Skip to footer

Which $term To Use To Have Both 256 Colors And Mouse Move Events In Python Curses?

Currently if I set the TERM environment variable to 'xterm-1003' I can get mouse move events but I get crappy colors and curses.can_change_color() == False os.environ['TERM'] = 'xt

Solution 1:

You can always make your own, using infocmp (to show the contents of an entry), and tic (to compile an entry). If you do not have permission to write in the system area, it goes to $HOME/.terminfo

Start by comparing xterm-1003 and xterm-256color:

>infocmp-xxterm-1003xterm-256colorcomparingxterm-1003toxterm-256color.comparingbooleans.ccc:F:T.comparingnumbers.colors:8,256.pairs:64,32767.comparingstrings.initc:NULL,'\E]4;%p1%d;rgb\:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\\'.setab:'\E[4%p1%dm','\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m'.setaf:'\E[3%p1%dm','\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m'.setb:'\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m',NULL.setf:'\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m',NULL.XM:'\E[?1003%?%p1%{1}%=%th%el%;',NULL.

Essentially, all you are interested in is adding the XM capability to a copy of xterm-256color.

So...

  1. infocmp -x xterm-256color >foo
  2. edit foo, adding the XM string
  3. tic -x foo

The "-x" option is needed for tic to compile the XM capability, which is an extended (user-defined) capability which ncurses happens to recognize as noted in comments for the terminal database.

Post a Comment for "Which $term To Use To Have Both 256 Colors And Mouse Move Events In Python Curses?"