From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26429 invoked by alias); 13 Aug 2015 23:50:45 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 36157 Received: (qmail 27302 invoked from network); 13 Aug 2015 23:50:43 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.0 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version:content-type; bh=ecs6lhShHKr36L7FjMgm/hrxRX55RF4VwJrNXi1IPhI=; b=YLtgnVYXXb4cjvxF9JRx77r3P8iQVWj/rsKASEcicSUg8bto/Xfjj/ommlY1HGPiX5 DsUX5OSZ2cCEmLCdHuLiD58MKcftX7mpPaGUvB3cNOzEBfPUJj0MZkDCLj8QqPP+func LnAx5UY0Xl73INFpgXZB5RV2dTJ8ehGfyfRFg+tK05EtfL9UlWijGuhEfUeM8JhB422D gd9A/FxA0b5O09PtbOGhb9aqUo1yONF22PqWur3Op82tYxFw2JUVK48hIL9YTfDK7XcJ 9jgEYOo3L+GZB1SOwFpD7WJS19Sda1lSo2v8IIzwYS2NvTqFNQxzVSKyeMPLXezSfV2s BZ9Q== X-Gm-Message-State: ALoCoQmmPUyFvS7uSkr2zYAd4Xl/FYFVGj4lqd3H8SaGWkpwICCrtbNfjfcG3DwnwXBYQiErEoRD X-Received: by 10.182.65.164 with SMTP id y4mr37009446obs.65.1439509838311; Thu, 13 Aug 2015 16:50:38 -0700 (PDT) From: Bart Schaefer Message-Id: <150813165035.ZM28935@torch.brasslantern.com> Date: Thu, 13 Aug 2015 16:50:35 -0700 In-Reply-To: <20150813231446.GB1998@tarsus.local2> Comments: In reply to Daniel Shahaf "Re: PATCH: highlight pasted text" (Aug 13, 11:14pm) References: <7277.1437023995@thecus.kiddle.eu> <150716131504.ZM18155@torch.brasslantern.com> <150718110859.ZM4405@torch.brasslantern.com> <19088.1437274234@thecus.kiddle.eu> <20150813231446.GB1998@tarsus.local2> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh workers Subject: Re: PATCH: highlight pasted text MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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