diff options
-rw-r--r-- | editors/vi.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/editors/vi.c b/editors/vi.c index e752685d8..fad53174e 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -3920,9 +3920,18 @@ static void do_cmd(int c) | |||
3920 | break; | 3920 | break; |
3921 | case 'r': // r- replace the current char with user input | 3921 | case 'r': // r- replace the current char with user input |
3922 | c1 = get_one_char(); // get the replacement char | 3922 | c1 = get_one_char(); // get the replacement char |
3923 | if (*dot != '\n') { | 3923 | if (c1 != 27) { |
3924 | dot = text_hole_delete(dot, dot, ALLOW_UNDO); | 3924 | if (end_line(dot) - dot < (cmdcnt ?: 1)) { |
3925 | dot = char_insert(dot, c1, ALLOW_UNDO_CHAIN); | 3925 | indicate_error(); |
3926 | goto dc6; | ||
3927 | } | ||
3928 | do { | ||
3929 | dot = text_hole_delete(dot, dot, allow_undo); | ||
3930 | #if ENABLE_FEATURE_VI_UNDO | ||
3931 | allow_undo = ALLOW_UNDO_CHAIN; | ||
3932 | #endif | ||
3933 | dot = char_insert(dot, c1, allow_undo); | ||
3934 | } while (--cmdcnt > 0); | ||
3926 | dot_left(); | 3935 | dot_left(); |
3927 | } | 3936 | } |
3928 | end_cmd_q(); // stop adding to q | 3937 | end_cmd_q(); // stop adding to q |