vi: implement :p (go to previous file)
authorDennis Groenen <tj.groenen@gmail.com>
Tue, 31 Jan 2012 15:43:38 +0000 (16:43 +0100)
committerDennis Groenen <tj.groenen@gmail.com>
Tue, 31 Jan 2012 15:43:38 +0000 (16:43 +0100)
debian/patches/0001-vi-implement-p-go-to-previous-file.patch [new file with mode: 0644]
debian/patches/series

diff --git a/debian/patches/0001-vi-implement-p-go-to-previous-file.patch b/debian/patches/0001-vi-implement-p-go-to-previous-file.patch
new file mode 100644 (file)
index 0000000..ed3bc33
--- /dev/null
@@ -0,0 +1,38 @@
+From 0221708f0f7147c84c8f7288e9c510241d296a4c Mon Sep 17 00:00:00 2001
+From: Dennis Groenen <tj.groenen@gmail.com>
+Date: Sun, 22 Jan 2012 20:15:21 +0100
+Subject: [PATCH] vi: implement :p (go to previous file)
+
+---
+ editors/vi.c |    8 ++++++++
+ 1 files changed, 8 insertions(+), 0 deletions(-)
+
+diff --git a/editors/vi.c b/editors/vi.c
+index 4a2d5d4..ddca9d6 100644
+--- a/editors/vi.c
++++ b/editors/vi.c
+@@ -1111,6 +1111,7 @@ static void colon(char *buf)
+               Hit_Return();
+       } else if (strncmp(cmd, "quit", i) == 0 // quit
+               || strncmp(cmd, "next", i) == 0 // edit next file
++              || strncmp(cmd, "prev", i) == 0 // edit previous file
+       ) {
+               int n;
+               if (useforce) {
+@@ -1137,6 +1138,13 @@ static void colon(char *buf)
+                       status_line_bold("No more files to edit");
+                       goto ret;
+               }
++              // are there previous files to edit
++              if (*cmd == 'p' && optind <= 1) {
++                      status_line_bold("No previous files to edit");
++                      goto ret;
++              } else if (*cmd == 'p' && optind > 1) {
++                      optind = optind - 2;
++              }
+               editing = 0;
+       } else if (strncmp(cmd, "read", i) == 0) {      // read file into text[]
+               fn = args;
+-- 
+1.7.8.4
+
index b90745e..45a6a22 100644 (file)
@@ -15,11 +15,12 @@ top-display-rss.patch
 #New patches to bring back Maemo's old busybox behaviour
 supress-bad-number.patch
 parse-complete-hostname.patch
+ps-accept-and-ignore-missing-options.patch
 
 #New patches as per reported issues by users
 showkey-default-option.patch
-ps-accept-and-ignore-missing-options.patch
 0001-appletlib-parse-etc-environment-prior-to-applet-laun.patch
+0001-vi-implement-p-go-to-previous-file.patch
 
 #Hotfixes
 hotfixes/busybox-1.19.3-getty.patch
@@ -31,4 +32,7 @@ git-backports/0001-lineedit-fix-atomic-replace-of-history-file-hush-fix.patch
 git-backports/0002-lineedit-add-support-for-history-saving-on-exit.patch
 git-backports/0003-lineedit-remove-SAVE_HISTORY-bit-hist_file-can-be-us.patch
 
+#Miscellaneous
 0001-lineedit-fix-history-saving-when-history-MAX_HISTORY.patch
+
+