summaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorPaul Fox2006-03-27 21:51:16 +0000
committerPaul Fox2006-03-27 21:51:16 +0000
commit9360f42d32f63c3d5239b297f4696d9d085bc5ba (patch)
treef75628a9fad9ce209ecfb4f05a087ba5c76402cd /editors
parentdbf935dae6917b1c6f322f1a5c34c315fa8ba347 (diff)
downloadbusybox-9360f42d32f63c3d5239b297f4696d9d085bc5ba.zip
busybox-9360f42d32f63c3d5239b297f4696d9d085bc5ba.tar.gz
add support for :wn (initial patch from Alexander Griesser)
Diffstat (limited to 'editors')
-rw-r--r--editors/vi.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/editors/vi.c b/editors/vi.c
index 6e5f07e..1cd1b1a 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -1072,9 +1072,10 @@ static void colon(Byte * buf)
#endif /* CONFIG_FEATURE_VI_SEARCH */
} else if (strncasecmp((char *) cmd, "version", i) == 0) { // show software version
psb("%s", vi_Version);
- } else if ((strncasecmp((char *) cmd, "write", i) == 0) || // write text to file
- (strncasecmp((char *) cmd, "wq", i) == 0) ||
- (strncasecmp((char *) cmd, "x", i) == 0)) {
+ } else if (strncasecmp((char *) cmd, "write", i) == 0 // write text to file
+ || strncasecmp((char *) cmd, "wq", i) == 0
+ || strncasecmp((char *) cmd, "wn", i) == 0
+ || strncasecmp((char *) cmd, "x", i) == 0) {
// is there a file name to write to?
if (strlen((char *) args) > 0) {
fn = args;
@@ -1111,7 +1112,9 @@ static void colon(Byte * buf)
file_modified = 0;
last_file_modified = -1;
}
- if ((cmd[0] == 'x' || cmd[1] == 'q') && l == ch) {
+ if ((cmd[0] == 'x' || cmd[1] == 'q' || cmd[1] == 'n' ||
+ cmd[0] == 'X' || cmd[1] == 'Q' || cmd[1] == 'N')
+ && l == ch) {
editing = 0;
}
}
@@ -3420,9 +3423,10 @@ key_cmd_mode:
} else {
editing = 0;
}
- } else if (strncasecmp((char *) p, "write", cnt) == 0 ||
- strncasecmp((char *) p, "wq", cnt) == 0 ||
- strncasecmp((char *) p, "x", cnt) == 0) {
+ } else if (strncasecmp((char *) p, "write", cnt) == 0
+ || strncasecmp((char *) p, "wq", cnt) == 0
+ || strncasecmp((char *) p, "wn", cnt) == 0
+ || strncasecmp((char *) p, "x", cnt) == 0) {
cnt = file_write(cfn, text, end - 1);
if (cnt < 0) {
if (cnt == -1)
@@ -3431,7 +3435,8 @@ key_cmd_mode:
file_modified = 0;
last_file_modified = -1;
psb("\"%s\" %dL, %dC", cfn, count_lines(text, end - 1), cnt);
- if (p[0] == 'x' || p[1] == 'q') {
+ if (p[0] == 'x' || p[1] == 'q' || p[1] == 'n' ||
+ p[0] == 'X' || p[1] == 'Q' || p[1] == 'N') {
editing = 0;
}
}