To: vim_dev@googlegroups.com Subject: Patch 9.0.0575 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0575 Problem: The getchar() function behaves strangely with bracketed paste. Solution: Do not handle paste-start in getchar(). (issue #11172) Files: src/getchar.c *** ../vim-9.0.0574/src/getchar.c 2022-09-05 16:53:17.115566769 +0100 --- src/getchar.c 2022-09-24 15:35:14.461319500 +0100 *************** *** 1720,1725 **** --- 1720,1727 ---- { int did_inc = FALSE; + // No mapping after modifier has been read, using an input method + // and when a popup window has disabled mapping. if (mod_mask #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK) || im_is_preediting() *************** *** 1729,1738 **** #endif ) { - // no mapping after modifier has been read ++no_mapping; ++allow_keys; ! did_inc = TRUE; // mod_mask may change value } c = vgetorpeek(TRUE); if (did_inc) --- 1731,1740 ---- #endif ) { ++no_mapping; ++allow_keys; ! // mod_mask value may change, remember we did the increment ! did_inc = TRUE; } c = vgetorpeek(TRUE); if (did_inc) *************** *** 1988,1996 **** /* * Like safe_vgetc(), but loop to handle K_IGNORE. * Also ignore scrollbar events. */ ! int ! plain_vgetc(void) { int c; --- 1990,1999 ---- /* * Like safe_vgetc(), but loop to handle K_IGNORE. * Also ignore scrollbar events. + * Does not handle bracketed paste - do not use the result for commands. */ ! static int ! plain_vgetc_nopaste(void) { int c; *************** *** 1999,2004 **** --- 2002,2018 ---- while (c == K_IGNORE || c == K_VER_SCROLLBAR || c == K_HOR_SCROLLBAR || c == K_MOUSEMOVE); + return c; + } + + /* + * Like safe_vgetc(), but loop to handle K_IGNORE. + * Also ignore scrollbar events. + */ + int + plain_vgetc(void) + { + int c = plain_vgetc_nopaste(); if (c == K_PS) // Only handle the first pasted character. Drop the rest, since we *************** *** 2107,2113 **** { if (argvars[0].v_type == VAR_UNKNOWN) // getchar(): blocking wait. ! n = plain_vgetc(); else if (tv_get_bool_chk(&argvars[0], &error)) // getchar(1): only check if char avail n = vpeekc_any(); --- 2121,2127 ---- { if (argvars[0].v_type == VAR_UNKNOWN) // getchar(): blocking wait. ! n = plain_vgetc_nopaste(); else if (tv_get_bool_chk(&argvars[0], &error)) // getchar(1): only check if char avail n = vpeekc_any(); *** ../vim-9.0.0574/src/version.c 2022-09-24 14:49:03.221724998 +0100 --- src/version.c 2022-09-24 15:36:01.513119401 +0100 *************** *** 701,702 **** --- 701,704 ---- { /* Add new patch number below this line */ + /**/ + 575, /**/ -- You're as much use as a condom machine at the Vatican. -- Rimmer to Holly in Red Dwarf 'Queeg' /// 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 ///