Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: smart-insert-last-word bugs
- X-seq: zsh-users 10885
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: smart-insert-last-word bugs
- Date: Sun, 15 Oct 2006 16:15:11 -0700
- In-reply-to: <061015114655.ZM32612@xxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20061014115617.GA28997@xxxxxxxxxxxxxxxxxxx> <061014142741.ZM22567@xxxxxxxxxxxxxxxxxxxxxx> <20061015005019.GJ28997@xxxxxxxxxxxxxxxxxxx> <061014210451.ZM22937@xxxxxxxxxxxxxxxxxxxxxx> <20061015155843.GN28997@xxxxxxxxxxxxxxxxxxx> <061015114655.ZM32612@xxxxxxxxxxxxxxxxxxxxxx>
On Oct 15, 11:46am, Bart Schaefer wrote:
}
} ... there's no way to tell zle what the autoremoval property should
} be for a user-defined widget.
}
} ... perhaps a reasonable fix would be to create } a couple of built-in
} widgets that do nothing *except* autoremoval.
Here's a patch. I'm not entirely certain whether we also need versions
of these that have the ZLE_MENUCMP or ZLE_ISCMP flags, or whether instead
of ZLE_NOTCOMMAND these should have ZLE_MENUCMP.
I chose to call them auto-suffix-remove and auto-suffix-retain. Better
suggestions welcome.
Index: Src/Zle/iwidgets.list
===================================================================
--- iwidgets.list 31 May 2006 14:11:59 -0000 1.6
+++ iwidgets.list 15 Oct 2006 23:05:04 -0000
@@ -14,6 +14,8 @@
"accept-line", acceptline, 0
"accept-line-and-down-history", acceptlineanddownhistory, 0
"argument-base", argumentbase, ZLE_MENUCMP | ZLE_KEEPSUFFIX | ZLE_LASTCOL | ZLE_NOTCOMMAND
+"auto-suffix-remove", handlesuffix, ZLE_NOTCOMMAND
+"auto-suffix-retain", handlesuffix, ZLE_KEEPSUFFIX | ZLE_NOTCOMMAND
"backward-char", backwardchar, 0
"backward-delete-char", backwarddeletechar, ZLE_KEEPSUFFIX
"backward-delete-word", backwarddeleteword, ZLE_KEEPSUFFIX
Index: Src/Zle/zle_utils.c
===================================================================
--- zle_utils.c 1 Oct 2006 02:38:53 -0000 1.10
+++ zle_utils.c 15 Oct 2006 22:11:16 -0000
@@ -865,6 +865,15 @@
return 0;
}
+/* user control of auto-suffixes -- see iwidgets.list */
+
+/**/
+int
+handlesuffix(UNUSED(char **args))
+{
+ return 0;
+}
+
/***************/
/* undo system */
/***************/
Index: Doc/Zsh/zle.yo
===================================================================
--- zle.yo 31 May 2006 14:11:59 -0000 1.20
+++ zle.yo 15 Oct 2006 22:56:54 -0000
@@ -1665,6 +1665,24 @@
Execute the current line, and push the next history
event on the the buffer stack.
)
+tindex(auto-suffix-remove)
+item(tt(auto-suffix-remove))(
+If the previous action added a suffix (space, slash, etc.) to the word on
+the command line, remove it. Otherwise do nothing. Removing the suffix
+ends any active menu completion or menu selection.
+
+This widget is intended to be called from user-defined widgets to enforce
+a desired suffix-removal behavior.
+)
+tindex(auto-suffix-retain)
+item(tt(auto-suffix-retain))(
+If the previous action added a suffix (space, slash, etc.) to the word on
+the command line, force it to be preserved. Otherwise do nothing.
+Retaining the suffix ends any active menu completion or menu selection.
+
+This widget is intended to be called from user-defined widgets to enforce
+a desired suffix-preservation behavior.
+)
tindex(beep)
item(tt(beep))(
Beep, unless the tt(BEEP) option is unset.
--
Messages sorted by:
Reverse Date,
Date,
Thread,
Author