zsh-workers
 help / color / mirror / code / Atom feed
* buggy paste highlight with backward-extend-paste
@ 2015-12-09  2:16 Vincent Lefevre
  2015-12-09  5:30 ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Vincent Lefevre @ 2015-12-09  2:16 UTC (permalink / raw)
  To: zsh-workers

When using:

  autoload -Uz bracketed-paste-magic
  zle -N bracketed-paste bracketed-paste-magic
  zstyle :bracketed-paste-magic paste-init backward-extend-paste

if I type:

% echo foo

with the cursor just after "foo", and paste "a", then the whole
"fooa" gets highlighted instead of just "a".

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


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

* Re: buggy paste highlight with backward-extend-paste
  2015-12-09  2:16 buggy paste highlight with backward-extend-paste Vincent Lefevre
@ 2015-12-09  5:30 ` Bart Schaefer
  2015-12-09  9:13   ` Vincent Lefevre
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2015-12-09  5:30 UTC (permalink / raw)
  To: Zsh hackers list

On Tue, Dec 8, 2015 at 6:16 PM, Vincent Lefevre <vincent@vinc17.net> wrote:
>
>   zstyle :bracketed-paste-magic paste-init backward-extend-paste
>
> % echo foo
>
> with the cursor just after "foo", and paste "a", then the whole
> "fooa" gets highlighted instead of just "a".


That's intentional, not a bug.  The paste was extended backward.


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

* Re: buggy paste highlight with backward-extend-paste
  2015-12-09  5:30 ` Bart Schaefer
@ 2015-12-09  9:13   ` Vincent Lefevre
  2015-12-09 21:46     ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Vincent Lefevre @ 2015-12-09  9:13 UTC (permalink / raw)
  To: zsh-workers

On 2015-12-08 21:30:17 -0800, Bart Schaefer wrote:
> On Tue, Dec 8, 2015 at 6:16 PM, Vincent Lefevre <vincent@vinc17.net> wrote:
> >
> >   zstyle :bracketed-paste-magic paste-init backward-extend-paste
> >
> > % echo foo
> >
> > with the cursor just after "foo", and paste "a", then the whole
> > "fooa" gets highlighted instead of just "a".
> 
> That's intentional, not a bug.  The paste was extended backward.

But I don't want to extend the paste backward!

Note that I have the zstyle above just to make the paste correct in
the following case:

# Helper/example paste-init for exposing a word prefix inside PASTED.
# Useful with url-quote-magic if you have http://... on the line and
# are pasting additional text on the end of the URL.
#
# Usage:
#       zstyle :bracketed-paste-magic paste-init backward-extend-paste

But affected the highlight is not expected.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


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

* Re: buggy paste highlight with backward-extend-paste
  2015-12-09  9:13   ` Vincent Lefevre
@ 2015-12-09 21:46     ` Bart Schaefer
  2015-12-11 10:29       ` Vincent Lefevre
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2015-12-09 21:46 UTC (permalink / raw)
  To: zsh-workers

On Dec 9, 10:13am, Vincent Lefevre wrote:
} Subject: Re: buggy paste highlight with backward-extend-paste
}
} > On Tue, Dec 8, 2015 at 6:16 PM, Vincent Lefevre <vincent@vinc17.net> wrote:
} > >
} > >   zstyle :bracketed-paste-magic paste-init backward-extend-paste
} 
} But I don't want to extend the paste backward!

So I gather, but I did name it that way for a reason. :-)

} Note that I have the zstyle above just to make the paste correct in
} the following case:
} 
} # Helper/example paste-init for exposing a word prefix inside PASTED.
} # Useful with url-quote-magic if you have http://... on the line and
} # are pasting additional text on the end of the URL.
} 
} But affected the highlight is not expected.

This is one reason that Mikael keeps pushing his simplified variant where
you have no choice but to paste the entire URL rather than just a suffix
of it.

To "fix up" the highlighting, you'd also need a paste-finish action to
coordinate with backward-extend-paste.  E.g.:

- In backward-extend-paste, save $bep_words[-1] in a global variable.

- In the paste-finish function, compare that saved global to the
leftmost part of $PASTED, and if they match, delete it from $PASTED
and append it to $LBUFFER.

- Also in paste-finish, possibly fix up the position of MARK.

If you come up with something that works, I'd be happy to look at it.
Otherwise it may be a while before I make an attempt.


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

* Re: buggy paste highlight with backward-extend-paste
  2015-12-09 21:46     ` Bart Schaefer
@ 2015-12-11 10:29       ` Vincent Lefevre
  0 siblings, 0 replies; 5+ messages in thread
From: Vincent Lefevre @ 2015-12-11 10:29 UTC (permalink / raw)
  To: zsh-workers

On 2015-12-09 13:46:49 -0800, Bart Schaefer wrote:
> This is one reason that Mikael keeps pushing his simplified variant where
> you have no choice but to paste the entire URL rather than just a suffix
> of it.

backward-extend-paste is needed even when pasting full URL's.
For instance:

$ wget '

then paste: http://localhost/foo&bar

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


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

end of thread, other threads:[~2015-12-11 10:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-09  2:16 buggy paste highlight with backward-extend-paste Vincent Lefevre
2015-12-09  5:30 ` Bart Schaefer
2015-12-09  9:13   ` Vincent Lefevre
2015-12-09 21:46     ` Bart Schaefer
2015-12-11 10:29       ` Vincent Lefevre

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).