I'm away for the next couple of weeks and I think this is right so I am
applying this now.

If you don't want to bother rebuilding to use this, it should be enough
to set Cs and Csr to the values in the default terminal-overrides.

However if you do this you'll need to change them to Ss and Se.


On Sun, Jun 02, 2013 at 08:46:12AM +0100, Nicholas Marriott wrote:
> Oops looks like somewhere along the line the xterm ones got changed to
> Ss and Se and Cs and Cr used for the cursor colour.
> 
> Try this please.
> 
> Index: options-table.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/tmux/options-table.c,v
> retrieving revision 1.36
> diff -u -p -r1.36 options-table.c
> --- options-table.c   27 Mar 2013 11:17:12 -0000      1.36
> +++ options-table.c   2 Jun 2013 07:45:24 -0000
> @@ -416,8 +416,8 @@ const struct options_table_entry session
>         .type = OPTIONS_TABLE_STRING,
>         .default_str = "*256col*:colors=256"
>                        ",xterm*:XT:Ms=\\E]52;%p1%s;%p2%s\\007"
> -                      ":Cc=\\E]12;%p1%s\\007:Cr=\\E]112\\007"
> -                      ":Cs=\\E[%p1%d q:Csr=\\E[2 q,screen*:XT"
> +                      ":Cs=\\E]12;%p1%s\\007:Cr=\\E]112\\007"
> +                      ":Ss=\\E[%p1%d q:Se=\\E[2 q,screen*:XT"
>       },
>  
>       { .name = "update-environment",
> Index: tmux.1
> ===================================================================
> RCS file: /cvs/src/usr.bin/tmux/tmux.1,v
> retrieving revision 1.359
> diff -u -p -r1.359 tmux.1
> --- tmux.1    31 May 2013 19:56:05 -0000      1.359
> +++ tmux.1    2 Jun 2013 07:45:26 -0000
> @@ -3571,7 +3571,7 @@ This command only works from outside
>  understands some extensions to
>  .Xr terminfo 5 :
>  .Bl -tag -width Ds
> -.It Em Cc , Cr
> +.It Em Cs , Cr
>  Set the cursor colour.
>  The first takes a single string argument and is used to set the colour;
>  the second takes no arguments and restores the default cursor colour.
> @@ -3581,7 +3581,7 @@ to change the cursor colour from inside
>  .Bd -literal -offset indent
>  $ printf '\e033]12;red\e033\e\e'
>  .Ed
> -.It Em Cs , Csr
> +.It Em Ss , Se
>  Change the cursor style.
>  If set, a sequence such as this may be used
>  to change the cursor to an underline:
> Index: tmux.h
> ===================================================================
> RCS file: /cvs/src/usr.bin/tmux/tmux.h,v
> retrieving revision 1.410
> diff -u -p -r1.410 tmux.h
> --- tmux.h    31 May 2013 12:19:34 -0000      1.410
> +++ tmux.h    2 Jun 2013 07:45:27 -0000
> @@ -253,15 +253,13 @@ enum tty_code_code {
>       TTYC_BEL,       /* bell, bl */
>       TTYC_BLINK,     /* enter_blink_mode, mb */
>       TTYC_BOLD,      /* enter_bold_mode, md */
> -     TTYC_CC,        /* set colour cursor, Cc */
>       TTYC_CIVIS,     /* cursor_invisible, vi */
>       TTYC_CLEAR,     /* clear_screen, cl */
>       TTYC_CNORM,     /* cursor_normal, ve */
>       TTYC_COLORS,    /* max_colors, Co */
>       TTYC_CR,        /* restore cursor colour, Cr */
> -     TTYC_CS1,       /* set cursor style, Cs */
> +     TTYC_CS,        /* set cursor colour, Cs */
>       TTYC_CSR,       /* change_scroll_region, cs */
> -     TTYC_CSR1,      /* reset cursor style, Csr */
>       TTYC_CUB,       /* parm_left_cursor, LE */
>       TTYC_CUB1,      /* cursor_left, le */
>       TTYC_CUD,       /* parm_down_cursor, DO */
> @@ -391,6 +389,7 @@ enum tty_code_code {
>       TTYC_RMACS,     /* exit_alt_charset_mode */
>       TTYC_RMCUP,     /* exit_ca_mode, te */
>       TTYC_RMKX,      /* keypad_local, ke */
> +     TTYC_SE,        /* reset cursor style, Se */
>       TTYC_SETAB,     /* set_a_background, AB */
>       TTYC_SETAF,     /* set_a_foreground, AF */
>       TTYC_SGR0,      /* exit_attribute_mode, me */
> @@ -400,6 +399,7 @@ enum tty_code_code {
>       TTYC_SMKX,      /* keypad_xmit, ks */
>       TTYC_SMSO,      /* enter_standout_mode, so */
>       TTYC_SMUL,      /* enter_underline_mode, us */
> +     TTYC_SS,        /* set cursor style, Ss */
>       TTYC_TSL,       /* to_status_line, tsl */
>       TTYC_VPA,       /* row_address, cv */
>       TTYC_XENL,      /* eat_newline_glitch, xn */
> Index: tty-term.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/tmux/tty-term.c,v
> retrieving revision 1.31
> diff -u -p -r1.31 tty-term.c
> --- tty-term.c        27 Mar 2013 11:17:12 -0000      1.31
> +++ tty-term.c        2 Jun 2013 07:45:27 -0000
> @@ -38,15 +38,13 @@ const struct tty_term_code_entry tty_ter
>       { TTYC_BEL, TTYCODE_STRING, "bel" },
>       { TTYC_BLINK, TTYCODE_STRING, "blink" },
>       { TTYC_BOLD, TTYCODE_STRING, "bold" },
> -     { TTYC_CC, TTYCODE_STRING, "Cc" },
>       { TTYC_CIVIS, TTYCODE_STRING, "civis" },
>       { TTYC_CLEAR, TTYCODE_STRING, "clear" },
>       { TTYC_CNORM, TTYCODE_STRING, "cnorm" },
>       { TTYC_COLORS, TTYCODE_NUMBER, "colors" },
>       { TTYC_CR, TTYCODE_STRING, "Cr" },
> -     { TTYC_CS1, TTYCODE_STRING, "Cs" },
> +     { TTYC_CS, TTYCODE_STRING, "Cs" },
>       { TTYC_CSR, TTYCODE_STRING, "csr" },
> -     { TTYC_CSR1, TTYCODE_STRING, "Csr" },
>       { TTYC_CUB, TTYCODE_STRING, "cub" },
>       { TTYC_CUB1, TTYCODE_STRING, "cub1" },
>       { TTYC_CUD, TTYCODE_STRING, "cud" },
> @@ -176,6 +174,7 @@ const struct tty_term_code_entry tty_ter
>       { TTYC_RMACS, TTYCODE_STRING, "rmacs" },
>       { TTYC_RMCUP, TTYCODE_STRING, "rmcup" },
>       { TTYC_RMKX, TTYCODE_STRING, "rmkx" },
> +     { TTYC_SE, TTYCODE_STRING, "Se" },
>       { TTYC_SETAB, TTYCODE_STRING, "setab" },
>       { TTYC_SETAF, TTYCODE_STRING, "setaf" },
>       { TTYC_SGR0, TTYCODE_STRING, "sgr0" },
> @@ -185,6 +184,7 @@ const struct tty_term_code_entry tty_ter
>       { TTYC_SMKX, TTYCODE_STRING, "smkx" },
>       { TTYC_SMSO, TTYCODE_STRING, "smso" },
>       { TTYC_SMUL, TTYCODE_STRING, "smul" },
> +     { TTYC_SS, TTYCODE_STRING, "Ss" },
>       { TTYC_TSL, TTYCODE_STRING, "tsl" },
>       { TTYC_VPA, TTYCODE_STRING, "vpa" },
>       { TTYC_XENL, TTYCODE_FLAG, "xenl" },
> Index: tty.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/tmux/tty.c,v
> retrieving revision 1.159
> diff -u -p -r1.159 tty.c
> --- tty.c     11 Apr 2013 07:27:27 -0000      1.159
> +++ tty.c     2 Jun 2013 07:45:27 -0000
> @@ -270,11 +270,11 @@ tty_stop_tty(struct tty *tty)
>       tty_raw(tty, tty_term_string(tty->term, TTYC_SGR0));
>       tty_raw(tty, tty_term_string(tty->term, TTYC_RMKX));
>       tty_raw(tty, tty_term_string(tty->term, TTYC_CLEAR));
> -     if (tty_term_has(tty->term, TTYC_CS1) && tty->cstyle != 0) {
> -             if (tty_term_has(tty->term, TTYC_CSR1))
> -                     tty_raw(tty, tty_term_string(tty->term, TTYC_CSR1));
> +     if (tty_term_has(tty->term, TTYC_SS) && tty->cstyle != 0) {
> +             if (tty_term_has(tty->term, TTYC_SE))
> +                     tty_raw(tty, tty_term_string(tty->term, TTYC_SE));
>               else
> -                     tty_raw(tty, tty_term_string1(tty->term, TTYC_CS1, 0));
> +                     tty_raw(tty, tty_term_string1(tty->term, TTYC_SS, 0));
>       }
>       tty_raw(tty, tty_term_string(tty->term, TTYC_CR));
>  
> @@ -455,7 +455,7 @@ tty_force_cursor_colour(struct tty *tty,
>       if (*ccolour == '\0')
>               tty_putcode(tty, TTYC_CR);
>       else
> -             tty_putcode_ptr1(tty, TTYC_CC, ccolour);
> +             tty_putcode_ptr1(tty, TTYC_CS, ccolour);
>       free(tty->ccolour);
>       tty->ccolour = xstrdup(ccolour);
>  }
> @@ -479,12 +479,12 @@ tty_update_mode(struct tty *tty, int mod
>                       tty_putcode(tty, TTYC_CIVIS);
>       }
>       if (tty->cstyle != s->cstyle) {
> -             if (tty_term_has(tty->term, TTYC_CS1)) {
> +             if (tty_term_has(tty->term, TTYC_SS)) {
>                       if (s->cstyle == 0 &&
> -                         tty_term_has(tty->term, TTYC_CSR1))
> -                             tty_putcode(tty, TTYC_CSR1);
> +                         tty_term_has(tty->term, TTYC_SE))
> +                             tty_putcode(tty, TTYC_SE);
>                       else
> -                             tty_putcode1(tty, TTYC_CS1, s->cstyle);
> +                             tty_putcode1(tty, TTYC_SS, s->cstyle);
>               }
>               tty->cstyle = s->cstyle;
>       }
> 
> 
> 
> 
> 
> 
> On Sat, Jun 01, 2013 at 05:59:12PM -0700, simfox3 wrote:
> >    Thanks for the detailed explanation.*
> >    The tmux server crashes with a [lost server] message as soon as I send a
> >    mouse cursor escape sequence IF terminal-overrides option is defined in
> >    .tmux.conf--no matter what I add, remove, or set.*
> >    For example, in .tmux.conf, I'll add this basic line:*set -g
> >    terminal-overrides "88col*:colors=88,*256col*:colors=256,xterm*:XT"
> >    $ tmux -vvv new-session
> >    $ echo -ne "\e[3 q"
> >    [lost server]
> >    At this point, my terminal is hosed, and I have to close it and start a
> >    new one.*
> >    tmux-server and tmux-client logs:
> >    [1]https://gist.github.com/saamalik/5692227
> >    The tail lines from tmux-server.log is when tmux is dispatching the csi
> >    cursor command.*
> >    input_parse: 'ESC' ground
> >    input_parse: '[' esc_enter
> >    input_parse: '3' csi_enter
> >    input_parse: ' ' csi_parameter
> >    input_parse: 'q' csi_intermediate
> >    input_csi_dispatch: 'q' " " "3"
> >    Also, I was poking around looking for more logs, and I found an entry in
> >    /var/log/kern.log every time tmux crashed because of the mouse cursor
> >    sequence:*
> >    Jun *1 17:40:00 saamalik-ubuntu kernel: [375832.255154] tmux[3101]:
> >    segfault at 3 ip 00007fd596071c51 sp 00007fff23a734c8 error 4 in
> >    [2]libc-2.17.so[7fd595fe8000+1be000]
> >    Jun *1 17:45:21 saamalik-ubuntu kernel: [376153.197029] tmux[3189]:
> >    segfault at 3 ip 00007fc0c8ce7c51 sp 00007fffda403018 error 4 in
> >    [3]libc-2.17.so[7fc0c8c5e000+1be000]
> >    Jun *1 17:46:14 saamalik-ubuntu kernel: [376206.107155] tmux[3241]:
> >    segfault at 3 ip 00007f0241240c51 sp 00007fffa6edfbf8 error 4 in
> >    [4]libc-2.17.so[7f02411b7000+1be000]
> >    What other information would you like? I'm using tmux 1.8 from installed
> >    binary but I'm able to reproduce this on the latest master branch (git
> >    pull / configure / make / ./tmux )
> >    -Saad
> > 
> >    On Sat, Jun 1, 2013 at 2:33 PM, Nicholas Marriott
> >    <[5]nicholas.marri...@gmail.com> wrote:
> > 
> >      Unfortunately, in xterm "0 q" is not the sequence to reset cursor style
> >      to what you configured. It always resets it to "blinking block". Which
> >      IMO is silly but I guess it probably matches the DEC behaviour and it's
> >      the way it is.
> > 
> >      Anyway, in tmux we do need some way to reset to the actual default, so
> >      we added the Csr terminfo entry. It defaults to "steady block" because
> >      IIRC that is the actual default in xterm and anyway it's what I use.
> > 
> >      So if you send "0 q", tmux will send the value of Csr - which in the
> >      default terminal-overrides is "2 q" when TERM matches xterm*.
> > 
> >      You can change Csr to whatever you want the default cursor style to
> >      be. Or remove it to use "0 q" if that's what works for you. If tmux 
> > dies
> >      then tell me exactly what steps you have done.
> > 
> >      tmux will only send ANY cursor sequences when a pane has requested one,
> >      so that's why it doesn't change until you try to change the style.
> > 
> >      On Sat, Jun 01, 2013 at 01:42:20PM -0700, simfox3 wrote:
> >      > * *Hi Nicholas,
> >      > * *I've been playing around with various escape code using echo -ne
> >      and here
> >      > * *are my observations:
> >      > * *1. The CORRECT mintty escape code to reset cursor style back to 
> > the
> >      > * *default vertical line is: '\e[0 q'. Tmux is swallowing this
> >      specific
> >      > * *escape sequence, and not passing it on to the terminal. If I DCS
> >      > * *\ePtmux;...\e\\* escape this sequence, then the terminal
> >      temporarily
> >      > * *resets the cursor to the vertical line, but since tmux doesn't
> >      track DCS
> >      > * *escaped codes, switching back to this pane/window changes the
> >      cursor back
> >      > * *to the previous style, e.g: block cursor \e[1 q. The underscore
> >      mintty
> >      > * *cursor escape (\e[3 q) is being relayed and stored. Only the '\e[0
> >      q'
> >      > * *sequence isn't relayed to the underlying terminal. Any reason for
> >      this?
> >      > * *2. How can I set the default cursor escape code for panes/windows?
> >      The
> >      > * *initial cursor style is the the same as the (non-tmux) terminal
> >      that
> >      > * *starts tmux. For example, in my non-tmux terminal if I change
> >      cursor to
> >      > * *blinking underscore (\e[3 q), and then launch tmux--all new 
> > created
> >      panes
> >      > * *will have the underscore cursor. However, as soon as I change any
> >      pane's
> >      > * *cursor (e.g: echo -ne "\e[1 q"), then the cursor is changed to a
> >      > * *non-blinking block (\e[2 q) for ALL other panes. Where is this 
> > \e[2
> >      q
> >      > * *coming from? Where can I change it? I tried setting my
> >      terminal-overrides,
> >      > * *but the tmux server dies after a cursor echo escape code no matter
> >      what I
> >      > * *put in there--even with the verbatim copy of the default
> >      > * *terminal-override.
> >      > * *3. Upon exiting tmux, the launching terminal cursor also changes 
> > to
> >      > * *non-blinking block (\e[2 q). I'm assuming that fixing the previous
> >      issue
> >      > * *will fix this one too.*
> >      > * *MY CONFIG:
> >      > * *Typical tmux.conf (90% from tmux by Brian
> >      > * *Hogan):*[1][6]https://gist.github.com/saamalik/5691197
> >      > * *The*
> >      > * *I am NOT setting any terminal-overrides in tmux.conf. However, 
> > this
> >      is the
> >      > * *output of the default terminal-overrides:
> >      > * *$ tmux show-options -g terminal-overrides
> >      > * *terminal-overrides
> >      > *
> >      
> > *"*88col*:colors=88,*256col*:colors=256,xterm*:XT:Ms=\E]52;%p1%s;%p2%s\007:Cc=\E]12;%p1%s\007:Cr=\E]112\007:Cs=\E[%p1%d
> >      > * *q:Csr=\E[2 q,screen*:XT"
> >      >
> >      > * *On Sat, Jun 1, 2013 at 12:24 AM, Nicholas Marriott
> >      > * *<[2][7]nicholas.marri...@gmail.com> wrote:
> >      >
> >      > * * *It was merged. If you use the DCS \ePtmux;...\e\\ escaping then
> >      it won't
> >      > * * *work, that makes tmux pass the cursor sequences through without
> >      > * * *tracking them.
> >      >
> >      > * * *On Fri, May 31, 2013 at 05:45:39PM -0700, simfox3 wrote:
> >      > * * *> * *Hi All,
> >      > * * *> * *In VIM, my normal mode cursor is a block, like most of you 
> > I
> >      > * * *presume. If I
> >      > * * *> * *switch panes or windows while in normal mode, the cursor
> >      style
> >      > * * *(block)
> >      > * * *> * *comes along for the ride. Sure, I could issue a simple
> >      escape
> >      > * * *sequence
> >      > * * *> * *(echo -ne "\e[5 q") to reset it to the vertical line, but
> >      wouldn't
> >      > * * *it be
> >      > * * *> * *awesome if tmux handles this?
> >      > * * *> * *It turns out that in 2011 some gentleman made a patch to
> >      keep track
> >      > * * *of the
> >      > * * *> * *cursor color/styles per pane/window but I don't think it 
> > was
> >      > * * *merged.
> >      > * * *> * *Anyway, here is the thread for more info:
> >      > * * *> *
> >      > * *
> >      
> > **[1][3][8]http://sourceforge.net/mailarchive/forum.php?thread_name=BAY156-w42377C17048D1DADD1882CAECC0%40phx.gbl&forum_name=tmux-users
> >      > * * *> * *For the time being, is there a workaround? Should this get
> >      > * * *addressed?*
> >      > * * *> * *My setup:
> >      > * * *> * ** Terminal: Mintty (CYGWIN)
> >      > * * *> * ** SSH -> Ubuntu 13.04
> >      > * * *> * ** Tmux 1.8
> >      > * * *> * *Thanks,
> >      > * * *> * *Saad
> >      > * * *> * *For other Cygwin TTY users SSHing into a TMUX Box, these 
> > are
> >      the
> >      > * * *VIM
> >      > * * *> * *escape sequences to use:*
> >      > * * *> * *" tmux escape the mintty mode-dependent cursor escapes; the
> >      weird
> >      > * * *1049H
> >      > * * *> * *and 1049L sequences save/restore the alternate screen on 
> > VIM
> >      > * * *start/exit--I
> >      > * * *> * *think.
> >      > * * *> * *let &t_ti="\ePtmux;\e\e[1 q\e\\\e[?1049h"
> >      > * * *> * *let &t_te="\ePtmux;\e\e[0 q\e\\\e[?1049l"
> >      > * * *> * *let &t_SI="\ePtmux;\e\e[5 q\e\\"
> >      > * * *> * *let &t_EI="\ePtmux;\e\e[1 q\e\\"
> >      > * * *>
> >      > * * *> References
> >      > * * *>
> >      > * * *> * *Visible links
> >      > * * *> * *1.
> >      > * *
> >      
> > *[4][9]http://sourceforge.net/mailarchive/forum.php?thread_name=BAY156-w42377C17048D1DADD1882CAECC0%40phx.gbl&forum_name=tmux-users
> >      >
> >      > * * *>
> >      > * *
> >      
> > *------------------------------------------------------------------------------
> >      > * * *> Get 100% visibility into Java/.NET code with AppDynamics Lite
> >      > * * *> It's a free troubleshooting tool designed for production
> >      > * * *> Get down to code-level detail for bottlenecks, with <2%
> >      overhead.
> >      > * * *> Download for free and get started troubleshooting in minutes.
> >      > * * *> [5][10]http://p.sf.net/sfu/appdyn_d2d_ap2
> >      >
> >      > * * *> _______________________________________________
> >      > * * *> tmux-users mailing list
> >      > * * *> [6][11]tmux-users@lists.sourceforge.net
> >      > * * *> [7][12]https://lists.sourceforge.net/lists/listinfo/tmux-users
> >      >
> >      > References
> >      >
> >      > * *Visible links
> >      > * *1. [13]https://gist.github.com/saamalik/5691197
> >      > * *2. mailto:[14]nicholas.marri...@gmail.com
> >      > * *3.
> >      
> > [15]http://sourceforge.net/mailarchive/forum.php?thread_name=BAY156-w42377C17048D1DADD1882CAECC0%40phx.gbl&forum_name=tmux-users
> >      > * *4.
> >      
> > [16]http://sourceforge.net/mailarchive/forum.php?thread_name=BAY156-w42377C17048D1DADD1882CAECC0%40phx.gbl&forum_name=tmux-users
> >      > * *5. [17]http://p.sf.net/sfu/appdyn_d2d_ap2
> >      > * *6. mailto:[18]tmux-users@lists.sourceforge.net
> >      > * *7. [19]https://lists.sourceforge.net/lists/listinfo/tmux-users
> > 
> > References
> > 
> >    Visible links
> >    1. https://gist.github.com/saamalik/5692227
> >    2. http://libc-2.17.so/
> >    3. http://libc-2.17.so/
> >    4. http://libc-2.17.so/
> >    5. mailto:nicholas.marri...@gmail.com
> >    6. https://gist.github.com/saamalik/5691197
> >    7. mailto:nicholas.marri...@gmail.com
> >    8. 
> > http://sourceforge.net/mailarchive/forum.php?thread_name=BAY156-w42377C17048D1DADD1882CAECC0%40phx.gbl&forum_name=tmux-users
> >    9. 
> > http://sourceforge.net/mailarchive/forum.php?thread_name=BAY156-w42377C17048D1DADD1882CAECC0%40phx.gbl&forum_name=tmux-users
> >   10. http://p.sf.net/sfu/appdyn_d2d_ap2
> >   11. mailto:tmux-users@lists.sourceforge.net
> >   12. https://lists.sourceforge.net/lists/listinfo/tmux-users
> >   13. https://gist.github.com/saamalik/5691197
> >   14. mailto:nicholas.marri...@gmail.com
> >   15. 
> > http://sourceforge.net/mailarchive/forum.php?thread_name=BAY156-w42377C17048D1DADD1882CAECC0%40phx.gbl&forum_name=tmux-users
> >   16. 
> > http://sourceforge.net/mailarchive/forum.php?thread_name=BAY156-w42377C17048D1DADD1882CAECC0%40phx.gbl&forum_name=tmux-users
> >   17. http://p.sf.net/sfu/appdyn_d2d_ap2
> >   18. mailto:tmux-users@lists.sourceforge.net
> >   19. https://lists.sourceforge.net/lists/listinfo/tmux-users

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to