]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.4876: MS-Windows: Shift-BS results in strange char in powershell v8.2.4876
authorChristian Brabandt <cb@256bit.org>
Thu, 5 May 2022 19:46:47 +0000 (20:46 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 5 May 2022 19:46:47 +0000 (20:46 +0100)
Problem:    MS-Windows: Shift-BS results in strange character in powershell.
Solution:   Add K_S_BS. (Christian Brabandt, closes #10283, closes #10279)

src/edit.c
src/keymap.h
src/term.c
src/testdir/shared.vim
src/testdir/test_edit.vim
src/version.c

index 65b760ba04a62fe0bc5932240bfe48e542d1cca0..40717826bf5076f4c5756901611912732a6b7efc 100644 (file)
@@ -963,6 +963,7 @@ doESCkey:
            break;
 
        case K_BS:      // delete character before the cursor
+       case K_S_BS:
        case Ctrl_H:
            did_backspace = ins_bs(c, BACKSPACE_CHAR, &inserted_space);
            auto_format(FALSE, TRUE);
index 85bf7d0b50dbdef5983369d603afcac730fc030f..e8832d62f62783b73a0ac63d1d3e9c90e672f6b4 100644 (file)
@@ -276,6 +276,7 @@ enum key_extra
     , KE_CANCEL = 102          // return from vgetc()
     , KE_COMMAND = 103         // <Cmd> special key
     , KE_SCRIPT_COMMAND = 104  // <ScriptCmd> special key
+    , KE_S_BS = 105            // shift + <BS>
 };
 
 /*
@@ -299,6 +300,7 @@ enum key_extra
 #define K_C_END                TERMCAP2KEY(KS_EXTRA, KE_C_END)
 #define K_TAB          TERMCAP2KEY(KS_EXTRA, KE_TAB)
 #define K_S_TAB                TERMCAP2KEY('k', 'B')
+#define K_S_BS         TERMCAP2KEY(KS_EXTRA, KE_S_BS)
 
 // extra set of function keys F1-F4, for vt100 compatible xterm
 #define K_XF1          TERMCAP2KEY(KS_EXTRA, KE_XF1)
index bf5943d53b582c83d25002b2955438178783df65..827772f50f4e45d7a4069b1a98afedc26916b695 100644 (file)
@@ -688,6 +688,7 @@ static struct builtin_term builtin_termcaps[] =
     {K_K8,             "\316\372"},
     {K_K9,             "\316\376"},
     {K_BS,             "\316x"},
+    {K_S_BS,            "\316y"},
 # endif
 
 # if defined(VMS) || defined(ALL_BUILTIN_TCAPS)
index 8e3dfc9c3a1d623c29b340b4600af6f22ac9ec93..e442a59ec7e2a1b2914f93af5c61671624d6aea1 100644 (file)
@@ -248,7 +248,11 @@ let g:valgrind_cnt = 1
 func GetVimCommand(...)
   if !filereadable('vimcmd')
     echo 'Cannot read the "vimcmd" file, falling back to ../vim.'
-    let lines = ['../vim']
+    if !has("win32")
+      let lines = ['../vim']
+    else
+      let lines = ['..\vim.exe']
+    endif
   else
     let lines = readfile('vimcmd')
   endif
index 9ed899d8381c69b7b6af0694d5156bda8068381b..dddffa389167c2daea750481466a9e0a2288cd68 100644 (file)
@@ -2148,5 +2148,31 @@ func Test_edit_overlong_file_name()
   bwipe!
 endfunc
 
+func Test_edit_shift_bs()
+  CheckMSWindows
+
+  " FIXME: this works interactively, but the test fails
+  throw 'Skipped: Shift-Backspace Test not working correctly :('
+
+  " Need to run this in Win32 Terminal, do not use CheckRunVimInTerminal
+  if !has("terminal")
+    return
+  endif
+
+  " Shift Backspace should work like Backspace in insert mode
+  let lines =<< trim END
+    call setline(1, ['abc'])
+  END
+  call writefile(lines, 'Xtest_edit_shift_bs')
+
+  let buf = RunVimInTerminal('-S Xtest_edit_shift_bs', #{rows: 3})
+  call term_sendkeys(buf, "A\<S-BS>-\<esc>")
+  call TermWait(buf, 50)
+  call assert_equal('ab-', term_getline(buf, 1))
+
+  " clean up
+  call StopVimInTerminal(buf)
+  call delete('Xtest_edit_shift_bs')
+endfunc
 
 " vim: shiftwidth=2 sts=2 expandtab
index 59df1adaf03a96e20d424234b28de0471c788d09..535d4eb09c04800feabd819917089ac193e8c3ad 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4876,
 /**/
     4875,
 /**/