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

Re: Ctrl-C ignored after pasting a long text in an X terminal emulator



On Tue 24 Jan 2023 at 18:29:38 (+0100), Vincent Lefevre wrote:
> On 2023-01-24 10:36:05 -0600, David Wright wrote:
> > On Tue 24 Jan 2023 at 15:34:49 (+0100), Vincent Lefevre wrote:
> [...]
> > > For instance, if I paste the following 3 lines
> > > 
> > > foo1
> > > foo2
> > > foo3
> > > 
> > > in dash, I get:
> > > 
> > > $ foo1
> > > foo2
> > > foo3
> > > sh: 1: foo1: not found
> > > $ sh: 2: foo2: not found
> > > $ sh: 3: foo3: not found
> > > $ 
> > > 
> > > Then I can type Ctrl-C, but it occurs at a prompt with no input yet,
> > > and the 3 commands have already been executed.
> > 
> > Well, sure, you've pasted lines into a shell, and they get executed.
> > I don't think you want to prevent that.
> 
> With bracketed paste, the lines remains in the command line at the
> prompt until the user has typed the [Enter] key to run them. So the
> user can also type Ctrl-C to prevent any execution (or he can edit
> the command).

You're preaching to the converted; see
https://lists.debian.org/debian-user/2023/01/msg00562.html
two posts back.

My comment was with respect to your point 2, which was about
non-bracketed paste, and which was snipped off the top of your post.

BTW are you implying that dash does bracketed paste? I didn't know that.

> For instance, in zsh:
> 
> cventin:~> foo1
> foo2
> foo3
> 
> If I type [Enter], I get:
> 
> zsh: command not found: foo1
> zsh: command not found: foo2
> zsh: command not found: foo3
> cventin:~[127]>
> 
> But instead of [Enter], if I type Ctrl-C, I just get:
> 
> cventin:~[1!]>
> 
> Nothing has been executed. (The exit code 1 is strange and may be
> caused by a bug in some hook. This occurs only if I do a Ctrl-C
> directly after a paste, otherwise I get 130 as expected.)
> 
> > In terms of accidents, you've just driven a car at a brick wall,
> > and it runs into it, as expected.
> 
> No, with modern shells, bracketed paste is precisely there to avoid
> such kind of issues.

Quite clever, that. You quote my comment after some anecdote of yours
that gives it the opposite context, so you can then disgree with it.

BTW I don't know anything about nooks and zsh. As I said at the end
of my previous post, I'm not really interested in

> > testing the gamut of releases, terminals and shells.

But if you are, then it might be worth your posting a summary of your
findings in the form of a table that others could understand, rather
than in a back and forth of over-snipped posts.

Cheers,
David.


Reply to: