Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: Add an option to disable deactivating region hilighting whenever you edit something
- X-seq: zsh-workers 33626
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: PATCH: Add an option to disable deactivating region hilighting whenever you edit something
- Date: Fri, 7 Nov 2014 10:04:30 +0100
- 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==
- In-reply-to: <8414.1415317703@thecus.kiddle.eu>
- 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: <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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author