Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: highlight pasted text
- X-seq: zsh-workers 36155
 
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
 
- To: Mikael Magnusson <mikachu@xxxxxxxxx>
 
- Subject: Re: PATCH: highlight pasted text
 
- Date: Thu, 13 Aug 2015 23:14:46 +0000
 
- Cc: Oliver Kiddle <okiddle@xxxxxxxxxxx>, zsh workers <zsh-workers@xxxxxxx>
 
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=	daniel.shahaf.name; h=cc:content-type:date:from:in-reply-to	:message-id:mime-version:references:subject:to:x-sasl-enc	:x-sasl-enc; s=mesmtp; bh=S5xefvH216op9lXhErApotj+AYU=; b=Mv70to	9XKmR8Bh/gl2BqE3t16A4WQJXPoTIawLPoBrnly2DusSznL1J4MzyQSM5OhFKsa+	+bmjxqnG4znLjntr37B+G5TJzYfBb2JpheSSxxibvpiciOIE28EvJOcsYLhim5wb	U8BXarRjasISgy2jtOOnf2xtu5Tk5PfthqNfw=
 
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=	messagingengine.com; h=cc:content-type:date:from:in-reply-to	:message-id:mime-version:references:subject:to:x-sasl-enc	:x-sasl-enc; s=smtpout; bh=S5xefvH216op9lXhErApotj+AYU=; b=pDZ4m	VzyyfUgk9RluapGwrDsf16GrLEhjuiXkNKeMA/xLDmZHwEgdfXg+leFVFFzfm6/P	8oYDpVAhvDNMnQWQ7rNA3hj6FV5xDzofF1ssq3vBo2ZvNtLJEYwLWBPD77+gnuL7	W1so7E7zgj0hmHWyfZTfGZTNlx/fbXGHxaa/wY=
 
- In-reply-to: <CAHYJk3TALs+zN4TpQAGEK-mYDJwxAyWnZc+E00HaW=rOKJJZbg@mail.gmail.com>
 
- List-help: <mailto:zsh-workers-help@zsh.org>
 
- List-id: Zsh Workers List <zsh-workers.zsh.org>
 
- List-post: <mailto:zsh-workers@zsh.org>
 
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
 
- References: <mo6325$r5k$1@ger.gmane.org> <7277.1437023995@thecus.kiddle.eu> <150716131504.ZM18155@torch.brasslantern.com> <modfdp$crn$1@ger.gmane.org> <150718110859.ZM4405@torch.brasslantern.com> <19088.1437274234@thecus.kiddle.eu> <CAHYJk3TALs+zN4TpQAGEK-mYDJwxAyWnZc+E00HaW=rOKJJZbg@mail.gmail.com>
 
Mikael Magnusson wrote on Thu, Jul 23, 2015 at 07:00:40 +0200:
> Is there any way to use any of this (the highlighting) if you wrap the
> widget to manipulate the text first?
Here's an attempt to summarize the solutions proposed later in the thread:
paste-and-munge() {
  local unmunged munged
  zle .bracketed-paste unmunged
  munged=":::${unmunged}:::"
  LBUFFER+=$munged
  (( MARK = $#LBUFFER - $#munged ))
  zle kill-region
  zle yank
  zle -R
  zle read-command && zle -U - $KEYS
}
bindkey -s $zle_bracketed_paste[2] paste-and-munge
zle -N bracketed-paste paste-and-munge
zle_highlight=(paste:standout)
I haven't incorporated split-undo.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author