Re: home keys in tmux

2015-12-03 Thread Ted Unangst
Brian Conway wrote:
> Spending a little time with 'cat -v', I ended up with the following
> non-.tmux.conf approach to making home/end happy in tmux with an
> otherwise-unmodified ksh shell:
> 
> bind '^[[1~'=beginning-of-line
> bind '^[[4~'=end-of-line
> 
> It doesn't appear to break normal xterm[-256color] use.
> 
> These are still workarounds, of course.

Right. The following code exists in ksh/emacs.c:

/* more navigation keys */
kb_add(x_mv_begin,  NULL, CTRL('['), '[', 'H', 0); /* home 
*/
kb_add(x_mv_end,NULL, CTRL('['), '[', 'F', 0); /* end */
kb_add(x_mv_begin,  NULL, CTRL('['), 'O', 'H', 0); /* home 
*/
kb_add(x_mv_end,NULL, CTRL('['), 'O', 'F', 0); /* end */

We could continue adding a dozen more variations here, but I think there is a
larger problem.

I push a button on my keyboard. xterm gets a keycode, turns that into some
bytes (^[ [ H by the look of things), writes them into the pty, and then ksh
reads those bytes and does something interesting.

If I'm running tmux, xterm gets a keycode, turns that into some bytes, writes
them into the pty, tmux reads those bytes, for some reason changes them into
different bytes, then writes them into the ksh pty where ksh is confused by
them.

I do not understand why tmux is taking one set of perfectly good bytes and
turning it into a less good set of bytes.



Re: home keys in tmux

2015-12-02 Thread Ax0n
Do you have anything in your .tmux.conf?

On Wed, Dec 2, 2015 at 6:42 AM, Ted Unangst  wrote:

> When i push home at a ksh prompt in xterm, the cursor goes to the
> beginning of
> the line. When i do the same in tmux, nothing happens.
>
> TERM in xterm is xterm. TERM in tmux is screen.
>
> How do i fix this? (Why do i need to fix it?)



Re: home keys in tmux

2015-12-02 Thread Giancarlo Razzolini
Em 02-12-2015 10:42, Ted Unangst escreveu:
> How do i fix this? (Why do i need to fix it?)
Coincidentally, I saw that same question asked today on IRC and it
wasn't even on OpenBSD. The OP changed it by setting TERM to xterm-256
if I'm not mistaken. And he also nailed it down to the fact that the num
lock switch was on (or off). At first I thought it wasn't tmux related.
But now it seems otherwise.

Cheers,
Giancarlo Razzolini



Re: home keys in tmux

2015-12-02 Thread Ted Unangst
Ax0n wrote:
> Do you have anything in your .tmux.conf?

No, don't have one. (i don't want one)



Re: home keys in tmux

2015-12-02 Thread Ted Unangst
Giancarlo Razzolini wrote:
> Em 02-12-2015 10:42, Ted Unangst escreveu:
> > How do i fix this? (Why do i need to fix it?)
> Coincidentally, I saw that same question asked today on IRC and it
> wasn't even on OpenBSD. The OP changed it by setting TERM to xterm-256
> if I'm not mistaken. And he also nailed it down to the fact that the num
> lock switch was on (or off). At first I thought it wasn't tmux related.
> But now it seems otherwise.

fiddling with TERM should be unnecessary imo.

in any case, setting TERM=xterm in tmux doesn't work.
and fwiw, setting TERM=screen in xterm continues to work.



Re: home keys in tmux

2015-12-02 Thread Jack J. Woehr

Ax0n wrote:

Do you have anything in your .tmux.conf?

Ha, I have a funny problem in tmux that thwarts me. I changed the prefix key to C-a but the sequence C-a C-a doesn't 
work like C-b C-b,
the C-a doesn't ever seem to get sent to the shell. Which means I can't jump to head-of-line Emacs-style like I'm used 
to. Maybe I could

figure this out with a hour of study but maybe somebody on the list knows ;)

--
Jack J. Woehr # Science is more than a body of knowledge. It's a way of
www.well.com/~jax # thinking, a way of skeptically interrogating the universe
www.softwoehr.com # with a fine understanding of human fallibility. - Carl Sagan



Re: home keys in tmux

2015-12-02 Thread Jack J. Woehr

Johan Mellberg wrote:

Anyway, screen steals C-a so to jump to the start of a line, hit C-a, then a 
again.

Doesn't work :(

--
Jack J. Woehr # Science is more than a body of knowledge. It's a way of
www.well.com/~jax # thinking, a way of skeptically interrogating the universe
www.softwoehr.com # with a fine understanding of human fallibility. - Carl Sagan



Re: home keys in tmux

2015-12-02 Thread Brian Conway
Spending a little time with 'cat -v', I ended up with the following
non-.tmux.conf approach to making home/end happy in tmux with an
otherwise-unmodified ksh shell:

bind '^[[1~'=beginning-of-line
bind '^[[4~'=end-of-line

It doesn't appear to break normal xterm[-256color] use.

These are still workarounds, of course.

Brian Conway

On Wed, Dec 2, 2015 at 10:17 AM, Ted Unangst  wrote:
> Ax0n wrote:
>> Do you have anything in your .tmux.conf?
>
> No, don't have one. (i don't want one)




Re: home keys in tmux

2015-12-02 Thread Jack J. Woehr

Philip Guenther wrote:

My crystal ball says that you changed the prefix but didn't change the
binding of 'a'.  I would verify my crystal ball against your
config...but you didn't show your config...


I only made the change I noted, and thank you for some helpful advice!

--
Jack J. Woehr # Science is more than a body of knowledge. It's a way of
www.well.com/~jax # thinking, a way of skeptically interrogating the universe
www.softwoehr.com # with a fine understanding of human fallibility. - Carl Sagan



Re: home keys in tmux

2015-12-02 Thread Philip Guenther
On Wed, Dec 2, 2015 at 9:43 AM, Jack J. Woehr  wrote:
> Ha, I have a funny problem in tmux that thwarts me. I changed the prefix key
> to C-a but the sequence C-a C-a doesn't work like C-b C-b,
> the C-a doesn't ever seem to get sent to the shell. Which means I can't jump
> to head-of-line Emacs-style like I'm used to. Maybe I could
> figure this out with a hour of study but maybe somebody on the list knows ;)

My crystal ball says that you changed the prefix but didn't change the
binding of 'a'.  I would verify my crystal ball against your
config...but you didn't show your config...



Re: home keys in tmux

2015-12-02 Thread Johan Mellberg
We'll see if this gets to the list, sending from a phone.

Anyway, screen steals C-a so to jump to the start of a line, hit C-a, then a
again.

Might work for you.


> 2 dec. 2015 kl. 18:43 skrev Jack J. Woehr :
>
> Ax0n wrote:
>> Do you have anything in your .tmux.conf?
>>
> Ha, I have a funny problem in tmux that thwarts me. I changed the prefix key
to C-a but the sequence C-a C-a doesn't work like C-b C-b,
> the C-a doesn't ever seem to get sent to the shell. Which means I can't jump
to head-of-line Emacs-style like I'm used to. Maybe I could
> figure this out with a hour of study but maybe somebody on the list knows
;)
>
> --
> Jack J. Woehr # Science is more than a body of knowledge. It's a way of
> www.well.com/~jax # thinking, a way of skeptically interrogating the
universe
> www.softwoehr.com # with a fine understanding of human fallibility. - Carl
Sagan



home keys in tmux

2015-12-02 Thread Ted Unangst
When i push home at a ksh prompt in xterm, the cursor goes to the beginning of
the line. When i do the same in tmux, nothing happens.

TERM in xterm is xterm. TERM in tmux is screen.

How do i fix this? (Why do i need to fix it?)