aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2016-09-28 16:23:05 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2016-09-28 16:23:05 +0200
commit61fcc8c78174f92fbdad0a7f86b5086619b05ed9 (patch)
tree59294ba81ba1393d9ba02247d8d83cb95d953625
parentb09ab448b8553742ce0bf1a7df806dcac84bca7c (diff)
downloadbusybox-w32-61fcc8c78174f92fbdad0a7f86b5086619b05ed9.tar.gz
busybox-w32-61fcc8c78174f92fbdad0a7f86b5086619b05ed9.tar.bz2
busybox-w32-61fcc8c78174f92fbdad0a7f86b5086619b05ed9.zip
vi: fix '' command (goto to prev context)
The '' command in vi doesn't currently work because after the first apostrophe is read, the next character is converted to an integer between 0 and 25 inclusive (for indexing the array of marks). The comparison of the converted character with an apostrophe therefore never succeeds, meaning that '' doesn't do anything. Based on the patch by Francis Rounds <francis.rounds@4bridgeworks.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--editors/vi.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/editors/vi.c b/editors/vi.c
index c142dacd7..38a4692fd 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -2722,9 +2722,8 @@ static char *swap_context(char *p) // goto new context for '' command make this
2722 // only swap context if other context is valid 2722 // only swap context if other context is valid
2723 if (text <= mark[27] && mark[27] <= end - 1) { 2723 if (text <= mark[27] && mark[27] <= end - 1) {
2724 tmp = mark[27]; 2724 tmp = mark[27];
2725 mark[27] = mark[26]; 2725 mark[27] = p;
2726 mark[26] = tmp; 2726 mark[26] = p = tmp;
2727 p = mark[26]; // where we are going- previous context
2728 context_start = prev_line(prev_line(prev_line(p))); 2727 context_start = prev_line(prev_line(prev_line(p)));
2729 context_end = next_line(next_line(next_line(p))); 2728 context_end = next_line(next_line(next_line(p)));
2730 } 2729 }
@@ -3618,8 +3617,9 @@ static void do_cmd(int c)
3618 } 3617 }
3619 break; 3618 break;
3620 case '\'': // '- goto a specific mark 3619 case '\'': // '- goto a specific mark
3621 c1 = (get_one_char() | 0x20) - 'a'; 3620 c1 = (get_one_char() | 0x20);
3622 if ((unsigned)c1 <= 25) { // a-z? 3621 if ((unsigned)(c1 - 'a') <= 25) { // a-z?
3622 c1 = (c1 - 'a');
3623 // get the b-o-l 3623 // get the b-o-l
3624 q = mark[c1]; 3624 q = mark[c1];
3625 if (text <= q && q < end) { 3625 if (text <= q && q < end) {