]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.0653: BS and DEL do not work properly in an interacive shell v9.0.0653
authorBram Moolenaar <Bram@vim.org>
Mon, 3 Oct 2022 19:24:39 +0000 (20:24 +0100)
committerBram Moolenaar <Bram@vim.org>
Mon, 3 Oct 2022 19:24:39 +0000 (20:24 +0100)
Problem:    BS and DEL do not work properly in an interacive shell. (Gary
            Johnson)
Solution:   Adjust the length for replaced codes.

src/os_unix.c
src/os_win32.c
src/proto/term.pro
src/term.c
src/version.c

index e86e3083701f687c656cacc1a99c8f0321a962f6..20e979c1581147de9f22e860be5777a7a85e7db3 100644 (file)
@@ -5106,7 +5106,7 @@ mch_call_shell_fork(
                            }
                        }
 
-                       term_replace_bs_del_keycode(ta_buf, ta_len, len);
+                       len = term_replace_bs_del_keycode(ta_buf, ta_len, len);
 
                        /*
                         * For pipes: echo the typed characters.
index 5d544b241399fbb74c94c20a22daaab7d8cd3e13..644e64752137530d6ce48a9470648b25c76033ba 100644 (file)
@@ -4531,7 +4531,7 @@ mch_system_piped(char *cmd, int options)
                        }
                    }
 
-                   term_replace_bs_del_keycode(ta_buf, ta_len, len);
+                   len = term_replace_bs_del_keycode(ta_buf, ta_len, len);
 
                    /*
                     * For pipes: echo the typed characters.  For a pty this
index 8c56f62bd713558fa3f649740f0e74f8008602a5..13a093c882e40b37eea5b5739c8cd5cbefc17e55 100644 (file)
@@ -86,5 +86,5 @@ void update_tcap(int attr);
 void swap_tcap(void);
 void ansi_color2rgb(int nr, char_u *r, char_u *g, char_u *b, char_u *ansi_idx);
 void cterm_color2rgb(int nr, char_u *r, char_u *g, char_u *b, char_u *ansi_idx);
-void term_replace_bs_del_keycode(char_u *ta_buf, int ta_len, int len);
+int term_replace_bs_del_keycode(char_u *ta_buf, int ta_len, int len_arg);
 /* vim: set ft=c : */
index b7e3facdb1c1c8251330247b9bde2078fff22786..c23b840d1fa64c1bc949aab155d3282a077e3e34 100644 (file)
@@ -6733,11 +6733,13 @@ cterm_color2rgb(int nr, char_u *r, char_u *g, char_u *b, char_u *ansi_idx)
 #endif
 
 /*
- * Replace K_BS by <BS> and K_DEL by <DEL>
+ * Replace K_BS by <BS> and K_DEL by <DEL>.
+ * Returns "len" adjusted for replaced codes.
  */
-    void
-term_replace_bs_del_keycode(char_u *ta_buf, int ta_len, int len)
+    int
+term_replace_bs_del_keycode(char_u *ta_buf, int ta_len, int len_arg)
 {
+    int                len = len_arg;
     int                i;
     int                c;
 
@@ -6762,4 +6764,5 @@ term_replace_bs_del_keycode(char_u *ta_buf, int ta_len, int len)
        if (has_mbyte)
            i += (*mb_ptr2len_len)(ta_buf + i, ta_len + len - i) - 1;
     }
+    return len;
 }
index abc67c0c4af022f7fd0ce0aafd80467d63065bda..686b52581af67945b2de5fb75b952fd1fc16eecf 100644 (file)
@@ -699,6 +699,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    653,
 /**/
     652,
 /**/