Patch 8.2.2275

12 views
Skip to first unread message

Bram Moolenaar

unread,
Jan 2, 2021, 10:18:03 AM1/2/21
to vim...@googlegroups.com

Patch 8.2.2275
Problem: CTRL-C not recognized in Mintty.
Solution: Recognize the modifyOtherKeys code ending in "u". (Christian
Brabandt, closes #7575)
Files: src/ui.c


*** ../vim-8.2.2274/src/ui.c 2020-09-03 19:25:08.026072635 +0200
--- src/ui.c 2021-01-02 16:13:29.689219240 +0100
***************
*** 1014,1024 ****
{
/*
* If a CTRL-C was typed, remove it from the buffer and set
! * got_int. Also recognize CTRL-C with modifyOtherKeys set.
*/
if (ctrl_c_interrupts && (inbuf[inbufcount] == 3
|| (len >= 9 && STRNCMP(inbuf + inbufcount,
! "\033[27;5;99~", 10) == 0)))
{
// remove everything typed before the CTRL-C
mch_memmove(inbuf, inbuf + inbufcount, (size_t)(len + 1));
--- 1014,1027 ----
{
/*
* If a CTRL-C was typed, remove it from the buffer and set
! * got_int. Also recognize CTRL-C with modifyOtherKeys set, in two
! * forms.
*/
if (ctrl_c_interrupts && (inbuf[inbufcount] == 3
|| (len >= 9 && STRNCMP(inbuf + inbufcount,
! "\033[27;5;99~", 10) == 0)
! || (len >= 7 && STRNCMP(inbuf + inbufcount,
! "\033[99;5u", 7) == 0)))
{
// remove everything typed before the CTRL-C
mch_memmove(inbuf, inbuf + inbufcount, (size_t)(len + 1));
*** ../vim-8.2.2274/src/version.c 2021-01-02 16:05:24.522986581 +0100
--- src/version.c 2021-01-02 16:15:56.908688628 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2275,
/**/

--
From "know your smileys":
:-H Is missing teeth

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Christian Brabandt

unread,
Jan 2, 2021, 1:32:49 PM1/2/21
to vim...@googlegroups.com

On Sa, 02 Jan 2021, Bram Moolenaar wrote:

> Patch 8.2.2275
> Problem: CTRL-C not recognized in Mintty.
> Solution: Recognize the modifyOtherKeys code ending in "u". (Christian
> Brabandt, closes #7575)
> Files: src/ui.c

Thanks for including this. However I noticed one thing in the current
code:

https://github.com/vim/vim/blob/02faa944c69ea22a7a5338135b686dac2c946ca1/src/ui.c#L1015-L1024

#v+
1015 /*
1016 * If a CTRL-C was typed, remove it from the buffer and set
1017 * got_int. Also recognize CTRL-C with modifyOtherKeys set, in two
1018 * forms.
1019 */
1020 if (ctrl_c_interrupts && (inbuf[inbufcount] == 3
1021 || (len >= 9 && STRNCMP(inbuf + inbufcount,
1022 "\033[27;5;99~", 10) == 0)
1023 || (len >= 7 && STRNCMP(inbuf + inbufcount,
1024 "\033[99;5u", 7) == 0)))
#v-

I think the `len >= 9` on line 1021 should be `len >= 10`, because this
is what we use in the STRNCMP

Best,
Christian
--
Es ist nur verständlich, daß die Wölfe die Abrüstung der Schafe
verlangen, denn deren Wolle setzt dem Biß einen gewissen Widerstand
entgegen.
-- Gilbert Keith Chesterton

Bram Moolenaar

unread,
Jan 2, 2021, 2:15:06 PM1/2/21
to vim...@googlegroups.com, Christian Brabandt

Christian wrote:

> On Sa, 02 Jan 2021, Bram Moolenaar wrote:
>
> > Patch 8.2.2275
> > Problem: CTRL-C not recognized in Mintty.
> > Solution: Recognize the modifyOtherKeys code ending in "u". (Christian
> > Brabandt, closes #7575)
> > Files: src/ui.c
>
> Thanks for including this. However I noticed one thing in the current
> code:
>
> https://github.com/vim/vim/blob/02faa944c69ea22a7a5338135b686dac2c946ca1/src/ui.c#L1015-L1024
>
> #v+
> 1015 /*
> 1016 * If a CTRL-C was typed, remove it from the buffer and set
> 1017 * got_int. Also recognize CTRL-C with modifyOtherKeys set, in two
> 1018 * forms.
> 1019 */
> 1020 if (ctrl_c_interrupts && (inbuf[inbufcount] == 3
> 1021 || (len >= 9 && STRNCMP(inbuf + inbufcount,
> 1022 "\033[27;5;99~", 10) == 0)
> 1023 || (len >= 7 && STRNCMP(inbuf + inbufcount,
> 1024 "\033[99;5u", 7) == 0)))
> #v-
>
> I think the `len >= 9` on line 1021 should be `len >= 10`, because this
> is what we use in the STRNCMP

Yeah, it still works, but it's more logical to use the same number in
both places.

--
Where do you want to crash today?
Reply all
Reply to author
Forward
0 new messages