patch 9.0.0653: BS and DEL do not work properly in an interacive shell

Problem:    BS and DEL do not work properly in an interacive shell. (Gary
            Johnson)
Solution:   Adjust the length for replaced codes.
diff --git a/src/os_unix.c b/src/os_unix.c
index e86e308..20e979c 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -5106,7 +5106,7 @@
 			    }
 			}
 
-			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.
diff --git a/src/os_win32.c b/src/os_win32.c
index 5d544b2..644e647 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -4531,7 +4531,7 @@
 			}
 		    }
 
-		    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
diff --git a/src/proto/term.pro b/src/proto/term.pro
index 8c56f62..13a093c 100644
--- a/src/proto/term.pro
+++ b/src/proto/term.pro
@@ -86,5 +86,5 @@
 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 : */
diff --git a/src/term.c b/src/term.c
index b7e3fac..c23b840 100644
--- a/src/term.c
+++ b/src/term.c
@@ -6733,11 +6733,13 @@
 #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 @@
 	if (has_mbyte)
 	    i += (*mb_ptr2len_len)(ta_buf + i, ta_len + len - i) - 1;
     }
+    return len;
 }
diff --git a/src/version.c b/src/version.c
index abc67c0..686b525 100644
--- a/src/version.c
+++ b/src/version.c
@@ -700,6 +700,8 @@
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    653,
+/**/
     652,
 /**/
     651,