zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: simple up/down line widgets
@ 2014-11-15  7:03 Oliver Kiddle
  2014-11-17 10:58 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Oliver Kiddle @ 2014-11-15  7:03 UTC (permalink / raw)
  To: Zsh workers

This adds simple up and down line widgets that don't do any history
recall at all. Probably should have done this long ago because
everything is already there so its a tiny change.

I'll probably make these default in visual selection mode because I can't
imagine anyone wanting history to work from there. Personally, I do all
my history stuff from insert mode and will use these for vicmd.

Oliver

diff --git a/Doc/Zsh/zle.yo b/Doc/Zsh/zle.yo
index bf1b315..998bf4a 100644
--- a/Doc/Zsh/zle.yo
+++ b/Doc/Zsh/zle.yo
@@ -1087,6 +1087,10 @@ tindex(vi-beginning-of-line)
 item(tt(vi-beginning-of-line))(
 Move to the beginning of the line, without changing lines.
 )
+tindex(down-line)
+item(tt(down-line) (unbound) (unbound) (unbound))(
+Move down a line in the buffer.
+)
 tindex(end-of-line)
 item(tt(end-of-line) (^E) (unbound) (unbound))(
 Move to the end of the line.  If already at the end
@@ -1179,6 +1183,10 @@ tindex(vi-rev-repeat-find)
 item(tt(vi-rev-repeat-find) (unbound) (,) (unbound))(
 Repeat the last tt(vi-find) command in the opposite direction.
 )
+tindex(up-line)
+item(tt(up-line) (unbound) (unbound) (unbound))(
+Move up a line in the buffer.
+)
 enditem()
 texinode(History Control)(Modifying Text)(Movement)(Zle Widgets)
 subsect(History Control)
diff --git a/Src/Zle/iwidgets.list b/Src/Zle/iwidgets.list
index 39c81e6..2618297 100644
--- a/Src/Zle/iwidgets.list
+++ b/Src/Zle/iwidgets.list
@@ -41,6 +41,7 @@
 "digit-argument", digitargument, ZLE_MENUCMP | ZLE_KEEPSUFFIX | ZLE_LASTCOL | ZLE_NOTCOMMAND
 "down-case-word", downcaseword, 0
 "down-history", downhistory, 0
+"down-line", downline, ZLE_LINEMOVE | ZLE_LASTCOL
 "down-line-or-history", downlineorhistory, ZLE_LINEMOVE | ZLE_LASTCOL
 "down-line-or-search", downlineorsearch, ZLE_LINEMOVE | ZLE_LASTCOL
 "emacs-backward-word", emacsbackwardword, 0
@@ -113,6 +114,7 @@
 "universal-argument", universalargument, ZLE_MENUCMP | ZLE_KEEPSUFFIX | ZLE_LASTCOL | ZLE_NOTCOMMAND
 "up-case-word", upcaseword, 0
 "up-history", uphistory, 0
+"up-line", upline, ZLE_LINEMOVE | ZLE_LASTCOL
 "up-line-or-history", uplineorhistory, ZLE_LINEMOVE | ZLE_LASTCOL
 "up-line-or-search", uplineorsearch, ZLE_LINEMOVE | ZLE_LASTCOL
 "vi-add-eol", viaddeol, 0
diff --git a/Src/Zle/zle_hist.c b/Src/Zle/zle_hist.c
index 44b39d1..bf7b5f4 100644
--- a/Src/Zle/zle_hist.c
+++ b/Src/Zle/zle_hist.c
@@ -227,14 +227,14 @@ uphistory(UNUSED(char **args))
 }
 
 /**/
-static int
-upline(void)
+int
+upline(char **args)
 {
     int n = zmult;
 
     if (n < 0) {
 	zmult = -zmult;
-	n = -downline();
+	n = -downline(args);
 	zmult = -zmult;
 	return n;
     }
@@ -270,7 +270,7 @@ int
 uplineorhistory(char **args)
 {
     int ocs = zlecs;
-    int n = upline();
+    int n = upline(args);
     if (n) {
 	int m = zmult, ret;
 
@@ -300,7 +300,7 @@ int
 uplineorsearch(char **args)
 {
     int ocs = zlecs;
-    int n = upline();
+    int n = upline(args);
     if (n) {
 	int m = zmult, ret;
 
@@ -316,14 +316,14 @@ uplineorsearch(char **args)
 }
 
 /**/
-static int
-downline(void)
+int
+downline(char **args)
 {
     int n = zmult;
 
     if (n < 0) {
 	zmult = -zmult;
-	n = -upline();
+	n = -upline(args);
 	zmult = -zmult;
 	return n;
     }
@@ -358,7 +358,7 @@ int
 downlineorhistory(char **args)
 {
     int ocs = zlecs;
-    int n = downline();
+    int n = downline(args);
     if (n) {
 	int m = zmult, ret;
 
@@ -388,7 +388,7 @@ int
 downlineorsearch(char **args)
 {
     int ocs = zlecs;
-    int n = downline();
+    int n = downline(args);
     if (n) {
 	int m = zmult, ret;
 


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: PATCH: simple up/down line widgets
  2014-11-15  7:03 PATCH: simple up/down line widgets Oliver Kiddle
@ 2014-11-17 10:58 ` Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2014-11-17 10:58 UTC (permalink / raw)
  To: Zsh workers

On Sat, 15 Nov 2014 08:03:18 +0100
Oliver Kiddle <okiddle@yahoo.co.uk> wrote:
> This adds simple up and down line widgets that don't do any history
> recall at all. Probably should have done this long ago because
> everything is already there so its a tiny change.
> 
> I'll probably make these default in visual selection mode because I can't
> imagine anyone wanting history to work from there. Personally, I do all
> my history stuff from insert mode and will use these for vicmd.

That would certainly be worth noting in the README, but I expect it
could do with wider notes about the vi revamp at some point.

pws


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-11-17 11:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-15  7:03 PATCH: simple up/down line widgets Oliver Kiddle
2014-11-17 10:58 ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).