To: vim_dev@googlegroups.com Subject: Patch 8.2.0919 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0919 Problem: Merging modifier for modifyOtherKeys is done twice. Solution: Remove the merging done in vgetc(). Files: src/getchar.c, src/ex_getln.c *** ../vim-8.2.0918/src/getchar.c 2020-06-06 22:36:20.464116743 +0200 --- src/getchar.c 2020-06-07 15:45:48.730505560 +0200 *************** *** 1858,1872 **** c = (*mb_ptr2char)(buf); } ! if (!no_reduce_keys) { - // A modifier was not used for a mapping, apply it to ASCII - // keys. Shift would already have been applied. - // Remember the character and mod_mask from before, in some - // cases they are put back in the typeahead buffer. vgetc_mod_mask = mod_mask; vgetc_char = c; - c = merge_modifyOtherKeys(c, &mod_mask); } break; --- 1858,1867 ---- c = (*mb_ptr2char)(buf); } ! if (vgetc_char == 0) { vgetc_mod_mask = mod_mask; vgetc_char = c; } break; *************** *** 2274,2290 **** tp = typebuf.tb_buf + typebuf.tb_off + offset; if (tp[0] == K_SPECIAL && tp[1] == KS_MODIFIER) { int modifier = tp[2]; ! int new_c = merge_modifyOtherKeys(tp[3], &modifier); ! if (new_c != tp[3] && modifier == 0) { char_u new_string[MB_MAXBYTES]; ! int len = mb_char2bytes(new_c, new_string); ! if (put_string_in_typebuf(offset, 4, new_string, len, NULL, 0, 0) == FAIL) return -1; return len; } } --- 2269,2307 ---- tp = typebuf.tb_buf + typebuf.tb_off + offset; if (tp[0] == K_SPECIAL && tp[1] == KS_MODIFIER) { + // A modifier was not used for a mapping, apply it to ASCII keys. + // Shift would already have been applied. int modifier = tp[2]; ! int c = tp[3]; ! int new_c = merge_modifyOtherKeys(c, &modifier); ! if (new_c != c) { char_u new_string[MB_MAXBYTES]; ! int len; ! if (offset == 0) ! { ! // At the start: remember the character and mod_mask before ! // merging, in some cases, e.g. at the hit-return prompt, ! // they are put back in the typeahead buffer. ! vgetc_char = c; ! vgetc_mod_mask = tp[2]; ! } ! len = mb_char2bytes(new_c, new_string); ! if (modifier == 0) ! { ! if (put_string_in_typebuf(offset, 4, new_string, len, NULL, 0, 0) == FAIL) return -1; + } + else + { + tp[2] = modifier; + if (put_string_in_typebuf(offset + 3, 1, new_string, len, + NULL, 0, 0) == FAIL) + return -1; + } return len; } } *************** *** 2559,2565 **** // If no termcode matched, try to include the modifier into the // key. This for when modifyOtherKeys is working. ! if (keylen == 0) keylen = check_simplify_modifier(max_mlen + 1); // When getting a partial match, but the last characters were not --- 2576,2582 ---- // If no termcode matched, try to include the modifier into the // key. This for when modifyOtherKeys is working. ! if (keylen == 0 && !no_reduce_keys) keylen = check_simplify_modifier(max_mlen + 1); // When getting a partial match, but the last characters were not *** ../vim-8.2.0918/src/ex_getln.c 2020-06-06 15:13:38.737950126 +0200 --- src/ex_getln.c 2020-06-07 15:35:34.342352458 +0200 *************** *** 2225,2231 **** --- 2225,2233 ---- ignore_drag_release = TRUE; putcmdline('^', TRUE); + no_reduce_keys = TRUE; // don't merge modifyOtherKeys c = get_literal(); // get next (two) character(s) + no_reduce_keys = FALSE; do_abbr = FALSE; // don't do abbreviation now extra_char = NUL; // may need to remove ^ when composing char was typed *** ../vim-8.2.0918/src/version.c 2020-06-07 14:50:47.271846855 +0200 --- src/version.c 2020-06-07 15:44:53.726767390 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 919, /**/ -- DINGO: You must spank her well and after you have spanked her you may deal with her as you like and then ... spank me. AMAZING: And spank me! STUNNER: And me. LOVELY: And me. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@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 ///