Re: [vim/vim] Trigger ModeChanged on all minor mode changes (#8999)
> When `Ctrl-C` is used to exit insert mode to normal mode, `got_int` is > set which means that the autocmd is not received. But I guess this is > intentional? I suppose so. If someone is in the habit of using CTRL-C to exit Insert mode some side effects are to be expected. At least let's keep it this way until someone can provide a good reason to do otherwise. -- $ echo pizza > /dev/oven /// Bram Moolenaar -- b...@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/// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/20211019214242.4CE5BC80053%40moolenaar.net.
Patch 8.2.3543
Patch 8.2.3543 Problem:Swapname has double slash when 'directory' ends in double slash. (Shane Smith) Solution: Remove the superfluous slash. (closes #8876) Files: src/memline.c, src/testdir/test_swap.vim *** ../vim-8.2.3542/src/memline.c 2021-10-14 21:27:50.646253845 +0100 --- src/memline.c 2021-10-19 22:10:52.031440183 +0100 *** *** 2064,2070 /* * Need _very_ long file names. * Append the full path to name with path separators made into percent ! * signs, to dir. An unnamed buffer is handled as "" (/"") */ char_u * make_percent_swname(char_u *dir, char_u *name) --- 2064,2072 /* * Need _very_ long file names. * Append the full path to name with path separators made into percent ! * signs, to "dir". An unnamed buffer is handled as "" (/"") ! * The last character in "dir" must be an extra slash or backslash, it is ! * removed. */ char_u * make_percent_swname(char_u *dir, char_u *name) *** *** 2081,2086 --- 2083,2090 for (d = s; *d != NUL; MB_PTR_ADV(d)) if (vim_ispathsep(*d)) *d = '%'; + + dir[STRLEN(dir) - 1] = NUL; // remove one trailing slash d = concat_fnames(dir, s, TRUE); vim_free(s); } *** ../vim-8.2.3542/src/testdir/test_swap.vim 2021-07-10 16:59:44.679330992 +0100 --- src/testdir/test_swap.vim 2021-10-19 22:10:06.606882181 +0100 *** *** 410,416 " Check that this also works when 'directory' ends with '//' edit Xtestlink ! call assert_match('Xtestfile\.swp$', s:swapname()) bwipe! set dir& --- 410,416 " Check that this also works when 'directory' ends with '//' edit Xtestlink ! call assert_match('Xswapdir[/\\]%.*testdir%Xtestfile\.swp$', s:swapname()) bwipe! set dir& *** ../vim-8.2.3542/src/version.c 2021-10-19 20:48:48.448911779 +0100 --- src/version.c 2021-10-19 22:10:22.347073971 +0100 *** *** 759,760 --- 759,762 { /* Add new patch number below this line */ + /**/ + 3543, /**/ -- panic("Fod fight!"); -- In the kernel source aha1542.c, after detecting a bad segment list /// Bram Moolenaar -- b...@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/// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/20211019211254.E8C08C80053%40moolenaar.net.
Patch 8.2.3542
Patch 8.2.3542 Problem:Too many comments are old style. Solution: Change comments to // style. (closes #9021) Files: src/buffer.c *** ../vim-8.2.3541/src/buffer.c2021-10-16 21:14:07.495196461 +0100 --- src/buffer.c2021-10-19 20:46:24.163108515 +0100 *** *** 94,104 int retval = OK; linenr_T line_count; ! /* ! * Read from the buffer which the text is already filled in and append at ! * the end. This makes it possible to retry when 'fileformat' or ! * 'fileencoding' was guessed wrong. ! */ line_count = curbuf->b_ml.ml_line_count; retval = readfile( read_stdin ? NULL : curbuf->b_ffname, --- 94,102 int retval = OK; linenr_T line_count; ! // Read from the buffer which the text is already filled in and append at ! // the end. This makes it possible to retry when 'fileformat' or ! // 'fileencoding' was guessed wrong. line_count = curbuf->b_ml.ml_line_count; retval = readfile( read_stdin ? NULL : curbuf->b_ffname, *** *** 178,206 #endif int read_fifo = FALSE; ! /* ! * The 'readonly' flag is only set when BF_NEVERLOADED is being reset. ! * When re-entering the same buffer, it should not change, because the ! * user may have reset the flag by hand. ! */ if (readonlymode && curbuf->b_ffname != NULL && (curbuf->b_flags & BF_NEVERLOADED)) curbuf->b_p_ro = TRUE; if (ml_open(curbuf) == FAIL) { ! /* !* There MUST be a memfile, otherwise we can't do anything !* If we can't create one for the current buffer, take another buffer !*/ close_buffer(NULL, curbuf, 0, FALSE, FALSE); FOR_ALL_BUFFERS(curbuf) if (curbuf->b_ml.ml_mfp != NULL) break; ! /* !* If there is no memfile at all, exit. !* This is OK, since there are no changes to lose. !*/ if (curbuf == NULL) { emsg(_("E82: Cannot allocate any buffer, exiting...")); --- 176,198 #endif int read_fifo = FALSE; ! // The 'readonly' flag is only set when BF_NEVERLOADED is being reset. ! // When re-entering the same buffer, it should not change, because the ! // user may have reset the flag by hand. if (readonlymode && curbuf->b_ffname != NULL && (curbuf->b_flags & BF_NEVERLOADED)) curbuf->b_p_ro = TRUE; if (ml_open(curbuf) == FAIL) { ! // There MUST be a memfile, otherwise we can't do anything ! // If we can't create one for the current buffer, take another buffer close_buffer(NULL, curbuf, 0, FALSE, FALSE); FOR_ALL_BUFFERS(curbuf) if (curbuf->b_ml.ml_mfp != NULL) break; ! // If there is no memfile at all, exit. ! // This is OK, since there are no changes to lose. if (curbuf == NULL) { emsg(_("E82: Cannot allocate any buffer, exiting...")); *** *** 281,292 { int save_bin = curbuf->b_p_bin; ! /* !* First read the text in binary mode into the buffer. !* Then read from that same buffer and append at the end. This makes !* it possible to retry when 'fileformat' or 'fileencoding' was !* guessed wrong. !*/ curbuf->b_p_bin = TRUE; retval = readfile(NULL, NULL, (linenr_T)0, (linenr_T)0, (linenr_T)MAXLNUM, NULL, --- 273,282 { int save_bin = curbuf->b_p_bin; ! // First read the text in binary mode into the buffer. ! // Then read from that same buffer and append at the end. This makes ! // it possible to retry when 'fileformat' or 'fileencoding' was ! // guessed wrong. curbuf->b_p_bin = TRUE; retval = readfile(NULL, NULL, (linenr_T)0, (linenr_T)0, (linenr_T)MAXLNUM, NULL, *** *** 305,315 #endif } ! /* ! * Set/reset the Changed flag first, autocmds may change the buffer. ! * Apply the automatic commands, before processing the modelines. ! * So the modelines have priority over autocommands. ! */ // When reading stdin, the buffer contents always needs writing, so set // the changed flag. Unless in readonly mode: "ls | gview -". // When interrupted and 'cpoptions' contains 'i' set changed flag. --- 295,304 #endif } ! // Set/reset the Changed flag first, autocmds may change the buffer. ! // Apply the automatic commands, before processing the modelines. ! // So the modelines have priority over autocommands. ! // // When reading stdin, the buffer contents always needs writing, so set // the changed flag. Unless in readonly mode
Patch 8.2.3541
Patch 8.2.3541 Problem:Compiler warning for unused variable in tiny version. Solution: Add #ifdef. (John Marriott) Files: src/highlight.c *** ../vim-8.2.3540/src/highlight.c 2021-10-19 13:44:48.721313059 +0100 --- src/highlight.c 2021-10-19 20:22:53.940900159 +0100 *** *** 1108,1114 --- 1108,1116 int *do_colors UNUSED, int init) { + # if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) long i; + # endif char_u**namep; int did_change = FALSE; *** *** 1175,1181 --- 1177,1185 int *do_colors UNUSED, int init) { + # if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) int i; + # endif char_u**namep; int did_change = FALSE; *** ../vim-8.2.3540/src/version.c 2021-10-19 20:08:41.455362440 +0100 --- src/version.c 2021-10-19 20:21:17.439350919 +0100 *** *** 759,760 --- 759,762 { /* Add new patch number below this line */ + /**/ + 3541, /**/ -- hundred-and-one symptoms of being an internet addict: 202. You're amazed to find out Spam is a food. /// Bram Moolenaar -- b...@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/// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/20211019192459.A8387C80054%40moolenaar.net.
Re: Patch 8.2.3536
John Marriott wrote: > On 19-Oct-2021 08:14, Bram Moolenaar wrote: > > Patch 8.2.3536 > > Problem:The do_highlight() function is way too long. > > Solution: Split it into several functions. (Yegappan Lakshmanan, > > closes #9011) > > Files: src/highlight.c > > > > > > > After this patch mingw64 (gcc 11.2) throws these warnings when *not* > compiled as a GUI: > > gcc -c -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 > -DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -D__USE_MINGW_ANSI_STDIO > -pipe -march=native -Wall -O3 -fomit-frame-pointer -freg-struct-return > -fpie -fPIE highlight.c -o objnative/highlight.o > highlight.c: In function 'highlight_set_guifg': > highlight.c::17: warning: unused variable 'i' [-Wunused-variable] > | long i; > | ^ > highlight.c: In function 'highlight_set_guibg': > highlight.c:1178:17: warning: unused variable 'i' [-Wunused-variable] > 1178 | int i; > | ^ > > > Attached is a patch that tries to fix it, but I'm not sure that it's > correct. A slightly different #ifdef is needed, like where "i" is used. Thanks for pointing out the location. -- hundred-and-one symptoms of being an internet addict: 201. When somebody asks you where you are, you tell them in which chat room. /// Bram Moolenaar -- b...@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/// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/20211019192459.A5BD3C80053%40moolenaar.net.
Patch 8.2.3540
Patch 8.2.3540 Problem:The mark '] is wrong after put with a count. (Naohiro Ono) Solution: Use the right line number. (closes #8956) Files: src/register.c, src/testdir/test_put.vim *** ../vim-8.2.3539/src/register.c 2021-10-10 12:35:13.331259343 +0100 --- src/register.c 2021-10-19 19:52:55.489760512 +0100 *** *** 2183,2189 curbuf->b_op_start.lnum, nr_lines); // put '] mark at last inserted character ! curbuf->b_op_end.lnum = lnum; // correct length for change in indent col = (colnr_T)STRLEN(y_array[y_size - 1]) - lendiff; if (col > 1) --- 2183,2189 curbuf->b_op_start.lnum, nr_lines); // put '] mark at last inserted character ! curbuf->b_op_end.lnum = new_lnum; // correct length for change in indent col = (colnr_T)STRLEN(y_array[y_size - 1]) - lendiff; if (col > 1) *** ../vim-8.2.3539/src/testdir/test_put.vim2021-10-11 20:26:43.977511961 +0100 --- src/testdir/test_put.vim2021-10-19 19:51:56.949058769 +0100 *** *** 136,141 --- 136,153 bwipe! endfunc + func Test_p_with_count_leaves_mark_at_end() + new + call setline(1, '<>') + call setreg('@', "start\nend", 'c') + normal 1G3|3p + call assert_equal([0, 1, 4, 0], getpos(".")) + call assert_equal(['<--start', 'endstart', 'endstart', 'end-->'], getline(1, '$')) + call assert_equal([0, 4, 3, 0], getpos("']")) + + bwipe! + endfunc + func Test_very_large_count() " FIXME: should actually check if sizeof(int) == sizeof(long) CheckNotMSWindows *** ../vim-8.2.3539/src/version.c 2021-10-19 14:21:59.203301227 +0100 --- src/version.c 2021-10-19 19:45:43.167400616 +0100 *** *** 759,760 --- 759,762 { /* Add new patch number below this line */ + /**/ + 3540, /**/ -- hundred-and-one symptoms of being an internet addict: 200. You really believe in the concept of a "paperless" office. /// Bram Moolenaar -- b...@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/// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/20211019190913.15E5DC80053%40moolenaar.net.
Re: Patch 8.2.3536
On 19-Oct-2021 08:14, Bram Moolenaar wrote: Patch 8.2.3536 Problem:The do_highlight() function is way too long. Solution: Split it into several functions. (Yegappan Lakshmanan, closes #9011) Files: src/highlight.c After this patch mingw64 (gcc 11.2) throws these warnings when *not* compiled as a GUI: gcc -c -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 -DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -D__USE_MINGW_ANSI_STDIO -pipe -march=native -Wall -O3 -fomit-frame-pointer -freg-struct-return -fpie -fPIE highlight.c -o objnative/highlight.o highlight.c: In function 'highlight_set_guifg': highlight.c::17: warning: unused variable 'i' [-Wunused-variable] | long i; | ^ highlight.c: In function 'highlight_set_guibg': highlight.c:1178:17: warning: unused variable 'i' [-Wunused-variable] 1178 | int i; | ^ Attached is a patch that tries to fix it, but I'm not sure that it's correct. Cheers John -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/6acebb2e-0d71-f006-ef80-ba00c4ead520%40internode.on.net. 1110a > # if defined(FEAT_GUI) a1113 > #endif 1177a1180 > # if defined(FEAT_GUI) 1178a1182 > #endif
Patch 8.2.3539
Patch 8.2.3539 Problem:GTK3: with 'rightleft' set scrollbar may move unintentionally. Solution: Ignore events while moving the scrollbar thumb. (closes #8958) Files: src/gui_gtk.c *** ../vim-8.2.3538/src/gui_gtk.c 2021-06-05 15:06:36.961265823 +0100 --- src/gui_gtk.c 2021-10-19 14:10:02.425210510 +0100 *** *** 1011,1016 --- 1011,1019 { GtkAdjustment *adjustment; + // ignore events triggered by moving the thumb (happens in GTK 3) + ++hold_gui_events; + adjustment = gtk_range_get_adjustment(GTK_RANGE(sb->id)); gtk_adjustment_set_lower(adjustment, 0.0); *** *** 1023,1028 --- 1026,1033 g_signal_handler_block(G_OBJECT(adjustment), (gulong)sb->handler_id); + --hold_gui_events; + #if !GTK_CHECK_VERSION(3,18,0) gtk_adjustment_changed(adjustment); #endif *** ../vim-8.2.3538/src/version.c 2021-10-19 13:44:48.721313059 +0100 --- src/version.c 2021-10-19 14:21:13.986644033 +0100 *** *** 759,760 --- 759,762 { /* Add new patch number below this line */ + /**/ + 3539, /**/ -- hundred-and-one symptoms of being an internet addict: 196. Your computer costs more than your car. /// Bram Moolenaar -- b...@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/// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/20211019132234.8D850C80053%40moolenaar.net.
Patch 8.2.3538
Patch 8.2.3538 Problem:Else-if indenting is confusing. Solution: Add curly brackets. (Yegappan Lakshmanan, closes #9017) Files: src/highlight.c *** ../vim-8.2.3537/src/highlight.c 2021-10-18 22:13:53.468428157 +0100 --- src/highlight.c 2021-10-19 13:42:56.339353529 +0100 *** *** 2819,2828 attr = HL_TABLE()[id - 1].sg_gui; else #endif !if (modec == 'c') ! attr = HL_TABLE()[id - 1].sg_cterm; ! else ! attr = HL_TABLE()[id - 1].sg_term; if (attr & flag) return (char_u *)"1"; --- 2819,2830 attr = HL_TABLE()[id - 1].sg_gui; else #endif ! { ! if (modec == 'c') ! attr = HL_TABLE()[id - 1].sg_cterm; ! else ! attr = HL_TABLE()[id - 1].sg_term; ! } if (attr & flag) return (char_u *)"1"; *** ../vim-8.2.3537/src/version.c 2021-10-19 11:15:36.118656545 +0100 --- src/version.c 2021-10-19 13:44:17.552774743 +0100 *** *** 759,760 --- 759,762 { /* Add new patch number below this line */ + /**/ + 3538, /**/ -- Some of the well known MS-Windows errors: ETIME Wrong time, wait a little while ECRASH Try again... EDETECT Unable to detect errors EOVER You lost! Play another game? ENOCLUE Eh, what did you want? /// Bram Moolenaar -- b...@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/// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/20211019124523.7A1ABC80055%40moolenaar.net.
Patch 8.2.3537
Patch 8.2.3537 Problem:mode() does not return the right value in 'operatorfunc'. Solution: Reset finish_op while calling 'operatorfunc'. Files: src/ops.c, src/testdir/test_functions.vim *** ../vim-8.2.3536/src/ops.c 2021-09-14 17:55:47.864129826 +0100 --- src/ops.c 2021-10-19 11:14:29.109680066 +0100 *** *** 3314,3319 --- 3314,3320 #ifdef FEAT_EVAL typval_T argv[2]; int save_virtual_op = virtual_op; + int save_finish_op = finish_op; pos_T orig_start = curbuf->b_op_start; pos_T orig_end = curbuf->b_op_end; *** *** 3341,3349 --- 3342,3354 // function. virtual_op = MAYBE; + // Reset finish_op so that mode() returns the right value. + finish_op = FALSE; + (void)call_func_noret(p_opfunc, 1, argv); virtual_op = save_virtual_op; + finish_op = save_finish_op; if (cmdmod.cmod_flags & CMOD_LOCKMARKS) { curbuf->b_op_start = orig_start; *** ../vim-8.2.3536/src/testdir/test_functions.vim 2021-10-16 13:00:10.940165406 +0100 --- src/testdir/test_functions.vim 2021-10-19 11:13:05.908465385 +0100 *** *** 912,917 --- 912,931 call assert_equal('c-ce', g:current_modes) " How to test Ex mode? + " Test mode in operatorfunc (it used to be Operator-pending). + set operatorfunc=OperatorFunc + function OperatorFunc(_) + call Save_mode() + endfunction + execute "normal! g@l\" + call assert_equal('n-n', g:current_modes) + execute "normal! i\g@l\" + call assert_equal('n-niI', g:current_modes) + execute "normal! R\g@l\" + call assert_equal('n-niR', g:current_modes) + execute "normal! gR\g@l\" + call assert_equal('n-niV', g:current_modes) + if has('terminal') term call feedkeys("\N", 'xt') *** *** 924,929 --- 938,945 iunmap xunmap set complete& + set operatorfunc& + delfunction OperatorFunc endfunc " Test for append() *** ../vim-8.2.3536/src/version.c 2021-10-18 22:13:53.468428157 +0100 --- src/version.c 2021-10-19 11:14:58.870113933 +0100 *** *** 759,760 --- 759,762 { /* Add new patch number below this line */ + /**/ + 3537, /**/ -- % cat /usr/include/sys/errno.h #define EPERM 1 /* Operation not permitted */ #define ENOENT 2 /* No such file or directory */ #define ESRCH 3 /* No such process */ [...] #define EMACS 666 /* Too many macros */ % /// Bram Moolenaar -- b...@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/// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/20211019101632.7F852C80053%40moolenaar.net.