pkgsrc-Users archive

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

Re: Proposed change to misc/tmux keep erase char as the user likes it

Olaf Seibert <> writes:

> misc/tmux (and the tmux in base) both force the VERASE character to be
> DELETE, instead of leaving it alone at the user's preference. It even
> forcefully changes backspace into DELETE, breaking all my terminal
> settings.
> For decades I have set backspace ^H as the erase character, and forced
> my keyboards to produce the backspace character from the key which is
> clearly marked backspace.

This is humorous, as the key labeled backspace by the IBM-PC is clearly
the key that ought to be labeled DEL, as on a VT52 which I'd expect you
to be using with your VAX :-)

> Tmux seems to think it knows my preferences better than me and forces
> its own ideas upon me.  My systems are consistent and tmux messes it up.
> So I have local patches to fix it: it leaves the VERASE setting alone,
> so it stays the way you like it. It also doesn't translate keys into DEL
> any more.

But in all seriousness I completely see your point that tmux should not
be changing this.  I don't understand why it does, because it's
operating at the type-ascii layer, and it would seem obvious that the
ttys on each pty should be configured exactly as the original tty was on

I guess there is an issue with the way the original tty was configured,
when it started the tmux session, vs the way some other tty was
configured, when it attached.  But as I think you mean, each person has
a choice of two sane approaches:

  make the key send DEL and configure VERASE to DEL, always
  make the key send BS and configure VERASE to BS, always

> If you like DEL as your erase character, there is of course no change
> from the patch, as you will have set your terminals accordingly already.

Agreed that having configured DEL needs to continue to work right.  I've
been using tmux that way for almost 10 years and never noticed this...

> I want to add these patches to pkgsrc.  I would also like to patch the
> base system tmux in the same way. Objections?

I don't object to the content, but in pkgsrc we have a notion that bug
fixes are supposed to be filed upstream, so that in theory they'd be
fixed and we would not have to carry the patches indefinitely, and that
a link to the bug tracker entry should be present in the patchfile.

I am surprised about tmux behaving this way, as it seems to generally
have good judgement.  So I wonder what they are thinking and if this is
really as intentional and unreasonable as it seems.

I wonder if you are willing to file a bug report, which could be
referenced in the patches even if it's closed WONTFIX or ignored.

I would like to see comments that explain better; I mostly follow your
patches but the second one is somewhat hard to understand.  If you mean

  When initiaizing a tmux session, tmux forces the VERASE character for
  all ttys created within the session to be DEL.  Change this to
  preserve the VERASE value of the originating tty, similar to how the
  values of other special characters are inherited.

then it might be good to say that.  If I got it wrong, then you at least
have a clue as to what someone might guess.

> $NetBSD$
> Don't mess up the erase character.
> --- window.c.orig	2017-05-29 07:12:06.000000000 +0000
> +++ window.c
> @@ -919,7 +919,9 @@ window_pane_spawn(struct window_pane *wp
>  			fatal("tcgetattr failed");
>  		if (tio != NULL)
>  			memcpy(tio2.c_cc, tio->c_cc, sizeof tio2.c_cc);
> +#if 0
>  		tio2.c_cc[VERASE] = '\177';
> +#endif
>  #ifdef IUTF8
>  		tio2.c_iflag |= IUTF8;
>  #endif

Here, it seems like the code is changing any key that matches the VERASE
setting to BS, and that seems odd.  I don't understand why this doesn't
hurt the use of DEL, and I don't understand why it breaks how you do

> $NetBSD$
> Don't mess up the erase character.
> --- tty-keys.c.orig	2017-05-16 13:10:11.000000000 +0000
> +++ tty-keys.c
> @@ -541,7 +541,9 @@ tty_keys_next(struct tty *tty)
>  	struct timeval	 tv;
>  	const char	*buf;
>  	size_t		 len, size;
> +#if 0
>  	cc_t		 bspace;
> +#endif
>  	int		 delay, expired = 0, n;
>  	key_code	 key;
> @@ -654,6 +656,7 @@ partial_key:
>  complete_key:
>  	log_debug("%s: complete key %.*s %#llx", c->name, (int)size, buf, key);
> +#if 0
>  	/*
>  	 * Check for backspace key using termios VERASE - the terminfo
>  	 * kbs entry is extremely unreliable, so cannot be safely
> @@ -662,6 +665,7 @@ complete_key:
>  	bspace = tty->tio.c_cc[VERASE];
>  	if (bspace != _POSIX_VDISABLE && (key & KEYC_MASK_KEY) == bspace)
>  		key = (key & KEYC_MASK_MOD) | KEYC_BSPACE;
> +#endif
>  	/* Remove data from buffer. */
>  	evbuffer_drain(tty->in, size);
> -Olaf.

Home | Main Index | Thread Index | Old Index