From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15916 invoked by alias); 7 Nov 2014 09:04:58 -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: 33626 Received: (qmail 9049 invoked from network); 7 Nov 2014 09:04:45 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:in-reply-to:references; bh=o8ZdE5pjhiWvJGmD1NObFOeEJRXc9fLI8SmfQznwa2M=; b=RGftP15I+a0CSaL0LvENSIMSKjj+1JOyS/clMwqdCSJlvAK+OXS7NcsJlA6zcm+F8m OusBgcpB5GuK0ZwErtk7BEcs8ELZbnasmzqQQaoHhKQHZViuETpT7mN9BGsi7ag0ZF+j aSUDaM+Ebdl5dbQtzm9ffumP5Uu3RthswjuwuV9KDP9mMfJQZTkP7gT71cg7GtvUKU3T mN9rhAZ4pMg1lcH5dEzWvRVogElmRoVbXhA61noDH/KDBVIa317v032DhKg78GkBT5je WTJDIwdi8AiqIelQ8D7THyVX/M7ejpGOEJhN502NJQl6wpXj1kpwFMYctEonxB6rngkm Dtgg== X-Received: by 10.152.116.80 with SMTP id ju16mr4334800lab.13.1415351080374; Fri, 07 Nov 2014 01:04:40 -0800 (PST) From: Mikael Magnusson To: zsh-workers@zsh.org Subject: PATCH: Add an option to disable deactivating region hilighting whenever you edit something Date: Fri, 7 Nov 2014 10:04:30 +0100 Message-Id: <1415351070-22018-1-git-send-email-mikachu@gmail.com> X-Mailer: git-send-email 2.2.0-rc0 In-Reply-To: <8414.1415317703@thecus.kiddle.eu> References: <8414.1415317703@thecus.kiddle.eu> For allowing zle beep to end the region, you could just use REGION_ACTIVE=0 instead. While we're on the topic of deactivating the region, I've had this patch lying around forever in my local tree, but never cared enough to send it. It just keeps the region on until the user disables it again, I use this very complicated widget: _toggle_region_active () { (( REGION_ACTIVE = !REGION_ACTIVE )) } My use case for the above is doing a set-mark-command, typing a long thing, and then invoking quote-region, while maintaining visual feedback of the region. (Sometimes I forgot to do the set-mark-command and ended up quoting the whole line). --- Src/Zle/zle_utils.c | 6 ++++-- Src/options.c | 1 + Src/zsh.h | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c index ba7642b..a264a4b 100644 --- a/Src/Zle/zle_utils.c +++ b/Src/Zle/zle_utils.c @@ -803,7 +803,8 @@ spaceinline(int ct) } } } - region_active = 0; + if (isset(EDITDEACTIVATESREGION)) + region_active = 0; } /* @@ -883,7 +884,8 @@ shiftchars(int to, int cnt) } zleline[zlell = to] = ZWC('\0'); } - region_active = 0; + if (isset(EDITDEACTIVATESREGION)) + region_active = 0; } /* diff --git a/Src/options.c b/Src/options.c index 45c1d11..444e9ef 100644 --- a/Src/options.c +++ b/Src/options.c @@ -122,6 +122,7 @@ static struct optname optns[] = { {{NULL, "cshnullcmd", OPT_EMULATE|OPT_CSH}, CSHNULLCMD}, {{NULL, "cshnullglob", OPT_EMULATE|OPT_CSH}, CSHNULLGLOB}, {{NULL, "debugbeforecmd", OPT_ALL}, DEBUGBEFORECMD}, +{{NULL, "editdeactivatesregion", OPT_ALL}, EDITDEACTIVATESREGION}, {{NULL, "emacs", 0}, EMACSMODE}, {{NULL, "equals", OPT_EMULATE|OPT_ZSH}, EQUALS}, {{NULL, "errexit", OPT_EMULATE}, ERREXIT}, diff --git a/Src/zsh.h b/Src/zsh.h index 642e290..583edd9 100644 --- a/Src/zsh.h +++ b/Src/zsh.h @@ -2074,6 +2074,7 @@ enum { CSHNULLCMD, CSHNULLGLOB, DEBUGBEFORECMD, + EDITDEACTIVATESREGION, EMACSMODE, EQUALS, ERREXIT, -- 2.2.0-rc0