Patch 8.2.4555
Patch 8.2.4555 Problem:getmousepos() returns the wrong column. (Ernie Rael) Solution: Limit to the text size, not the number of bytes. Files: src/mouse.c, src/testdir/test_functions.vim *** ../vim-8.2.4554/src/mouse.c 2021-11-29 17:37:38.063265208 + --- src/mouse.c 2022-03-13 11:54:16.919648342 + *** *** 3099,3115 col -= left_off; if (row >= 0 && row < wp->w_height && col >= 0 && col < wp->w_width) { - char_u *p; int count; mouse_comp_pos(wp, &row, &col, &line, NULL); ! // limit to text length plus one ! p = ml_get_buf(wp->w_buffer, line, FALSE); ! count = (int)STRLEN(p); if (col > count) col = count; - column = col + 1; } } --- 3099,3112 col -= left_off; if (row >= 0 && row < wp->w_height && col >= 0 && col < wp->w_width) { int count; mouse_comp_pos(wp, &row, &col, &line, NULL); ! // limit to text size plus one ! count = linetabsize(ml_get_buf(wp->w_buffer, line, FALSE)); if (col > count) col = count; column = col + 1; } } *** ../vim-8.2.4554/src/testdir/test_functions.vim 2022-02-20 19:05:06.359955597 + --- src/testdir/test_functions.vim 2022-03-13 12:02:00.249657121 + *** *** 2750,2755 --- 2750,2781 call assert_equal([0, 0, 0, 0, 0], getcurpos(1999)) endfunc + func Test_getmousepos() + enew! + call setline(1, "\t\t\t1234") + call test_setmouse(1, 25) + call assert_equal(#{ + \ screenrow: 1, + \ screencol: 25, + \ winid: win_getid(), + \ winrow: 1, + \ wincol: 25, + \ line: 1, + \ column: 25, + \ }, getmousepos()) + call test_setmouse(1, 50) + call assert_equal(#{ + \ screenrow: 1, + \ screencol: 50, + \ winid: win_getid(), + \ winrow: 1, + \ wincol: 50, + \ line: 1, + \ column: 29, + \ }, getmousepos()) + bwipe! + endfunc + " Test for glob() func Test_glob() call assert_equal('', glob(test_null_string())) *** ../vim-8.2.4554/src/version.c 2022-03-12 21:28:18.532257720 + --- src/version.c 2022-03-13 12:00:39.170223010 + *** *** 752,753 --- 752,755 { /* Add new patch number below this line */ + /**/ + 4555, /**/ -- hundred-and-one symptoms of being an internet addict: 245. You use Real Audio to listen to a radio station from a distant city rather than turn on your stereo system. /// 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/20220313120830.97B711C79E6%40moolenaar.net.
Re: convert column position to cursor column number
Ernie Rael wrote: > The following fails when I click on a line that has tabs preceding the > click position > > def Click() > var d = getmousepos() > win_gotoid(d['winid']) > cursor(d['line'], d['column']) > enddef > > I can not find a function to convert as needed; and/or I'm missing an > option on some function. > > Any help appreciated, That actually looks like a bug. The column is limited to the number of bytes in the line, should be the number of screen columns that the text has. -- hundred-and-one symptoms of being an internet addict: 243. You unsuccessfully try to download a pizza from www.dominos.com. /// 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/20220313120830.930511C79E5%40moolenaar.net.
Patch 8.2.4556
Patch 8.2.4556 Problem:Test fails without the +job or +channel feature. (Dominique Pellé) Solution: Adjust #ifdefs. Pass on skip flag. (closes #9942) Files: src/eval.c, src/vim9compile.c *** ../vim-8.2.4555/src/eval.c 2022-03-10 20:01:47.119865247 + --- src/eval.c 2022-03-13 12:58:11.313638672 + *** *** 3515,3529 return OK; } break; - #ifdef FEAT_JOB_CHANNEL case 8: if (STRNCMP(s, "null_job", 8) == 0) { rettv->v_type = VAR_JOB; rettv->vval.v_job = NULL; return OK; } break; - #endif case 9: if (STRNCMP(s, "null_", 5) != 0) break; --- 3515,3532 return OK; } break; case 8: if (STRNCMP(s, "null_job", 8) == 0) { + #ifdef FEAT_JOB_CHANNEL rettv->v_type = VAR_JOB; rettv->vval.v_job = NULL; + #else + rettv->v_type = VAR_SPECIAL; + rettv->vval.v_number = VVAL_NULL; + #endif return OK; } break; case 9: if (STRNCMP(s, "null_", 5) != 0) break; *** *** 3554,3567 } break; case 12: - #ifdef FEAT_JOB_CHANNEL if (STRNCMP(s, "null_channel", 12) == 0) { rettv->v_type = VAR_CHANNEL; rettv->vval.v_channel = NULL; return OK; } - #endif if (STRNCMP(s, "null_partial", 12) == 0) { rettv->v_type = VAR_PARTIAL; --- 3557,3573 } break; case 12: if (STRNCMP(s, "null_channel", 12) == 0) { + #ifdef FEAT_JOB_CHANNEL rettv->v_type = VAR_CHANNEL; rettv->vval.v_channel = NULL; + #else + rettv->v_type = VAR_SPECIAL; + rettv->vval.v_number = VVAL_NULL; + #endif return OK; } if (STRNCMP(s, "null_partial", 12) == 0) { rettv->v_type = VAR_PARTIAL; *** ../vim-8.2.4555/src/vim9compile.c 2022-03-10 19:23:24.329580643 + --- src/vim9compile.c 2022-03-13 13:03:51.544930886 + *** *** 762,767 --- 762,768 { eap->getline = exarg_getline; eap->cookie = cctx; + eap->skip = cctx->ctx_skip == SKIP_YES; } /* *** *** 855,861 semsg(_(e_namespace_not_supported_str), name_start); return NULL; } ! if (check_defined(name_start, name_end - name_start, cctx, NULL, FALSE) == FAIL) return NULL; if (!ASCII_ISUPPER(is_global ? name_start[2] : name_start[0])) --- 856,863 semsg(_(e_namespace_not_supported_str), name_start); return NULL; } ! if (cctx->ctx_skip != SKIP_YES ! && check_defined(name_start, name_end - name_start, cctx, NULL, FALSE) == FAIL) return NULL; if (!ASCII_ISUPPER(is_global ? name_start[2] : name_start[0])) *** ../vim-8.2.4555/src/version.c 2022-03-13 12:06:02.076218096 + --- src/version.c 2022-03-13 12:58:56.881547182 + *** *** 752,753 --- 752,755 { /* Add new patch number below this line */ + /**/ + 4556, /**/ -- Hear about the guy who played a blank tape at full blast? The mime next door went nuts. /// 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/20220313131308.DFBCD1C79E4%40moolenaar.net.
Patch 8.2.4557
Patch 8.2.4557 Problem:Confusing comment about 'cursorlineopt'. Solution: Adjust comment. (closes #9939) Add parenthesis around logical OR. Files: src/drawline.c *** ../vim-8.2.4556/src/drawline.c 2022-03-06 20:46:55.700626925 + --- src/drawline.c 2022-03-13 13:37:39.506446059 + *** *** 1182,1189 #ifdef FEAT_SYN_HL // When 'cursorline' is set highlight the line number of // the current line differently. ! // When 'cursorlineopt' has "screenline" only highlight ! // the line number itself. // TODO: Can we use CursorLine instead of CursorLineNr // when CursorLineNr isn't set? if (wp->w_p_cul --- 1182,1189 #ifdef FEAT_SYN_HL // When 'cursorline' is set highlight the line number of // the current line differently. ! // When 'cursorlineopt' does not have "line" only ! // highlight the line number itself. // TODO: Can we use CursorLine instead of CursorLineNr // when CursorLineNr isn't set? if (wp->w_p_cul *** *** 1191,1197 && (wp->w_p_culopt_flags & CULOPT_NBR) && (row == startrow + filler_lines || (row > startrow + filler_lines ! && wp->w_p_culopt_flags & CULOPT_LINE))) char_attr = hl_combine_attr(wcr_attr, HL_ATTR(HLF_CLN)); #endif if (wp->w_p_rnu && lnum < wp->w_cursor.lnum --- 1191,1197 && (wp->w_p_culopt_flags & CULOPT_NBR) && (row == startrow + filler_lines || (row > startrow + filler_lines !&& (wp->w_p_culopt_flags & CULOPT_LINE char_attr = hl_combine_attr(wcr_attr, HL_ATTR(HLF_CLN)); #endif if (wp->w_p_rnu && lnum < wp->w_cursor.lnum *** ../vim-8.2.4556/src/version.c 2022-03-13 13:12:23.767131845 + --- src/version.c 2022-03-13 13:40:21.893996110 + *** *** 752,753 --- 752,755 { /* Add new patch number below this line */ + /**/ + 4557, /**/ -- hundred-and-one symptoms of being an internet addict: 248. You sign your letters with your e-mail address instead of your name. /// 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/20220313134213.A4C2D1C79E6%40moolenaar.net.
Re: Patch 8.2.4555 (getmousepos)
The problem persists: Included patches: 1-4557. The problem seems to be that tabs are not taken into account when calculating column. With the line, like listmode, starts with 3 tabs ^I^I^Ix click on the x and getmousepos return column 25 but with the cursor on 'x' "getpos('.')" returns 4 My goal is to intercept a mouse click, if it is in a special area, want to do something special, otherwise set the cursor position to where there there was a click, like default behavior. def Click() var d = getmousepos() echo d['column'] win_gotoid(d['winid']) cursor(d['line'], d['column']) enddef nnoremap :MyClick command! -nargs=0 MyClick Click() -ernie On 3/13/22 5:08 AM, Bram Moolenaar wrote: Patch 8.2.4555 Problem:getmousepos() returns the wrong column. (Ernie Rael) Solution: Limit to the text size, not the number of bytes. Files: src/mouse.c, src/testdir/test_functions.vim *** ../vim-8.2.4554/src/mouse.c 2021-11-29 17:37:38.063265208 + --- src/mouse.c 2022-03-13 11:54:16.919648342 + *** *** 3099,3115 col -= left_off; if (row >= 0 && row < wp->w_height && col >= 0 && col < wp->w_width) { - char_u *p; int count; mouse_comp_pos(wp, &row, &col, &line, NULL); ! // limit to text length plus one ! p = ml_get_buf(wp->w_buffer, line, FALSE); ! count = (int)STRLEN(p); if (col > count) col = count; - column = col + 1; } } --- 3099,3112 col -= left_off; if (row >= 0 && row < wp->w_height && col >= 0 && col < wp->w_width) { int count; mouse_comp_pos(wp, &row, &col, &line, NULL); ! // limit to text size plus one ! count = linetabsize(ml_get_buf(wp->w_buffer, line, FALSE)); if (col > count) col = count; column = col + 1; } } *** ../vim-8.2.4554/src/testdir/test_functions.vim 2022-02-20 19:05:06.359955597 + --- src/testdir/test_functions.vim 2022-03-13 12:02:00.249657121 + *** *** 2750,2755 --- 2750,2781 call assert_equal([0, 0, 0, 0, 0], getcurpos(1999)) endfunc + func Test_getmousepos() + enew! + call setline(1, "\t\t\t1234") + call test_setmouse(1, 25) + call assert_equal(#{ + \ screenrow: 1, + \ screencol: 25, + \ winid: win_getid(), + \ winrow: 1, + \ wincol: 25, + \ line: 1, + \ column: 25, + \ }, getmousepos()) + call test_setmouse(1, 50) + call assert_equal(#{ + \ screenrow: 1, + \ screencol: 50, + \ winid: win_getid(), + \ winrow: 1, + \ wincol: 50, + \ line: 1, + \ column: 29, + \ }, getmousepos()) + bwipe! + endfunc + " Test for glob() func Test_glob() call assert_equal('', glob(test_null_string())) *** ../vim-8.2.4554/src/version.c 2022-03-12 21:28:18.532257720 + --- src/version.c 2022-03-13 12:00:39.170223010 + *** *** 752,753 --- 752,755 { /* Add new patch number below this line */ + /**/ + 4555, /**/ -- -- 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/525474ce-cdc8-52c2-4a95-1b70cb8f0bef%40raelity.com.
Patch 8.2.4558
Patch 8.2.4558 Problem:Motif: using default colors does not work as expected. Solution: Do not try to store the default colors, use the resources. (closes #9933) Files: src/gui_motif.c, src/gui.h *** ../vim-8.2.4557/src/gui_motif.c 2022-03-12 12:21:24.230165381 + --- src/gui_motif.c 2022-03-13 14:41:30.720872991 + *** *** 440,450 menuBar = XmCreateMenuBar(vimForm, "menuBar", al, ac); XtManageChild(menuBar); - // Remember the default colors, needed for ":hi clear". - XtVaGetValues(menuBar, - XmNbackground, &gui.menu_def_bg_pixel, - XmNforeground, &gui.menu_def_fg_pixel, - NULL); gui_motif_menu_colors(menuBar); } #endif --- 440,445 *** *** 1672,1683 { if (gui.in_use) { ! // Use the values saved when starting up. These should come from the ! // window manager or a resources file. ! gui.menu_fg_pixel = gui.menu_def_fg_pixel; ! gui.menu_bg_pixel = gui.menu_def_bg_pixel; ! gui.scroll_fg_pixel = gui.scroll_def_fg_pixel; ! gui.scroll_bg_pixel = gui.scroll_def_bg_pixel; #ifdef FEAT_BEVAL_GUI gui.tooltip_fg_pixel = gui_get_color((char_u *)gui.rsrc_tooltip_fg_name); --- 1667,1676 { if (gui.in_use) { ! gui.menu_fg_pixel = gui_get_color((char_u *)gui.rsrc_menu_fg_name); ! gui.menu_bg_pixel = gui_get_color((char_u *)gui.rsrc_menu_bg_name); ! gui.scroll_fg_pixel = gui_get_color((char_u *)gui.rsrc_scroll_fg_name); ! gui.scroll_bg_pixel = gui_get_color((char_u *)gui.rsrc_scroll_bg_name); #ifdef FEAT_BEVAL_GUI gui.tooltip_fg_pixel = gui_get_color((char_u *)gui.rsrc_tooltip_fg_name); *** *** 1860,1873 sb->id = XtCreateWidget("scrollBar", xmScrollBarWidgetClass, textAreaForm, args, n); - // Remember the default colors, needed for ":hi clear". - if (gui.scroll_def_bg_pixel == (guicolor_T)0 - && gui.scroll_def_fg_pixel == (guicolor_T)0) - XtVaGetValues(sb->id, - XmNbackground, &gui.scroll_def_bg_pixel, - XmNforeground, &gui.scroll_def_fg_pixel, - NULL); - if (sb->id != (Widget)0) { gui_mch_set_scrollbar_colors(sb); --- 1853,1858 *** *** 1895,1906 if (gui.scroll_bg_pixel != INVALCOLOR) { #if (XmVersion>=1002) XmChangeColor(sb->id, gui.scroll_bg_pixel); ! #else XtVaSetValues(sb->id, XmNtroughColor, gui.scroll_bg_pixel, NULL); - #endif } if (gui.scroll_fg_pixel != INVALCOLOR) --- 1880,1895 if (gui.scroll_bg_pixel != INVALCOLOR) { #if (XmVersion>=1002) + // This should not only set the through color but also adjust + // related colors, such as shadows. XmChangeColor(sb->id, gui.scroll_bg_pixel); ! #endif ! ! // Set the through color directly, in case XmChangeColor() decided ! // to change it. XtVaSetValues(sb->id, XmNtroughColor, gui.scroll_bg_pixel, NULL); } if (gui.scroll_fg_pixel != INVALCOLOR) *** ../vim-8.2.4557/src/gui.h 2022-01-16 14:15:45.513044987 + --- src/gui.h 2022-03-13 14:41:43.508845290 + *** *** 333,344 char *rsrc_scroll_bg_name; // Color of scrollbar background guicolor_Tscroll_bg_pixel;// Same in Pixel format - # ifdef FEAT_GUI_MOTIF - guicolor_Tmenu_def_fg_pixel; // Default menu foreground - guicolor_Tmenu_def_bg_pixel; // Default menu background - guicolor_Tscroll_def_fg_pixel; // Default scrollbar foreground - guicolor_Tscroll_def_bg_pixel; // Default scrollbar background - # endif Display *dpy; // X display Windowwid;// Window id of text area int visibility; // Is shell partially/fully obscured? --- 333,338 *** ../vim-8.2.4557/src/version.c 2022-03-13 13:40:42.237939908 + --- src/version.c 2022-03-13 14:42:51.204698797 + *** *** 752,753 --- 752,755 { /* Add new patch number below this line */ + /**/ + 4558, /**/ -- hundred-and-one symptoms of being an internet addict: 249. You've forgotten what the outside looks like. /// 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
Re: Patch 8.2.4555 (getmousepos)
Ernie Rael wrote: > The problem persists: Included patches: 1-4557. > > The problem seems to be that tabs are not taken into account when > calculating column. > > With the line, like listmode, starts with 3 tabs > ^I^I^Ix > click on the x and getmousepos return column 25 > but with the cursor on 'x' "getpos('.')" returns 4 > > > My goal is to intercept a mouse click, if it is in a special area, want > to do something special, otherwise set the cursor position to where > there there was a click, like default behavior. > > def Click() > var d = getmousepos() > echo d['column'] > win_gotoid(d['winid']) > cursor(d['line'], d['column']) > enddef > > nnoremap :MyClick > command! -nargs=0 MyClick Click() Hmm, reading the help text for getmousepos() again, it looks like the intention for "column" was to actually get the byte index of where the mouse is. But it currently is set to the screen column. And then it was limited to the number of bytes, which doesn't work. I fixed that last problem, but that goes against what the help says. I can change it to return the byte index, which will make it work for you. It is not backwards compatible, but considering that it was not returning the correct value, I doubt that someone depended on it. -- hundred-and-one symptoms of being an internet addict: 250. You've given up the search for the "perfect woman" and instead, sit in front of the PC until you're just too tired to care. /// 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/20220313155150.D3C511C79E4%40moolenaar.net.
Patch 8.2.4559
Patch 8.2.4559 (after 8.24555) Problem:getmousepos() returns the screen column. (Ernie Rael) Solution: Return the text column, as documented. Files: src/mouse.c, src/testdir/test_functions.vim *** ../vim-8.2.4558/src/mouse.c 2022-03-13 12:06:02.076218096 + --- src/mouse.c 2022-03-13 15:47:50.130233218 + *** *** 3065,3071 varnumber_T winid = 0; varnumber_T winrow = 0; varnumber_T wincol = 0; ! linenr_T line = 0; varnumber_T column = 0; if (rettv_dict_alloc(rettv) != OK) --- 3065,3071 varnumber_T winid = 0; varnumber_T winrow = 0; varnumber_T wincol = 0; ! linenr_T lnum = 0; varnumber_T column = 0; if (rettv_dict_alloc(rettv) != OK) *** *** 3099,3112 col -= left_off; if (row >= 0 && row < wp->w_height && col >= 0 && col < wp->w_width) { ! int count; ! ! mouse_comp_pos(wp, &row, &col, &line, NULL); ! ! // limit to text size plus one ! count = linetabsize(ml_get_buf(wp->w_buffer, line, FALSE)); ! if (col > count) ! col = count; column = col + 1; } } --- 3099,3106 col -= left_off; if (row >= 0 && row < wp->w_height && col >= 0 && col < wp->w_width) { ! if (!mouse_comp_pos(wp, &row, &col, &lnum, NULL)) ! col = vcol2col(wp, lnum, col); column = col + 1; } } *** *** 3114,3120 dict_add_number(d, "winid", winid); dict_add_number(d, "winrow", winrow); dict_add_number(d, "wincol", wincol); ! dict_add_number(d, "line", (varnumber_T)line); dict_add_number(d, "column", column); } #endif --- 3108,3114 dict_add_number(d, "winid", winid); dict_add_number(d, "winrow", winrow); dict_add_number(d, "wincol", wincol); ! dict_add_number(d, "line", (varnumber_T)lnum); dict_add_number(d, "column", column); } #endif *** ../vim-8.2.4558/src/testdir/test_functions.vim 2022-03-13 12:06:02.076218096 + --- src/testdir/test_functions.vim 2022-03-13 15:49:41.633915091 + *** *** 2753,2758 --- 2753,2768 func Test_getmousepos() enew! call setline(1, "\t\t\t1234") + call test_setmouse(1, 1) + call assert_equal(#{ + \ screenrow: 1, + \ screencol: 1, + \ winid: win_getid(), + \ winrow: 1, + \ wincol: 1, + \ line: 1, + \ column: 1, + \ }, getmousepos()) call test_setmouse(1, 25) call assert_equal(#{ \ screenrow: 1, *** *** 2761,2767 \ winrow: 1, \ wincol: 25, \ line: 1, ! \ column: 25, \ }, getmousepos()) call test_setmouse(1, 50) call assert_equal(#{ --- 2771,2777 \ winrow: 1, \ wincol: 25, \ line: 1, ! \ column: 4, \ }, getmousepos()) call test_setmouse(1, 50) call assert_equal(#{ *** *** 2771,2777 \ winrow: 1, \ wincol: 50, \ line: 1, ! \ column: 29, \ }, getmousepos()) bwipe! endfunc --- 2781,2787 \ winrow: 1, \ wincol: 50, \ line: 1, ! \ column: 8, \ }, getmousepos()) bwipe! endfunc *** ../vim-8.2.4558/src/version.c 2022-03-13 14:44:59.400422412 + --- src/version.c 2022-03-13 15:52:10.441496216 + *** *** 752,753 --- 752,755 { /* Add new patch number below this line */ + /**/ + 4559, /**/ -- hundred-and-one symptoms of being an internet addict: 251. You've never seen your closest friends who usually live WAY too far away. /// 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/20220313155355.74A411C79E4%40moolenaar.net.
Re: Patch 8.2.4555 (getmousepos)
On 3/13/22 8:51 AM, Bram Moolenaar wrote: Ernie Rael wrote: The problem persists: Included patches: 1-4557. The problem seems to be that tabs are not taken into account when calculating column. With the line, like listmode, starts with 3 tabs ^I^I^Ix click on the x and getmousepos return column 25 but with the cursor on 'x' "getpos('.')" returns 4 My goal is to intercept a mouse click, if it is in a special area, want to do something special, otherwise set the cursor position to where there there was a click, like default behavior. def Click() var d = getmousepos() echo d['column'] win_gotoid(d['winid']) cursor(d['line'], d['column']) enddef nnoremap :MyClick command! -nargs=0 MyClick Click() Hmm, reading the help text for getmousepos() again, it looks like the intention for "column" was to actually get the byte index of where the mouse is. But it currently is set to the screen column. And then it was limited to the number of bytes, which doesn't work. I fixed that last problem, but that goes against what the help says. I can change it to return the byte index, which will make it work for you. It is not backwards compatible, but considering that it was not returning the correct value, I doubt that someone depended on it. Works ok now. There was probably use of column when screencol or wincol was intended, so there might be issues... -- -- 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/560d3974-dc82-7cca-c5a7-69c4e34af606%40raelity.com.
Patch 8.2.4560
Patch 8.2.4560 Problem:Suspending with CTRL-Z does not work on DragonFlyBSD. Solution: Adjust #ifdef. (Ozaki Kiichi, closes #9943) Files: src/os_unix.c *** ../vim-8.2.4559/src/os_unix.c 2022-03-09 14:32:59.617641710 + --- src/os_unix.c 2022-03-13 17:22:29.407382895 + *** *** 887,895 else got_tstp = TRUE; ! #if !defined(__ANDROID__) && !defined(__OpenBSD__) ! // This is not required on all systems. On some systems (at least Android ! // and OpenBSD) this breaks suspending with CTRL-Z. signal(SIGTSTP, (RETSIGTYPE (*)())sig_tstp); #endif SIGRETURN; --- 887,895 else got_tstp = TRUE; ! #if !defined(__ANDROID__) && !defined(__OpenBSD__) && !defined(__DragonFly__) ! // This is not required on all systems. On some systems (at least Android, ! // OpenBSD, and DragonFlyBSD) this breaks suspending with CTRL-Z. signal(SIGTSTP, (RETSIGTYPE (*)())sig_tstp); #endif SIGRETURN; *** ../vim-8.2.4559/src/version.c 2022-03-13 15:52:34.173429915 + --- src/version.c 2022-03-13 17:25:14.094960245 + *** *** 752,753 --- 752,755 { /* Add new patch number below this line */ + /**/ + 4560, /**/ -- Emacs is a nice OS - but it lacks a good text editor. That's why I am using Vim. --Anonymous /// 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/20220313172837.389F21C79E4%40moolenaar.net.
Re: Patch 8.2.4559
On 14-Mar-2022 02:53, Bram Moolenaar wrote: Patch 8.2.4559 (after 8.24555) Problem:getmousepos() returns the screen column. (Ernie Rael) Solution: Return the text column, as documented. Files: src/mouse.c, src/testdir/test_functions.vim After this patch, mingw64 (gcc 11.2.0) throws this linker error for a non-gui build: gcc -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 -Wl,-nxcompat,-dynamicbase -municode -s -o vim.exe objnative/alloc.o objnative/arabic.o objnative/arglist.o objnative/autocmd.o objnative/beval.o objnative/blob.o objnative/blowfish.o objnative/buffer.o objnative/bufwrite.o objnative/change.o objnative/charset.o objnative/cindent.o objnative/clientserver.o objnative/clipboard.o objnative/cmdexpand.o objnative/cmdhist.o objnative/crypt.o objnative/crypt_zip.o objnative/debugger.o objnative/dict.o objnative/diff.o objnative/digraph.o objnative/drawline.o objnative/drawscreen.o objnative/edit.o objnative/eval.o objnative/evalbuffer.o objnative/evalfunc.o objnative/evalvars.o objnative/evalwindow.o objnative/ex_cmds.o objnative/ex_cmds2.o objnative/ex_docmd.o objnative/ex_eval.o objnative/ex_getln.o objnative/fileio.o objnative/filepath.o objnative/findfile.o objnative/float.o objnative/fold.o objnative/getchar.o objnative/gui_xim.o objnative/hardcopy.o objnative/hashtab.o objnative/help.o objnative/highlight.o objnative/if_cscope.o objnative/indent.o objnative/insexpand.o objnative/json.o objnative/list.o objnative/locale.o objnative/main.o objnative/map.o objnative/mark.o objnative/match.o objnative/memfile.o objnative/memline.o objnative/menu.o objnative/message.o objnative/misc1.o objnative/misc2.o objnative/mouse.o objnative/move.o objnative/mbyte.o objnative/normal.o objnative/ops.o objnative/option.o objnative/optionstr.o objnative/os_mswin.o objnative/os_win32.o objnative/pathdef.o objnative/popupmenu.o objnative/popupwin.o objnative/profiler.o objnative/quickfix.o objnative/regexp.o objnative/register.o objnative/scriptfile.o objnative/screen.o objnative/search.o objnative/session.o objnative/sha256.o objnative/sign.o objnative/spell.o objnative/spellfile.o objnative/spellsuggest.o objnative/strings.o objnative/syntax.o objnative/tag.o objnative/term.o objnative/testing.o objnative/textformat.o objnative/textobject.o objnative/textprop.o objnative/time.o objnative/typval.o objnative/ui.o objnative/undo.o objnative/usercmd.o objnative/userfunc.o objnative/version.o objnative/vim9cmds.o objnative/vim9compile.o objnative/vim9execute.o objnative/vim9expr.o objnative/vim9instr.o objnative/vim9script.o objnative/vim9type.o objnative/viminfo.o objnative/winclip.o objnative/window.o objnative/os_w32exe.o objnative/vimres.o objnative/xdiffi.o objnative/xemit.o objnative/xprepare.o objnative/xutils.o objnative/xhistogram.o objnative/xpatience.o objnative/iscygpty.o -lkernel32 -luser32 -lgdi32 -ladvapi32 -lcomdlg32 -lcomctl32 -lnetapi32 -lversion -lole32 -luuid d:/users/john/documents/software/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: objnative/mouse.o:mouse.c:(.text+0x318c): undefined reference to `vcol2col' collect2.exe: error: ld returned 1 exit status make: *** [Make_cyg_ming.mak:1107: vim.exe] Error 1 make: Target 'all' not remade because of errors. Sorry, I don't have a patch for this. 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/21dfc216-3df5-e138-5c28-45af5f677195%40internode.on.net.
Re: Patch 8.2.4559
John Marriott wrote: > On 14-Mar-2022 02:53, Bram Moolenaar wrote: > > Patch 8.2.4559 (after 8.24555) > > Problem:getmousepos() returns the screen column. (Ernie Rael) > > Solution: Return the text column, as documented. > > Files: src/mouse.c, src/testdir/test_functions.vim > > > > > After this patch, mingw64 (gcc 11.2.0) throws this linker error for a=20 > non-gui build: > > objnative/mouse.o:mouse.c:(.text+0x318c): undefined reference to `vcol2col' > collect2.exe: error: ld returned 1 exit status > make: *** [Make_cyg_ming.mak:1107: vim.exe] Error 1 > make: Target 'all' not remade because of errors. > > > Sorry, I don't have a patch for this. Forgot to update the #ifdef. Patch coming... -- hundred-and-one symptoms of being an internet addict: 252. You vote for foreign officials. /// 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/20220313192509.513421C79E4%40moolenaar.net.
Patch 8.2.4561
Patch 8.2.4561 Problem:Build failure with some combination of features. (John Marriott) Solution: Adjust #ifdef. Files: src/mouse.c *** ../vim-8.2.4560/src/mouse.c 2022-03-13 15:52:34.173429915 + --- src/mouse.c 2022-03-13 19:08:29.885557073 + *** *** 3031,3037 } #if defined(NEED_VCOL2COL) || defined(FEAT_BEVAL) || defined(FEAT_PROP_POPUP) \ ! || defined(PROTO) /* * Convert a virtual (screen) column to a character column. * The first column is one. --- 3031,3037 } #if defined(NEED_VCOL2COL) || defined(FEAT_BEVAL) || defined(FEAT_PROP_POPUP) \ ! || defined(FEAT_EVAL) || defined(PROTO) /* * Convert a virtual (screen) column to a character column. * The first column is one. *** ../vim-8.2.4560/src/version.c 2022-03-13 17:27:34.174619983 + --- src/version.c 2022-03-13 19:02:34.594048985 + *** *** 752,753 --- 752,755 { /* Add new patch number below this line */ + /**/ + 4561, /**/ -- hundred-and-one symptoms of being an internet addict: 253. You wait for a slow loading web page before going to the toilet. /// 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/20220313192509.549E71C79E5%40moolenaar.net.
Patch 8.2.4562
Patch 8.2.4562 Problem:Linear tag search is not optimal. Solution: Improve linear tag search performance. (Yegappan Lakshmanan, closes #9944) Files: src/tag.c *** ../vim-8.2.4561/src/tag.c 2022-03-12 17:38:26.354365193 + --- src/tag.c 2022-03-13 19:22:12.280550180 + *** *** 1642,1675 typedef struct { tagsearch_state_T state; // tag search state char_u*tag_fname; // name of the tag file FILE *fp;// current tags file pointer - pat_T orgpat; // holds unconverted pattern info int flags; // flags used for tag search int tag_file_sorted;// !_TAG_FILE_SORTED value int get_searchpat; // used for 'showfulltag' int help_only; // only search for help tags - vimconv_T vimconv; - #ifdef FEAT_MULTI_LANG - char_uhelp_lang[3]; // lang of current tags file - int help_pri; // help language priority - char_u*help_lang_find;// lang to be found - int is_txt; // flag of file extension - #endif int did_open; // did open a tag file int mincount; // MAXCOL: find all matches // other: minimal number of matches int linear; // do a linear search ! char_u *lbuf; // line buffer ! int lbuf_size; // length of lbuf #ifdef FEAT_EMACS_TAGS int is_etag;// current file is emacs style char_u*ebuf; // additional buffer for etag fname #endif int match_count;// number of matches found garray_T ga_match[MT_COUNT]; // stores matches in sequence hashtab_T ht_match[MT_COUNT]; // stores matches by key - int stop_searching; // stop when match found or error } findtags_state_T; /* --- 1642,1675 typedef struct { tagsearch_state_T state; // tag search state + int stop_searching; // stop when match found or error + pat_T *orgpat;// holds unconverted pattern info + char_u *lbuf; // line buffer + int lbuf_size; // length of lbuf char_u*tag_fname; // name of the tag file FILE *fp;// current tags file pointer int flags; // flags used for tag search int tag_file_sorted;// !_TAG_FILE_SORTED value int get_searchpat; // used for 'showfulltag' int help_only; // only search for help tags int did_open; // did open a tag file int mincount; // MAXCOL: find all matches // other: minimal number of matches int linear; // do a linear search ! vimconv_T vimconv; #ifdef FEAT_EMACS_TAGS int is_etag;// current file is emacs style char_u*ebuf; // additional buffer for etag fname #endif + #ifdef FEAT_MULTI_LANG + char_uhelp_lang[3]; // lang of current tags file + int help_pri; // help language priority + char_u*help_lang_find;// lang to be found + int is_txt; // flag of file extension + #endif int match_count;// number of matches found garray_T ga_match[MT_COUNT]; // stores matches in sequence hashtab_T ht_match[MT_COUNT]; // stores matches by key } findtags_state_T; /* *** *** 1687,1695 st->tag_fname = alloc(MAXPATHL + 1); st->fp = NULL; ! st->orgpat.pat = pat; ! st->orgpat.len = (int)STRLEN(pat); ! st->orgpat.regmatch.regprog = NULL; st->flags = flags; st->tag_file_sorted = NUL; st->help_only = (flags & TAG_HELP); --- 1687,1696 st->tag_fname = alloc(MAXPATHL + 1); st->fp = NULL; ! st->orgpat = ALLOC_ONE(pat_T); ! st->orgpat->pat = pat; ! st->orgpat->len = (int)STRLEN(pat); ! st->orgpat->regmatch.regprog = NULL; st->flags = flags; st->tag_file_sorted = NUL; st->help_only = (flags & TAG_HELP); *** *** 1736,1742 { vim_free(st->tag_fname); vim_free(st->lbuf); ! vim_regfree(st->orgpat.regmatch.regprog); #ifdef FEAT_EMACS_TAGS vim_free(st->ebuf); #endif --- 1737,1744 { vim_free(st->tag_fname); vim_free(st->lbuf);
Re: Patch 8.2.4560
Bram Moolenaar wrote: > Patch 8.2.4560 > Problem:Suspending with CTRL-Z does not work on DragonFlyBSD. > Solution: Adjust #ifdef. (Ozaki Kiichi, closes #9943) > Files: src/os_unix.c ...snip... > ! #if !defined(__ANDROID__) && !defined(__OpenBSD__) && > !defined(__DragonFly__) > ! // This is not required on all systems. On some systems (at least > Android, > ! // OpenBSD, and DragonFlyBSD) this breaks suspending with CTRL-Z. > signal(SIGTSTP, (RETSIGTYPE (*)())sig_tstp); > #endif I wonder whether there is a better way than adding ifdef values whenever someone reports an issue. I can't verify but perhaps we also need to check __FreeBSD__ __NetBSD__, __bsdi__, others ? It would be nice if someone with such a system could confirm whether CTRL-Z works or not and whether adding extra ifdef cases fixes it. Regards Dominique -- -- 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/CAON-T_hmrLg%3Ddj5RXrubbTHPnVsEiwNEWxww_uBvC2k4TZafTA%40mail.gmail.com.
Patch 8.2.4563
Patch 8.2.4563 Problem:"z=" in Visual mode may go beyond the end of the line. Solution: Adjust "badlen". Files: src/spellsuggest.c, src/testdir/test_spell.vim *** ../vim-8.2.4562/src/spellsuggest.c 2022-02-16 19:24:03.630162410 + --- src/spellsuggest.c 2022-03-13 20:10:41.055141499 + *** *** 506,511 --- 506,515 curwin->w_cursor.col = VIsual.col; ++badlen; end_visual_mode(); + // make sure we don't include the NUL at the end of the line + line = ml_get_curline(); + if (badlen > STRLEN(line) - curwin->w_cursor.col) + badlen = STRLEN(line) - curwin->w_cursor.col; } // Find the start of the badly spelled word. else if (spell_move_to(curwin, FORWARD, TRUE, TRUE, NULL) == 0 *** ../vim-8.2.4562/src/testdir/test_spell.vim 2022-01-29 11:22:11.827641991 + --- src/testdir/test_spell.vim 2022-03-13 20:10:30.559188438 + *** *** 456,461 --- 456,476 call assert_fails('set spellsuggest=timeout:--9', 'E474:') endfunc + func Test_spellsuggest_visual_end_of_line() + let enc_save = &encoding + set encoding=iso8859 + + " This was reading beyond the end of the line. + norm R000 + sil norm 0 + sil! norm i0) + sil! norm i0) + call feedkeys("\") + norm z= + + let &encoding = enc_save + endfunc + func Test_spellinfo() new let runtime = substitute($VIMRUNTIME, '\\', '/', 'g') *** ../vim-8.2.4562/src/version.c 2022-03-13 19:23:44.912318213 + --- src/version.c 2022-03-13 20:12:06.214772795 + *** *** 752,753 --- 752,755 { /* Add new patch number below this line */ + /**/ + 4563, /**/ -- If VIM were a woman, I'd marry her. Slim, organized, helpful and beautiful; what's not to like? --David A. Rogers /// 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/20220313201304.9CEC01C79E4%40moolenaar.net.