[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [PATCH 4/8] vi: 'ZZ' should warn if there are more files to edit
From:       Ron Yorston <rmy () pobox ! com>
Date:       2021-04-25 10:53:23
Message-ID: 60854a23.Sgko6k61+IrjFcYc%rmy () pobox ! com
[Download RAW message or body]

When 'ZZ' was used to save the current file and more files were
available to edit BusyBox vi immediately moved on to the next file.
The correct behaviour is to issue a warning.

function                                             old     new   delta
do_cmd                                              4673    4724     +51
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 51/0)               Total: 51 bytes

Signed-off-by: Ron Yorston <rmy@pobox.com>
---
 editors/vi.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/editors/vi.c b/editors/vi.c
index a38f2189d..7de55d1e6 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -4010,6 +4010,14 @@ static void do_cmd(int c)
 		} else {
 			editing = 0;
 		}
+		// are there other files to edit?
+		j = cmdline_filecnt - optind - 1;
+		if (editing == 0 && j > 0) {
+			editing = 1;
+			modified_count = 0;
+			last_modified_count = -1;
+			status_line_bold("%u more file(s) to edit", j);
+		}
 		break;
 	case '^':			// ^- move to first non-blank on line
 		dot_begin();
-- 
2.30.2

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic