zsh-users
 help / color / mirror / code / Atom feed
* bracketed-paste & gnome-terminal
@ 2016-03-10 22:29 Danek Duvall
  2016-03-10 22:52 ` Bart Schaefer
  0 siblings, 1 reply; 10+ messages in thread
From: Danek Duvall @ 2016-03-10 22:29 UTC (permalink / raw)
  To: zsh-users

I know there's been a lot of change in the bracketed-paste area recently,
but I don't recall seeing anything about this, and I've long since deleted
those emails.  I hope this is new ground, but maybe not.

I've upgraded to zsh 5.2 on my Solaris system.  Everything works fine for
me -- pastes into the terminal are highlighted as expected.  But if I use
gnome-terminal instead of xterm, then the bracket codes show up on the
commandline: e[200~copymee[201~.  Unsetting zle_bracketed_paste works
around the problem, but it's not clear to me what's going on that it's
broken.  I'm assuming it's an issue with gnome-terminal (or libvte), but I
didn't find any associated bugs on the gnome bugzilla.

FWIW, the terminal is, I think, rather old: 2.30.2.  The vte library is
0.26.2.  So it might be a sign of extreme age more than anything else, and
I believe we're working on upgrading those components, but in case there's
anything that zsh could/should do about this, I thought I'd ask.

Thanks,
Danek


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: bracketed-paste & gnome-terminal
  2016-03-10 22:29 bracketed-paste & gnome-terminal Danek Duvall
@ 2016-03-10 22:52 ` Bart Schaefer
  2016-03-14 19:57   ` Danek Duvall
  2016-03-21 17:30   ` Danek Duvall
  0 siblings, 2 replies; 10+ messages in thread
From: Bart Schaefer @ 2016-03-10 22:52 UTC (permalink / raw)
  To: zsh-users

On Mar 10,  2:29pm, Danek Duvall wrote:
}
} I've upgraded to zsh 5.2 on my Solaris system.  Everything works fine for
} me -- pastes into the terminal are highlighted as expected.  But if I use
} gnome-terminal instead of xterm, then the bracket codes show up on the
} commandline: e[200~copymee[201~.

Bracketed-paste works as expected in gnome-terminal on Ubuntu 12.04 LTS:
GNOME Terminal 3.4.1.1

So it does appear to be, as you suspected, terminal version related.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: bracketed-paste & gnome-terminal
  2016-03-10 22:52 ` Bart Schaefer
@ 2016-03-14 19:57   ` Danek Duvall
  2016-03-20 18:34     ` Bart Schaefer
       [not found]     ` <160320113419.ZM22381__3117.39058602161$1458498907$gmane$org@torch.brasslantern.com>
  2016-03-21 17:30   ` Danek Duvall
  1 sibling, 2 replies; 10+ messages in thread
From: Danek Duvall @ 2016-03-14 19:57 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-users

On Thu, Mar 10, 2016 at 02:52:28PM -0800, Bart Schaefer wrote:

> On Mar 10,  2:29pm, Danek Duvall wrote:
> }
> } I've upgraded to zsh 5.2 on my Solaris system.  Everything works fine for
> } me -- pastes into the terminal are highlighted as expected.  But if I use
> } gnome-terminal instead of xterm, then the bracket codes show up on the
> } commandline: e[200~copymee[201~.
> 
> Bracketed-paste works as expected in gnome-terminal on Ubuntu 12.04 LTS:
> GNOME Terminal 3.4.1.1
> 
> So it does appear to be, as you suspected, terminal version related.

I see something similar when running zsh from M-x shell in emacs (something
another user pointed me at):

    $ ^[[?2004h
    ^[[?2004l

Everything's fine when it pastes, presumably because emacs' terminal emulation
doesn't support bracketed paste.

Is there any way around either of these problems, other than explicitly
unsetting zle_bracketed_paste when detecting that you're running inside an
emacs terminal or gnome-terminal?

Thanks,
Danek


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: bracketed-paste & gnome-terminal
  2016-03-14 19:57   ` Danek Duvall
@ 2016-03-20 18:34     ` Bart Schaefer
       [not found]     ` <160320113419.ZM22381__3117.39058602161$1458498907$gmane$org@torch.brasslantern.com>
  1 sibling, 0 replies; 10+ messages in thread
From: Bart Schaefer @ 2016-03-20 18:34 UTC (permalink / raw)
  To: zsh-users

Missed this one ...

On Mar 14, 12:57pm, Danek Duvall wrote:
}
} I see something similar when running zsh from M-x shell in emacs (something
} another user pointed me at):
} 
}     $ ^[[?2004h
}     ^[[?2004l
} 
} Everything's fine when it pastes, presumably because emacs' terminal
} emulation doesn't support bracketed paste.

Emacs terminal emulation always behaves as if bracketed-paste were in
effect, because it's not attempting to do live interaction with the
program running in the buffer -- that is, you do all your editing in
the emacs buffer without anything being sent to the shell, and then
when you finally press enter (or equivalent binding) it all gets
transmitted at once.

So emacs has no reason to recognize escapes that differentiate a paste
from any other kind of input.

} Is there any way around either of these problems, other than
} explicitly unsetting zle_bracketed_paste when detecting that you're
} running inside an emacs terminal or gnome-terminal?

No, not that I can think of.

These are among the reasons that I think bracketed-paste ought to have
been something you have to explicitly turn ON, rather than something
you have to turn off, but consensus went the other way.

-- 
Barton E. Schaefer


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: bracketed-paste & gnome-terminal
       [not found]     ` <160320113419.ZM22381__3117.39058602161$1458498907$gmane$org@torch.brasslantern.com>
@ 2016-03-21 16:08       ` Daniel Shahaf
  2016-03-21 16:38         ` Danek Duvall
  2016-03-21 17:10         ` Bart Schaefer
  0 siblings, 2 replies; 10+ messages in thread
From: Daniel Shahaf @ 2016-03-21 16:08 UTC (permalink / raw)
  To: zsh-users

Bart Schaefer wrote on Sun, Mar 20, 2016 at 11:34:19 -0700:
> These are among the reasons that I think bracketed-paste ought to have
> been something you have to explicitly turn ON, rather than something
> you have to turn off, but consensus went the other way.

We could have $zle_bracketed_paste default to unset for TERM == emacs,
if emacs users think that's a good idea.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: bracketed-paste & gnome-terminal
  2016-03-21 16:08       ` Daniel Shahaf
@ 2016-03-21 16:38         ` Danek Duvall
  2016-03-21 17:18           ` Bart Schaefer
  2016-03-21 17:10         ` Bart Schaefer
  1 sibling, 1 reply; 10+ messages in thread
From: Danek Duvall @ 2016-03-21 16:38 UTC (permalink / raw)
  To: Daniel Shahaf; +Cc: zsh-users

On Mon, Mar 21, 2016 at 04:08:22PM +0000, Daniel Shahaf wrote:

> Bart Schaefer wrote on Sun, Mar 20, 2016 at 11:34:19 -0700:
> > These are among the reasons that I think bracketed-paste ought to have
> > been something you have to explicitly turn ON, rather than something
> > you have to turn off, but consensus went the other way.
> 
> We could have $zle_bracketed_paste default to unset for TERM == emacs,
> if emacs users think that's a good idea.

Except that emacs now seems to set TERM=dumb -- at least on GTK+ GNU emacs
24.5.1, that we're currently running on Solaris -- so I'm not sure how
reliable that'll be.  Is there a better way to check for running inside
emacs?

Danek


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: bracketed-paste & gnome-terminal
  2016-03-21 16:08       ` Daniel Shahaf
  2016-03-21 16:38         ` Danek Duvall
@ 2016-03-21 17:10         ` Bart Schaefer
  2016-03-22  1:24           ` Daniel Shahaf
  1 sibling, 1 reply; 10+ messages in thread
From: Bart Schaefer @ 2016-03-21 17:10 UTC (permalink / raw)
  To: zsh-users

On Mar 21,  4:08pm, Daniel Shahaf wrote:
}
} We could have $zle_bracketed_paste default to unset for TERM == emacs,
} if emacs users think that's a good idea.

We currently don't have any kind of default terminal type handling built
into the shell.  There are a couple of things that attempt to use
terminfo/cap booleans, but nothing that examines terminal name.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: bracketed-paste & gnome-terminal
  2016-03-21 16:38         ` Danek Duvall
@ 2016-03-21 17:18           ` Bart Schaefer
  0 siblings, 0 replies; 10+ messages in thread
From: Bart Schaefer @ 2016-03-21 17:18 UTC (permalink / raw)
  To: zsh-users

On Mar 21,  9:38am, Danek Duvall wrote:
}
} Except that emacs now seems to set TERM=dumb [...]
} Is there a better way to check for running inside emacs?

Some versions of emacs export EMACS=t into the environment.  I don't know
how reliable that is, either.

I have this in .zshrc; I have no recollection of how old that "eterm"
comment is:

case ${TERM:-dumb} in
emacs|dumb)
    [[ $EMACS = t ]] || return 0
    export TERMCAP='emacs|:am:bl=:cr=^M:do=^J:sf=^J:'
    TERM=emacs 2>/dev/null
    export EDITOR=emacs
    stty -onlcr -echo
    ttyctl -f
    ;;
#  eterm)
#      # This is bad; eterm is the Enlightenment terminal emulator name.
#      # Recent versions of emacs now use 'emacs-em7930' and stuff their
#      # own termcap or terminfo into the process environment.
#      TERM=vt100
#      ;;
esac


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: bracketed-paste & gnome-terminal
  2016-03-10 22:52 ` Bart Schaefer
  2016-03-14 19:57   ` Danek Duvall
@ 2016-03-21 17:30   ` Danek Duvall
  1 sibling, 0 replies; 10+ messages in thread
From: Danek Duvall @ 2016-03-21 17:30 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-users

On Thu, Mar 10, 2016 at 02:52:28PM -0800, Bart Schaefer wrote:

> On Mar 10,  2:29pm, Danek Duvall wrote:
> }
> } I've upgraded to zsh 5.2 on my Solaris system.  Everything works fine for
> } me -- pastes into the terminal are highlighted as expected.  But if I use
> } gnome-terminal instead of xterm, then the bracket codes show up on the
> } commandline: e[200~copymee[201~.
> 
> Bracketed-paste works as expected in gnome-terminal on Ubuntu 12.04 LTS:
> GNOME Terminal 3.4.1.1
> 
> So it does appear to be, as you suspected, terminal version related.

I did a bit more digging, and discovered that it's actually compiler
related.  We build vte with Studio 12.3, but if I build with gcc 4.8, the
problem goes away.  The problem exists with newer versions of Studio as
well.  I don't know yet whether this is a compiler bug or some weird header
or standards mode interaction.  But it's not a zsh bug.  :)

Thanks,
Danek


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: bracketed-paste & gnome-terminal
  2016-03-21 17:10         ` Bart Schaefer
@ 2016-03-22  1:24           ` Daniel Shahaf
  0 siblings, 0 replies; 10+ messages in thread
From: Daniel Shahaf @ 2016-03-22  1:24 UTC (permalink / raw)
  To: zsh-users

Bart Schaefer wrote on Mon, Mar 21, 2016 at 10:10:42 -0700:
> On Mar 21,  4:08pm, Daniel Shahaf wrote:
> }
> } We could have $zle_bracketed_paste default to unset for TERM == emacs,
> } if emacs users think that's a good idea.
> 
> We currently don't have any kind of default terminal type handling built
> into the shell.  There are a couple of things that attempt to use
> terminfo/cap booleans, but nothing that examines terminal name.

Sure, ideally we'd ask terminfo whether bracketed paste is supported
[and what the control sequences for it are], but if the only practical
way to detect being in emacs would turn out to be by literally checking
the value of getenv("TERM"), I wouldn't mind that, so long as it
wouldn't break xterm/vim/etc.

Cheers,

Daniel


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-03-22  1:24 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-10 22:29 bracketed-paste & gnome-terminal Danek Duvall
2016-03-10 22:52 ` Bart Schaefer
2016-03-14 19:57   ` Danek Duvall
2016-03-20 18:34     ` Bart Schaefer
     [not found]     ` <160320113419.ZM22381__3117.39058602161$1458498907$gmane$org@torch.brasslantern.com>
2016-03-21 16:08       ` Daniel Shahaf
2016-03-21 16:38         ` Danek Duvall
2016-03-21 17:18           ` Bart Schaefer
2016-03-21 17:10         ` Bart Schaefer
2016-03-22  1:24           ` Daniel Shahaf
2016-03-21 17:30   ` Danek Duvall

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).