To: vim_dev@googlegroups.com Subject: Patch 8.2.4876 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4876 Problem: MS-Windows: Shift-BS results in strange character in powershell. Solution: Add K_S_BS. (Christian Brabandt, closes #10283, closes #10279) Files: src/edit.c, src/keymap.h, src/term.c, src/testdir/shared.vim, src/testdir/test_edit.vim *** ../vim-8.2.4875/src/edit.c 2022-05-04 17:51:38.374012790 +0100 --- src/edit.c 2022-05-05 20:33:40.615654628 +0100 *************** *** 963,968 **** --- 963,969 ---- 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); *** ../vim-8.2.4875/src/keymap.h 2022-01-31 11:29:47.613464097 +0000 --- src/keymap.h 2022-05-05 20:33:40.615654628 +0100 *************** *** 276,281 **** --- 276,282 ---- , KE_CANCEL = 102 // return from vgetc() , KE_COMMAND = 103 // special key , KE_SCRIPT_COMMAND = 104 // special key + , KE_S_BS = 105 // shift + }; /* *************** *** 299,304 **** --- 300,306 ---- #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) *** ../vim-8.2.4875/src/term.c 2022-05-02 22:53:41.384211031 +0100 --- src/term.c 2022-05-05 20:33:40.615654628 +0100 *************** *** 688,693 **** --- 688,694 ---- {K_K8, "\316\372"}, {K_K9, "\316\376"}, {K_BS, "\316x"}, + {K_S_BS, "\316y"}, # endif # if defined(VMS) || defined(ALL_BUILTIN_TCAPS) *** ../vim-8.2.4875/src/testdir/shared.vim 2022-04-04 15:46:37.602126829 +0100 --- src/testdir/shared.vim 2022-05-05 20:33:40.615654628 +0100 *************** *** 248,254 **** func GetVimCommand(...) if !filereadable('vimcmd') echo 'Cannot read the "vimcmd" file, falling back to ../vim.' ! let lines = ['../vim'] else let lines = readfile('vimcmd') endif --- 248,258 ---- func GetVimCommand(...) if !filereadable('vimcmd') echo 'Cannot read the "vimcmd" file, falling back to ../vim.' ! if !has("win32") ! let lines = ['../vim'] ! else ! let lines = ['..\vim.exe'] ! endif else let lines = readfile('vimcmd') endif *** ../vim-8.2.4875/src/testdir/test_edit.vim 2022-04-08 11:56:09.179436450 +0100 --- src/testdir/test_edit.vim 2022-05-05 20:43:43.447399496 +0100 *************** *** 2148,2152 **** --- 2148,2178 ---- 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\-\") + 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 *** ../vim-8.2.4875/src/version.c 2022-05-05 20:18:12.408138480 +0100 --- src/version.c 2022-05-05 20:36:28.515621385 +0100 *************** *** 748,749 **** --- 748,751 ---- { /* Add new patch number below this line */ + /**/ + 4876, /**/ -- hundred-and-one symptoms of being an internet addict: 105. When someone asks you for your address, you tell them your URL. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///