Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: highlight pasted text
On Aug 13, 11:14pm, Daniel Shahaf wrote:
}
} 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
What's this? That's not how bindkey -s works. Unless you're attempting
to have the string "paste-and-munge" inserted on the command line, which
I suspect you aren't. Also $zle_bracketed_paste[2] is the sequence that
is *output* for disabling bracketed paste, which is going to be eaten by
the terminal emulator so you'd never see it as input.
Hmm, it just occurred to me that although the starting *input* sequence
for bracketed-paste can be changed by using "bindkey", the *ending*
input sequence is hardwired in bracketedstring(). If the terminal
might have different start/end mode sequences for output, it might
also *send* different start/end sequences around the paste, and as it
stands we can't discern the ending one.
It might actually be nice to have two widgets, one called at each end
of the paste. Then things like applying the quoting could appear in
the end-of-paste widget.
Anyway, back to the topic at hand: this --
} zle -N bracketed-paste paste-and-munge
-- should take care of calling paste-and-munge when the appropriate
start-of-a-paste sequence is seen.
} zle_highlight=(paste:standout)
}
} I haven't incorporated split-undo.
--
Barton E. Schaefer
Messages sorted by:
Reverse Date,
Date,
Thread,
Author