Re: Bug of vim script
On Sun, Sep 15, 2019 at 8:55 AM Shidong Wang wrote: > > Hello, I am not sure if it is a bug, but it always make me confuses: > > here is a exmaple: > > func Test() > let c = 'sss' > let a = 1 > let b = 2 > echo c[a:b] > endf > > then call Test(), you will get error, Undefined variable: a:b > > of cause this can be avoided by changing the last line to echo c[a : b] Hm, the help defines an expr8 of that type as expr8[expr1a : expr1b] (with spaces around the colon) then proceeds to give examples, all of which have only empty or numeric indices without spaces around the colon. Looks like spaces are better (less confusing for the Vim parser, maybe) whenever the index is _other_ than empty or purely numeric. Bram: Bug or feature? Best regards, Tony. -- -- 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/CAJkCKXsuLmkGRk6X%2BVJ8cD0bUdH%3DqrYs7Y%3DE4d2s1uoGWXjz5A%40mail.gmail.com.
Bug of vim script
a: is a scope, like g: or s:, for arguments of the function. For example: function WithArgs(first, second) echo a:first a:second echo a:1 a:2 endfunction Regards, John Little -- -- 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/32ea159e-10d0-4559-a3ef-f37dc078d3ee%40googlegroups.com.
Re: Bug of vim script
Gotcha! In a function, a:b means "the argument named b". However, c[a:b] is an error even outside a function. c[a:b] is an error because a: is a known namespace (function arguments) c[b,d] is an error because b is a known namespace (buffer variables) c[x:y] is not an error, even with no spaces. Best regards, Tony. On Sun, Sep 15, 2019 at 9:47 AM Tony Mechelynck wrote: > > On Sun, Sep 15, 2019 at 8:55 AM Shidong Wang wrote: > > > > Hello, I am not sure if it is a bug, but it always make me confuses: > > > > here is a exmaple: > > > > func Test() > > let c = 'sss' > > let a = 1 > > let b = 2 > > echo c[a:b] > > endf > > > > then call Test(), you will get error, Undefined variable: a:b > > > > of cause this can be avoided by changing the last line to echo c[a : b] > > Hm, the help defines an expr8 of that type as expr8[expr1a : expr1b] > (with spaces around the colon) then proceeds to give examples, all of > which have only empty or numeric indices without spaces around the > colon. > > Looks like spaces are better (less confusing for the Vim parser, > maybe) whenever the index is _other_ than empty or purely numeric. > > Bram: Bug or feature? > > > Best regards, > Tony. -- -- 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/CAJkCKXvA5cCqP102NMrQJQ3TtY-NxhWPdvyzh0SsrA19gbgiPw%40mail.gmail.com.
Patch 8.1.2034
Patch 8.1.2034 Problem:Dark theme of GTK 3 not supported. Solution: Add the "d" flag in 'guioptions'. (Jonathan Conder, closes #4934) Files: runtime/doc/options.txt, src/feature.h, src/gui.c, src/gui_gtk_x11.c, src/option.h, src/proto/gui_gtk_x11.pro, src/testdir/test_gui.vim *** ../vim-8.1.2033/runtime/doc/options.txt 2019-09-14 21:00:01.379100893 +0200 --- runtime/doc/options.txt 2019-09-15 13:13:52.745023920 +0200 *** *** 856,861 --- 856,863 :set background& < Vim will guess the value. In the GUI this should work correctly, in other cases Vim might not be able to guess the right value. + If the GUI supports a dark them, you can use the "d" flag in + 'guioptions', see 'go-d'. When the |t_RB| option is set, Vim will use it to request the background color from the terminal. If the returned RGB value is dark/light and *** *** 3738,3743 --- 3742,3750 *'go-c'* 'c' Use console dialogs instead of popup dialogs for simple choices. + *'go-d'* + 'd' Use dark theme variant if available. Currently only works for + GTK+ GUI. *'go-e'* 'e' Add tab pages when indicated with 'showtabline'. 'guitablabel' can be used to change the text in the labels. *** ../vim-8.1.2033/src/feature.h 2019-09-04 15:54:23.916359692 +0200 --- src/feature.h 2019-09-15 13:08:06.054407481 +0200 *** *** 647,652 --- 647,659 #endif /* + * GUI dark theme variant + */ + #if defined(FEAT_GUI_GTK) && defined(USE_GTK3) + # define FEAT_GUI_DARKTHEME + #endif + + /* * GUI tabline */ #if defined(FEAT_NORMAL) \ *** ../vim-8.1.2033/src/gui.c 2019-08-21 14:36:29.387376100 +0200 --- src/gui.c 2019-09-15 13:08:06.058407465 +0200 *** *** 3425,3430 --- 3425,3434 void gui_init_which_components(char_u *oldval UNUSED) { + #ifdef FEAT_GUI_DARKTHEME + static intprev_dark_theme = -1; + int using_dark_theme = FALSE; + #endif #ifdef FEAT_MENU static intprev_menu_is_active = -1; #endif *** *** 3495,3500 --- 3499,3509 case GO_BOT: gui.which_scrollbars[SBAR_BOTTOM] = TRUE; break; + #ifdef FEAT_GUI_DARKTHEME + case GO_DARKTHEME: + using_dark_theme = TRUE; + break; + #endif #ifdef FEAT_MENU case GO_MENUS: gui.menu_is_active = TRUE; *** *** 3528,3533 --- 3537,3550 need_set_size = 0; fix_size = FALSE; + #ifdef FEAT_GUI_DARKTHEME + if (using_dark_theme != prev_dark_theme) + { + gui_mch_set_dark_theme(using_dark_theme); + prev_dark_theme = using_dark_theme; + } + #endif + #ifdef FEAT_GUI_TABLINE /* Update the GUI tab line, it may appear or disappear. This may * cause the non-GUI tab line to disappear or appear. */ *** ../vim-8.1.2033/src/gui_gtk_x11.c 2019-07-28 15:21:50.813275855 +0200 --- src/gui_gtk_x11.c 2019-09-15 13:08:06.058407465 +0200 *** *** 3130,3135 --- 3130,3148 } } + #if defined(FEAT_GUI_DARKTHEME) || defined(PROTO) + void + gui_mch_set_dark_theme(int dark) + { + # if GTK_CHECK_VERSION(3,0,0) + GtkSettings *gtk_settings; + + gtk_settings = gtk_settings_get_for_screen(gdk_screen_get_default()); + g_object_set(gtk_settings, "gtk-application-prefer-dark-theme", (gboolean)dark, NULL); + # endif + } + #endif /* FEAT_GUI_DARKTHEME */ + #ifdef FEAT_TOOLBAR /* *** ../vim-8.1.2033/src/option.h2019-09-14 21:00:01.383100879 +0200 --- src/option.h2019-09-15 13:08:06.058407465 +0200 *** *** 213,218 --- 213,219 #define GO_ASELML 'A' // autoselect modeless selection #define GO_BOT'b' // use bottom scrollbar #define GO_CONDIALOG 'c' // use console dialog + #define GO_DARKTHEME 'd' // use dark theme variant #define GO_TABLINE'e' // may show tabline #define GO_FORG 'f' // start GUI in foreground #define GO_GREY 'g' // use grey menu items *** *** 231,237 #define GO_FOOTER 'F' // add footer #define GO_VERTICAL 'v' // arrange dialog buttons vertically #define GO_KEEPWINSIZE'k' // keep GUI window size ! #define GO_ALL"!aAbcefFghilmMprtTvk" // all possible flags for 'go' // flags for 'comments' option #define COM_NEST 'n' // comments strings nest ---
Patch 8.1.2035
Patch 8.1.2035 Problem:Recognizing octal numbers is confusing. Solution: Introduce scriptversion 4: do not use octal and allow for single quote inside numbers. Files: runtime/doc/eval.txt, src/vim.h, src/eval.c, src/scriptfile.c, src/evalfunc.c, src/testdir/test_eval_stuff.vim, src/testdir/test_functions.vim *** ../vim-8.1.2034/runtime/doc/eval.txt2019-09-10 21:22:54.872629203 +0200 --- runtime/doc/eval.txt2019-09-15 14:26:28.494040912 +0200 *** *** 92,98 *octal* Conversion from a String to a Number is done by converting the first digits to a number. Hexadecimal "0xf9", Octal "017", and Binary "0b10" numbers are ! recognized. If the String doesn't start with digits, the result is zero. Examples: String "456"--> Number 456 ~ String "6bar" --> Number 6 ~ --- 92,99 *octal* Conversion from a String to a Number is done by converting the first digits to a number. Hexadecimal "0xf9", Octal "017", and Binary "0b10" numbers are ! recognized (NOTE: when using |scriptversion-4| octal is not recognized). If ! the String doesn't start with digits, the result is zero. Examples: String "456"--> Number 456 ~ String "6bar" --> Number 6 ~ *** *** 2543,2549 len({expr}) Number the length of {expr} libcall({lib}, {func}, {arg}) String call {func} in library {lib} with {arg} libcallnr({lib}, {func}, {arg}) Number idem, but return a Number ! line({expr}) Number line nr of cursor, last line or mark line2byte({lnum}) Number byte count of line {lnum} lispindent({lnum})Number Lisp indent for line {lnum} list2str({list} [, {utf8}]) String turn numbers in {list} into a String --- 2549,2555 len({expr}) Number the length of {expr} libcall({lib}, {func}, {arg}) String call {func} in library {lib} with {arg} libcallnr({lib}, {func}, {arg}) Number idem, but return a Number ! line({expr} [, {winid}]) Number line nr of cursor, last line or mark line2byte({lnum}) Number byte count of line {lnum} lispindent({lnum})Number Lisp indent for line {lnum} list2str({list} [, {utf8}]) String turn numbers in {list} into a String *** *** 2752,2758 str2float({expr}) Float convert String to Float str2list({expr} [, {utf8}]) Listconvert each character of {expr} to ASCII/UTF8 value ! str2nr({expr} [, {base}]) Number convert String to Number strchars({expr} [, {skipcc}]) Number character length of the String {expr} strcharpart({str}, {start} [, {len}]) String {len} characters of {str} at {start} --- 2758,2765 str2float({expr}) Float convert String to Float str2list({expr} [, {utf8}]) Listconvert each character of {expr} to ASCII/UTF8 value ! str2nr({expr} [, {base} [, {quoted}]]) ! Number convert String to Number strchars({expr} [, {skipcc}]) Number character length of the String {expr} strcharpart({str}, {start} [, {len}]) String {len} characters of {str} at {start} *** *** 6376,6383 the argument to the called function: > GetValue()->libcallnr("libc.so", "printf") < ! *line()* ! line({expr}) The result is a Number, which is the line number of the file position given with {expr}. The accepted positions are: . the cursor position $ the last line in the current buffer --- 6388,6396 the argument to the called function: > GetValue()->libcallnr("libc.so", "printf") < ! ! line({expr} [, {winid}]) *line()* ! The result is a Number, which is the line number of the file position given with {expr}. The accepted positions are: . the cursor position $ the last line in the current buffer *** *** 6395,6402 --- 6408,6418 then applies to another buffer. To get the column number use |col()|. To get both use |getpos()|. + With the optional {winid} argument the values are obtained for + that window instead of the current window. Examples: > line(".") line number of the cursor + line(".", winid)idem, in window "winid" line("'t")
Patch 8.1.2036
Patch 8.1.2036 (after 8.1.2035) Problem:The str2nr() tests fail. Solution: Add missing part of patch. Files: src/charset.c *** ../vim-8.1.2035/src/charset.c 2019-08-21 14:36:29.383376114 +0200 --- src/charset.c 2019-09-15 14:25:33.242229716 +0200 *** *** 1773,1778 --- 1773,1779 * If "what" contains STR2NR_OCT recognize octal numbers * If "what" contains STR2NR_HEX recognize hex numbers * If "what" contains STR2NR_FORCE always assume bin/oct/hex. + * If "what" contains STR2NR_QUOTE ignore embedded single quotes * If maxlen > 0, check at a maximum maxlen chars. * If strict is TRUE, check the number strictly. return *len = 0 if fail. */ *** *** 1841,1847 // Do the conversion manually to avoid sscanf() quirks. n = 1; ! if (pre == 'B' || pre == 'b' || what == STR2NR_BIN + STR2NR_FORCE) { /* bin */ if (pre != 0) --- 1842,1849 // Do the conversion manually to avoid sscanf() quirks. n = 1; ! if (pre == 'B' || pre == 'b' !|| ((what & STR2NR_BIN) && (what & STR2NR_FORCE))) { /* bin */ if (pre != 0) *** *** 1856,1864 ++ptr; if (n++ == maxlen) break; } } ! else if (pre == '0' || what == STR2NR_OCT + STR2NR_FORCE) { /* octal */ while ('0' <= *ptr && *ptr <= '7') --- 1858,1873 ++ptr; if (n++ == maxlen) break; + if ((what & STR2NR_QUOTE) && *ptr == '\'' +&& '0' <= ptr[1] && ptr[1] <= '1') + { + ++ptr; + if (n++ == maxlen) + break; + } } } ! else if (pre == '0' || ((what & STR2NR_OCT) && (what & STR2NR_FORCE))) { /* octal */ while ('0' <= *ptr && *ptr <= '7') *** *** 1871,1879 ++ptr; if (n++ == maxlen) break; } } ! else if (pre != 0 || what == STR2NR_HEX + STR2NR_FORCE) { /* hex */ if (pre != 0) --- 1880,1895 ++ptr; if (n++ == maxlen) break; + if ((what & STR2NR_QUOTE) && *ptr == '\'' +&& '0' <= ptr[1] && ptr[1] <= '7') + { + ++ptr; + if (n++ == maxlen) + break; + } } } ! else if (pre != 0 || ((what & STR2NR_HEX) && (what & STR2NR_FORCE))) { /* hex */ if (pre != 0) *** *** 1888,1893 --- 1904,1915 ++ptr; if (n++ == maxlen) break; + if ((what & STR2NR_QUOTE) && *ptr == '\'' && vim_isxdigit(ptr[1])) + { + ++ptr; + if (n++ == maxlen) + break; + } } } else *** *** 1906,1913 --- 1928,1942 ++ptr; if (n++ == maxlen) break; + if ((what & STR2NR_QUOTE) && *ptr == '\'' && VIM_ISDIGIT(ptr[1])) + { + ++ptr; + if (n++ == maxlen) + break; + } } } + // Check for an alpha-numeric character immediately following, that is // most likely a typo. if (strict && n - 1 != maxlen && ASCII_ISALNUM(*ptr)) *** ../vim-8.1.2035/src/version.c 2019-09-15 14:32:49.556731456 +0200 --- src/version.c 2019-09-15 14:49:18.849389000 +0200 *** *** 759,760 --- 759,762 { /* Add new patch number below this line */ + /**/ + 2036, /**/ -- hundred-and-one symptoms of being an internet addict: 265. Your reason for not staying in touch with family is that they do not have e-mail addresses. /// Bram Moolenaar -- b...@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/// -- -- 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/201909151250.x8FCoXNk003465%40masaka.moolenaar.net.
Regression using "-d" after 2027
After making 8.1.2033 (Windows 7, 64-bit MinGW) the display for the internal diff (external diff not tested) seems to be broken (8.1.2027 was ok): 8.1.2027: [image: gvim8.1.2027.png] 8.1.2033 (mind the missing diff colors): [image: gvim8.1.2034.png] In the latter build, the internal diff colors appear, if the files's syntax colors are turned off (syntax off). -- -- 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/4b397840-6000-4293-9748-012c92115c17%40googlegroups.com.
Re: Channel based plugins and scheduling
Hi Bram, Thanks for taking the time to put together the proposal. > Add a safeState() function, which returns true when: > - not halfway a mapping or stuffed command > - no operator pending > - not executing autocommand > - no autocomplete active perhaps? > - not blocked on waiting, e.g. ch_evalexpr() > - not in a nested callback (if that is even possible) Just to confirm: this function would return true in a channel callback handler (assuming there is nothing else going on). Because in a channel callback handler, as you mention below, is the place that we'd want to call this function and want to benefit from being able to immediately callback to govim if it was safe to do so. > Trigger autocommand when entering "safe" state: > - NormalSafe > - InsertSafe > - CmdlineSafe To keep things simple, do we need the three separate autocommands? Would one "safe" not be enough? Or are you doing this so that the plugin doesn't additionally need to check "which mode are we in?" > So that a plugin can: > - When callback is invoked and safeState() returns false, add to work queue > - When *Safe autocommand event triggers, process work queue Modulo the question above about the separate autocommands, sounds good. > Perhaps safeState() should have an argument about what is considered > safe. E.g. Command-line mode might not be safe. Although mode() could > be used for that. In fact, mode() contains more detail about the state, > what we don't have from there is whether a mapping is active or > something else that doesn't require user interaction. > > Or the return value could be a list of what "unsafe" things are > currently happening. Although that might make it difficult to decide > when to trigger the autocommand. I'm all for keeping this simple for now :) We won't be using the distinction between the three separate autocommands and for now, we're simply looking for a "safe/not safe". But it's highly likely we're not thinking as far ahead as you :) > An alternative is a state() function that returns flags for what is > active: > m inside mapping > x executing command (something in stuff buffer) > a autocommand busy > w waiting in channel function, such as ch_evalexpr() > c in callback, repeated when nesting > > Then trigger a StateChange autocommand when this value changes? Might > be triggered too often. Well, could use the pattern to define what to > wait for. More like StateLeave then, e.g.: > au StateLeave w call WaitEnded() Per above, I think all we (govim) are currently after is to know whether, when we call sateState() or whatever, there are currently any blocked ch_evalexpr calls, because our current approach only works for the ch_evalexpr calls we (govim) have made. We'd be making this call from within the channel callback handler. So the only possibility (at least as far as I understand it) is that things like autocommands, functions, commands etc could only, at this point, be blocked if they are using ch_evalexpr. Or is that not the case? It's quite possible there are other blocking calls I'm not aware of, so please only consider my comments here as seeking to clarify what we are trying to solve for: you have a far better and wider grasp of the problems involved and I understand you're trying to solve for other situations too! Thanks, Paul -- -- 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/CACoUkn5G78VKfartbax%3DYki%2Bw%3D-0EJxYUE430iJe5%2BOSAs10xQ%40mail.gmail.com.
Patch 8.1.2037
Patch 8.1.2037 Problem:Can call win_gotoid() in cmdline window. Solution: Disallow switching windows. (Yasuhiro Matsumoto, closes #4940) Files: src/evalwindow.c, src/testdir/test_cmdline.vim *** ../vim-8.1.2036/src/evalwindow.c2019-09-10 21:22:54.876629189 +0200 --- src/evalwindow.c2019-09-15 17:22:50.801391236 +0200 *** *** 50,71 return 0; } - static int - win_gotoid(typval_T *argvars) - { - win_T *wp; - tabpage_T *tp; - int id = tv_get_number(&argvars[0]); - - FOR_ALL_TAB_WINDOWS(tp, wp) - if (wp->w_id == id) - { - goto_tabpage_win(tp, wp); - return 1; - } - return 0; - } - static void win_id2tabwin(typval_T *argvars, list_T *list) { --- 50,55 *** *** 705,711 void f_win_gotoid(typval_T *argvars, typval_T *rettv) { ! rettv->vval.v_number = win_gotoid(argvars); } /* --- 689,712 void f_win_gotoid(typval_T *argvars, typval_T *rettv) { ! win_T *wp; ! tabpage_T *tp; ! int id = tv_get_number(&argvars[0]); ! ! #ifdef FEAT_CMDWIN ! if (cmdwin_type != 0) ! { ! emsg(_(e_cmdwin)); ! return; ! } ! #endif ! FOR_ALL_TAB_WINDOWS(tp, wp) ! if (wp->w_id == id) ! { ! goto_tabpage_win(tp, wp); ! rettv->vval.v_number = 1; ! return; ! } } /* *** ../vim-8.1.2036/src/testdir/test_cmdline.vim2019-09-09 18:35:28.119252725 +0200 --- src/testdir/test_cmdline.vim2019-09-15 17:22:07.685540144 +0200 *** *** 734,736 --- 734,746 let &encoding = encoding_save endfunc + + func Test_cmdwin_bug() + let winid = win_getid() + sp + try + call feedkeys("q::call win_gotoid(" .. winid .. ")\:q\", 'x!') + catch /^Vim\%((\a\+)\)\=:E11/ + endtry + bw! + endfunc *** ../vim-8.1.2036/src/version.c 2019-09-15 14:49:49.149286479 +0200 --- src/version.c 2019-09-15 16:56:50.982443502 +0200 *** *** 759,760 --- 759,762 { /* Add new patch number below this line */ + /**/ + 2037, /**/ -- Two fish in a tank. One says to the other: "Do you know how to drive this thing?" /// Bram Moolenaar -- b...@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/// -- -- 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/201909151527.x8FFRDO0005752%40masaka.moolenaar.net.
Re: Regression using "-d" after 2027
Aaron Heifetz wrote: > After making 8.1.2033 (Windows 7, 64-bit MinGW) the display for the > internal diff (external diff not tested) seems to be broken (8.1.2027 was > ok): > > 8.1.2027: > > > [image: gvim8.1.2027.png] > > > 8.1.2033 (mind the missing diff colors): > > > [image: gvim8.1.2034.png] > > In the latter build, the internal diff colors appear, if the files's syntax > colors are turned off (syntax off). I cannot reproduce this. What diff highlighting are you using? It looks like DiffChanged is not set. -- XML is a nice language for computers. Not for humans. /// Bram Moolenaar -- b...@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/// -- -- 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/201909151527.x8FFRDYe005745%40masaka.moolenaar.net.
Re: Channel based plugins and scheduling
Paul Jolly wrote: > Thanks for taking the time to put together the proposal. > > > Add a safeState() function, which returns true when: > > - not halfway a mapping or stuffed command > > - no operator pending > > - not executing autocommand > > - no autocomplete active perhaps? > > - not blocked on waiting, e.g. ch_evalexpr() > > - not in a nested callback (if that is even possible) > > Just to confirm: this function would return true in a channel callback > handler (assuming there is nothing else going on). Because in a > channel callback handler, as you mention below, is the place that we'd > want to call this function and want to benefit from being able to > immediately callback to govim if it was safe to do so. I assume there may be situations where a function wants to know where it was called from. It could be interactive, the user typed something, or from a callback. Therefore just true/false is not going to be sufficient. Thus I tend to go for a state() function, so you can filter out things you don't care about, e.g.: if state()->substitute('c', '', 'g') == '' " nothing relevant busy > > Trigger autocommand when entering "safe" state: > > - NormalSafe > > - InsertSafe > > - CmdlineSafe > > To keep things simple, do we need the three separate autocommands? > Would one "safe" not be enough? > > Or are you doing this so that the plugin doesn't additionally need to > check "which mode are we in?" Well, some things might not work well when typing text. But it's true that we could trigger SafeState and let the autocommand use mode() to find out where it is. > > So that a plugin can: > > - When callback is invoked and safeState() returns false, add to work queue > > - When *Safe autocommand event triggers, process work queue > > Modulo the question above about the separate autocommands, sounds good. > > > Perhaps safeState() should have an argument about what is considered > > safe. E.g. Command-line mode might not be safe. Although mode() could > > be used for that. In fact, mode() contains more detail about the state, > > what we don't have from there is whether a mapping is active or > > something else that doesn't require user interaction. > > > > Or the return value could be a list of what "unsafe" things are > > currently happening. Although that might make it difficult to decide > > when to trigger the autocommand. > > I'm all for keeping this simple for now :) We won't be using the > distinction between the three separate autocommands and for now, we're > simply looking for a "safe/not safe". But it's highly likely we're not > thinking as far ahead as you :) > > > An alternative is a state() function that returns flags for what is > > active: > > m inside mapping > > x executing command (something in stuff buffer) > > a autocommand busy > > w waiting in channel function, such as ch_evalexpr() > > c in callback, repeated when nesting > > > > Then trigger a StateChange autocommand when this value changes? Might > > be triggered too often. Well, could use the pattern to define what to > > wait for. More like StateLeave then, e.g.: > > au StateLeave w call WaitEnded() > > Per above, I think all we (govim) are currently after is to know > whether, when we call sateState() or whatever, there are currently any > blocked ch_evalexpr calls, because our current approach only works for > the ch_evalexpr calls we (govim) have made. We'd be making this call > from within the channel callback handler. So the only possibility (at > least as far as I understand it) is that things like autocommands, > functions, commands etc could only, at this point, be blocked if they > are using ch_evalexpr. Or is that not the case? I found that ch_read() and ch_readraw() can get to the same point of handling nested messages, if they read JSON. Inside :sleep messages are also handled, thus if a callback uses :sleep to wait a bit, it might cause other callbacks to be invoked. The listener callback can also do something that waits, but I suppose it is not specific for the listener callback, a timer callback is similar. Well, the listener callback is invoked when changing text, thus if somehow a nested callback tries to change text we have a problem. This more a detection of a state that Vim is busy with a command, then changing text is not OK. Another thing that plugins might want to check for: When info is avaialble and a popup is to be displayed, this probably should not be done if the screen is shifted up to show messages. > It's quite possible there are other blocking calls I'm not aware of, > so please only consider my comments here as seeking to clarify what we > are trying to solve for: you have a far better and wider grasp of the > problems involved and I understand you're trying to solve for other > situations too! I'm trying to avoid adding a safeState() function that we need to
Patch 8.1.2038
Patch 8.1.2038 Problem:has('vimscript-4') is always 0. Solution: Add "vimscript-4" to the feature table. (Naruhiko Nishino, closes #4941) Files: src/evalfunc.c, src/testdir/test_eval_stuff.vim *** ../vim-8.1.2037/src/evalfunc.c 2019-09-15 14:32:49.556731456 +0200 --- src/evalfunc.c 2019-09-15 17:45:50.545124570 +0200 *** *** 3771,3776 --- 3771,3777 "vimscript-1", "vimscript-2", "vimscript-3", + "vimscript-4", "virtualedit", "visual", "visualextra", *** ../vim-8.1.2037/src/testdir/test_eval_stuff.vim 2019-09-15 14:32:49.556731456 +0200 --- src/testdir/test_eval_stuff.vim 2019-09-15 17:48:05.708688409 +0200 *** *** 194,199 --- 194,200 scriptversion 4 func Test_vvar_scriptversion4() + call assert_true(has('vimscript-4')) call assert_equal(17, 017) call assert_equal(18, 018) call assert_equal(64, 0b1'00'00'00) *** ../vim-8.1.2037/src/version.c 2019-09-15 17:26:04.940719209 +0200 --- src/version.c 2019-09-15 17:47:02.740892232 +0200 *** *** 759,760 --- 759,762 { /* Add new patch number below this line */ + /**/ + 2038, /**/ -- hundred-and-one symptoms of being an internet addict: 267. You get an extra phone line so you can get phone calls. /// Bram Moolenaar -- b...@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/// -- -- 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/201909151549.x8FFnemj011081%40masaka.moolenaar.net.
Re: Regression using "-d" after 2027
a) Haven't changed my .vimrc between the specified versions: if has("patch-8.1.360") set diffopt=internal,filler,context:3,indent-heuristic,algorithm:minimal else ... endif b) No difference in :scriptnames output. c) :set all: --- Options --- ambiwidth=singleclipboard=nodiff foldignore=#imstatusfunc= makeencoding= pastetoggle=selection=old spellfile= notextmode novisualbell noautochdir cmdheight=1 diffexpr= foldlevel=0 includeexpr=makeprg=make patchexpr= selectmode= spelllang=en textwidth=190 nowarn autoindent cmdwinheight=20 nodigraph foldlevelstart=-1 incsearch matchtime=5 patchmode= shell=cmd.exe spellsuggest=best thesaurus=noweirdinvert noautoreadcolorcolumn=directory=d:\temp foldmethod=manual indentexpr= maxcombine=2 nopreserveindent shellcmdflag=/c nosplitbelow tildeop wildchar= noautowrite columns=226 display=lastline foldminlines=0 infercase maxfuncdepth=100 previewheight=12shellquote= nosplitright notimeout wildcharm=0 noautowriteallcomments= eadirection=both foldnestmax=20noinsertmode maxmapdepth=1000 previewpopup= noshellslashnostartofline timeoutlen=1000 nowildignorecase background=light nocompatiblenoedcompatible formatexpr= isprint=@,~-255 maxmem=8240710 nopreviewwindow shelltemp suffixesadd= title wildmenu nobackup complete=.,b,i emoji formatprg=nojoinspaces maxmemtot=8240710 printdevice=shellxquote=( noswapfile titlelen=85 wildmode=full backupcopy=auto concealcursor=n encoding=utf-8 nogdefaultkey=menuitems=25 prompt shiftround swapsync=fsync titlestring=wildoptions= backupext=~ conceallevel=0 endofline guifontwide=keymap= modeline pumheight=0 shiftwidth=3switchbuf= nottimeoutwinaltkeys=no balloondelay=600completefunc= equalalways guipty keymodel=startsel nomodelineexpr pumwidth=15 shortmess=aIOtT synmaxcol=3000 ttimeoutlen=-1 wincolor= noballooneval completepopup= equalprg= guitablabel=%t keywordprg=:helpmodelines=5 quoteescape=\ noshortname syntax= ttybuiltin window=80 balloonexpr= noconfirm noerrorbells guitabtooltip= langmap=modifiable noreadonlyshowbreak=>>tabline= ttyfast winheight=1 belloff= nocopyindent esckeys helpheight=20 langmenu=none nomodified redrawtime=2000 showcmd tabpagemax=10 ttyscroll=999 nowinfixheight nobinary cscopepathcomp=0eventignore= helplang=de nolangnoremap more regexpengine=0 showfulltag tabstop=3 undodir=. nowinfixwidth nobombcscopeprg=cscopeexpandtab hidden langremap mouse=a norelativenumbernoshowmatch tagbsearch noundofilewinminheight=1 breakindent nocscoperelativenoexrc history=600 laststatus=2 nomousefocus remap noshowmodetagcase=followic undolevels=500 winminwidth=1 browsedir=buffer nocscopetag fileencoding= hlsearchlazyredraw mousehide report=0showtabline=1 tagfunc= undoreload=1winwidth=20 bufhidden= cscopetagorder=0fileformat=unix iconlinebreak mousemodel=extend restorescreen sidescroll=25 taglength=0 updatecount=200 nowrap buflisted cscopeverbose fileignorecase iconstring= lines=81mousetime=500 noruler sidescrolloff=15tagrelative updatetime=4000 wrapmargin=0 buftype= nocursorbind filetype= ignorecase linespace=1 number rulerformat=signcolumn=auto tags=./tags,tags varsofttabstop= wrapscan cdpath=,, nocursorcolumn nofixendofline imactivatefunc= nolispnumberwidth=4 scroll=26 smartcase tagstack vartabstop=
Patch 8.1.2039
Patch 8.1.2039 Problem:Character from 'showbreak' does not use 'wincolor'. (Nick Jensen) Solution: Mix with 'wincolor'. (closes #4938) Files: src/screen.c, src/testdir/test_popupwin.vim, src/testdir/dumps/Test_popupwin_showbreak.dump *** ../vim-8.1.2038/src/screen.c2019-09-14 22:33:44.152114604 +0200 --- src/screen.c2019-09-15 18:10:11.748279641 +0200 *** *** 4153,4158 --- 4153,4161 * required when 'linebreak' is also set. */ if (tocol == vcol) tocol += n_extra; + // combine 'showbreak' with 'wincolor' + if (win_attr != 0) + char_attr = hl_combine_attr(win_attr, char_attr); # ifdef FEAT_SYN_HL // combine 'showbreak' with 'cursorline' if (cul_attr != 0) *** ../vim-8.1.2038/src/testdir/test_popupwin.vim 2019-09-14 21:23:37.141281837 +0200 --- src/testdir/test_popupwin.vim 2019-09-15 18:08:04.648706544 +0200 *** *** 797,804 set showbreak=>>\ call setline(1, range(1, 20)) let winid = popup_dialog( ! \ 'a long line here', ! \ #{filter: 'popup_filter_yesno'}) END call writefile(lines, 'XtestPopupShowbreak') let buf = RunVimInTerminal('-S XtestPopupShowbreak', #{rows: 10}) --- 797,805 set showbreak=>>\ call setline(1, range(1, 20)) let winid = popup_dialog( ! \ 'a long line here that wraps', ! \ #{filter: 'popup_filter_yesno', ! \ maxwidth: 12}) END call writefile(lines, 'XtestPopupShowbreak') let buf = RunVimInTerminal('-S XtestPopupShowbreak', #{rows: 10}) *** ../vim-8.1.2038/src/testdir/dumps/Test_popupwin_showbreak.dump 2019-07-20 17:45:45.552285965 +0200 --- src/testdir/dumps/Test_popupwin_showbreak.dump 2019-09-15 18:08:14.892672150 +0200 *** *** 1,10 >1+0ff0| @73 |2| @73 ! |3| @73 ! |4| @25|╔+0#001#ffd7ff255|═@17|╗| +0#000#ff0@27 ! |5| @25|║+0#001#ffd7ff255| |a| |l|o|n|g| |l|i|n|e| |h|e|r|e| |║| +0#000#ff0@27 ! |6| @25|╚+0#001#ffd7ff255|═@17|╝| +0#000#ff0@27 ! |7| @73 |8| @73 |9| @73 @57|1|,|1| @10|T|o|p| --- 1,10 >1+0ff0| @73 |2| @73 ! |3| @27|╔+0#001#ffd7ff255|═@13|╗| +0#000#ff0@29 ! |4| @27|║+0#001#ffd7ff255| |a| |l|o|n|g| |l|i|n|e| @1|║| +0#000#ff0@29 ! |5| @27|║+0#001#ffd7ff255| |>+0#4040ff13&@1| |h+0#001&|e|r|e| |t|h|a|t| |║| +0#000#ff0@29 ! |6| @27|║+0#001#ffd7ff255| |>+0#4040ff13&@1| | +0#001&|w|r|a|p|s| @3|║| +0#000#ff0@29 ! |7| @27|╚+0#001#ffd7ff255|═@13|╝| +0#000#ff0@29 |8| @73 |9| @73 @57|1|,|1| @10|T|o|p| *** ../vim-8.1.2038/src/version.c 2019-09-15 17:49:06.516490668 +0200 --- src/version.c 2019-09-15 18:09:19.292455880 +0200 *** *** 759,760 --- 759,762 { /* Add new patch number below this line */ + /**/ + 2039, /**/ -- hundred-and-one symptoms of being an internet addict: 268. You get up in the morning and go online before getting your coffee. /// Bram Moolenaar -- b...@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/// -- -- 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/201909151612.x8FGC1MW016386%40masaka.moolenaar.net.
Re: Regression using "-d" after 2027
Aaron Heifetz wrote: > a) Haven't changed my .vimrc between the specified versions: > > if has("patch-8.1.360") > set diffopt=3Dinternal,filler,context:3,indent-heuristic,algorithm:mini= > mal > else > ... > endif > > b) No difference in :scriptnames output. Not what changed, but what you already had, since you are apparently not using the default colors. Please start with "vim --clean" and reproduce it with that. You probably have some highlight commands that matter. -- hundred-and-one symptoms of being an internet addict: 269. You receive an e-mail from the wife of a deceased president, offering to send you twenty million dollar, and you are not even surprised. /// Bram Moolenaar -- b...@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/// -- -- 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/201909151705.x8FH54aF028721%40masaka.moolenaar.net.
Patch 8.1.2040
Patch 8.1.2040 Problem:No highlighting of current line in quickfix window. Solution: Combine with line_attr. Files: src/screen.c, src/testdir/test_quickfix.vim, src/testdir/dumps/Test_quickfix_cwindow_1.dump, src/testdir/dumps/Test_quickfix_cwindow_2.dump *** ../vim-8.1.2039/src/screen.c2019-09-15 18:11:13.304072783 +0200 --- src/screen.c2019-09-15 19:04:08.941064798 +0200 *** *** 4763,4776 comb_attr, cul_attr); else #endif char_attr = comb_attr; } else char_attr = hl_combine_attr(comb_attr, char_attr); } # ifdef FEAT_CONCEAL ! /* no concealing past the end of the line, it interferes !* with line highlighting */ if (c == NUL) syntax_flags = 0; else --- 4763,4780 comb_attr, cul_attr); else #endif + if (line_attr) + char_attr = hl_combine_attr( +comb_attr, line_attr); + else char_attr = comb_attr; } else char_attr = hl_combine_attr(comb_attr, char_attr); } # ifdef FEAT_CONCEAL ! // no concealing past the end of the line, it interferes ! // with line highlighting if (c == NUL) syntax_flags = 0; else *** ../vim-8.1.2039/src/testdir/test_quickfix.vim 2019-09-08 18:58:39.557952948 +0200 --- src/testdir/test_quickfix.vim 2019-09-15 19:01:40.533754185 +0200 *** *** 3,8 --- 3,10 source check.vim CheckFeature quickfix + source screendump.vim + set encoding=utf-8 func s:setup_commands(cchar) *** *** 2428,2433 --- 2430,2459 set efm&vim endfunc + func Test_cwindow_highlight() + CheckScreendump + + let lines =<< trim END + set t_u7= + call setline(1, ['some', 'text', 'with', 'matches']) + write XCwindow + vimgrep e XCwindow + redraw + cwindow 4 + END + call writefile(lines, 'XtestCwindow') + let buf = RunVimInTerminal('-S XtestCwindow', #{rows: 12}) + call VerifyScreenDump(buf, 'Test_quickfix_cwindow_1', {}) + + call term_sendkeys(buf, ":cnext\") + call VerifyScreenDump(buf, 'Test_quickfix_cwindow_2', {}) + + " clean up + call StopVimInTerminal(buf) + call delete('XtestCwindow') + call delete('XCwindow') + endfunc + func XvimgrepTests(cchar) call s:setup_commands(a:cchar) *** ../vim-8.1.2039/src/testdir/dumps/Test_quickfix_cwindow_1.dump 2019-09-15 19:09:03.427732076 +0200 --- src/testdir/dumps/Test_quickfix_cwindow_1.dump 2019-09-15 19:01:49.981709834 +0200 *** *** 0 --- 1,12 + |s+0ff0|o|m|e| @70 + |t|e|x|t| @70 + |w|i|t|h| @70 + |m|a|t|c|h|e|s| @67 + |~+0#4040ff13&| @73 + |X+1#000&|C|w|i|n|d|o|w| @48|1|,|4| @11|A|l@1 + >X+0#e05#4012|C|w|i|n|d|o|w||+0#000&|1+0#af5f00255&| |c|o|l| |4||+0#000&| |s|o|m|e| @52 + |X+0#e05#ff0|C|w|i|n|d|o|w||+0#000&|2+0#af5f00255&| |c|o|l| |2||+0#000&| |t|e|x|t| @52 + |X+0#e05&|C|w|i|n|d|o|w||+0#000&|4+0#af5f00255&| |c|o|l| |6||+0#000&| |m|a|t|c|h|e|s| @49 + |~+0#4040ff13&| @73 + |[+3#000&|Q|u|i|c|k|f|i|x| |L|i|s|t|]| |:|v|i|m|g|r|e|p| |e| |X|C|w|i|n|d|o|w| @20|1|,|1| @12|A|l@1 + | +0&&@74 *** ../vim-8.1.2039/src/testdir/dumps/Test_quickfix_cwindow_2.dump 2019-09-15 19:09:03.431732058 +0200 --- src/testdir/dumps/Test_quickfix_cwindow_2.dump 2019-09-15 19:01:51.033704900 +0200 *** *** 0 --- 1,12 + |s+0ff0|o|m|e| @70 + |t>e|x|t| @70 + |w|i|t|h| @70 + |m|a|t|c|h|e|s| @67 + |~+0#4040ff13&| @73 + |X+3#000&|C|w|i|n|d|o|w| @48|2|,|2| @11|A|l@1 + |X+0#e05&|C|w|i|n|d|o|w||+0#000&|1+0#af5f00255&| |c|o|l| |4||+0#000&| |s|o|m|e| @52 + |X+0#e05#4012|C|w|i|n|d|o|w||+0#000&|2+0#af5f00255&| |c|o|l| |2||+0#000&| |t|e|x|t| @52 + |X+0#e05#ff0|C|w|i|n|d|o|w||+0#000&|4+0#af5f00255&| |c|o|l| |6||+0#000&| |m|a|t|c|h|e|s| @49 + |~+0#4040ff13&| @73 + |[+1#000&|Q|u|i|c|k|f|i|x| |L|i|s|t|]| |:|v|i|m|g|r|e|p| |e| |X|C|w|i|n|d|o|w| @20|2|,|1| @12|A|l@1 + |:+0&&|c|n|e|x|t| @68 *** ../vim-8.1.2039/src/version.c 2019-09-15 18:11:13.308072771 +0200 --- src/version.c 2019-09-15 19:08:49.263795371 +0200 *** *** 759,760 --- 759,762 { /* Add new patch number below this line */ + /**/ + 2040, /**/ -- hun
Patch 8.1.2041
Patch 8.1.2041 (after 8.1.2040) Problem:No test for diff mode with syntax highlighting. Solution: Add a test case. Files: src/testdir/test_diffmode.vim, src/testdir/dumps/Test_diff_syntax_1.dump *** ../vim-8.1.2040/src/testdir/test_diffmode.vim 2019-09-06 21:34:25.362847408 +0200 --- src/testdir/test_diffmode.vim 2019-09-15 19:27:46.496905301 +0200 *** *** 905,910 --- 905,946 call delete('Xtest_diff_cursorline') endfunc + func Test_diff_with_syntax() + CheckScreendump + + let lines =<< trim END + void doNothing() { + int x = 0; + char *s = "hello"; + return 5; + } + END + call writefile(lines, 'Xprogram1.c') + let lines =<< trim END + void doSomething() { + int x = 0; + char *s = "there"; + return 5; + } + END + call writefile(lines, 'Xprogram2.c') + + let lines =<< trim END + edit Xprogram1.c + diffsplit Xprogram2.c + END + call writefile(lines, 'Xtest_diff_syntax') + let buf = RunVimInTerminal('-S Xtest_diff_syntax', {}) + + call VerifyScreenDump(buf, 'Test_diff_syntax_1', {}) + + " clean up + call StopVimInTerminal(buf) + call delete('Xtest_diff_syntax') + call delete('Xprogram1.c') + call delete('Xprogram2.c') + endfunc + func Test_diff_of_diff() CheckScreendump CheckFeature rightleft *** ../vim-8.1.2040/src/testdir/dumps/Test_diff_syntax_1.dump 2019-09-15 19:31:00.364269154 +0200 --- src/testdir/dumps/Test_diff_syntax_1.dump 2019-09-15 19:28:21.476793586 +0200 *** *** 0 --- 1,20 + | +0#e05#a8a8a8255@1>v+0#00e0003#ffd7ff255|o|i|d| +0#000&|d|o|S+2ff404010|o|m|e|t+0ffd7ff255|h|i|n|g|(|)| |{| @52 + | +0#e05#a8a8a8255@1| +0#000#ff0@10|i+0#00e0003&|n|t| +0#000&|x| |=| |0+0#e02&|;+0#000&| @51 + | +0#e05#a8a8a8255@1| +0#000#ffd7ff255@10|c+0#00e0003&|h|a|r| +0#000&|*|s| |=| |"+0#e02&|t+2ff404010|h|e|r|e|"+0ffd7ff255|;+0#000&| @43 + | +0#e05#a8a8a8255@1| +0#000#ff0@10|r+0#af5f00255&|e|t|u|r|n| +0#000&|5+0#e02&|;+0#000&| @52 + | +0#e05#a8a8a8255@1| +0#000#ff0@7|}| @63 + |~+0#4040ff13&| @73 + |~| @73 + |~| @73 + |~| @73 + |X+3#000&|p|r|o|g|r|a|m|2|.|c| @45|1|,|1| @11|A|l@1 + | +0#e05#a8a8a8255@1|v+0#00e0003#ffd7ff255|o|i|d| +0#000&|d|o|N+2ff404010|o|t+0ffd7ff255|h|i|n|g|(|)| |{| @54 + | +0#e05#a8a8a8255@1| +0#000#ff0@10|i+0#00e0003&|n|t| +0#000&|x| |=| |0+0#e02&|;+0#000&| @51 + | +0#e05#a8a8a8255@1| +0#000#ffd7ff255@10|c+0#00e0003&|h|a|r| +0#000&|*|s| |=| |"+0#e02&|h+2ff404010|e|l@1|o|"+0ffd7ff255|;+0#000&| @43 + | +0#e05#a8a8a8255@1| +0#000#ff0@10|r+0#af5f00255&|e|t|u|r|n| +0#000&|5+0#e02&|;+0#000&| @52 + | +0#e05#a8a8a8255@1| +0#000#ff0@7|}| @63 + |~+0#4040ff13&| @73 + |~| @73 + |~| @73 + |X+1#000&|p|r|o|g|r|a|m|1|.|c| @45|1|,|1| @11|A|l@1 + |"+0&&|X|p|r|o|g|r|a|m|2|.|c|"| |5|L|,| |7|6|C| @53 *** ../vim-8.1.2040/src/version.c 2019-09-15 19:09:17.739668187 +0200 --- src/version.c 2019-09-15 19:29:23.660591448 +0200 *** *** 759,760 --- 759,762 { /* Add new patch number below this line */ + /**/ + 2041, /**/ -- hundred-and-one symptoms of being an internet addict: 271. You collect hilarious signatures from all 250 mailing lists you are subscribed to. /// Bram Moolenaar -- b...@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/// -- -- 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/201909151732.x8FHW5LI004810%40masaka.moolenaar.net.
Re: Regression using "-d" after 2027
Aaron Heifetz wrote: > a) Also tried with "-d -i NONE -N -u NONE --noplugin -U NONE > .\Make_cyg_ming.mak .\Make_cyg_ming_ori.mak": > > > [image: 116.png] OK, now I see what you mean. Strange that no screenshot test failed for this. It's already fixed with patch 8.1.2040. -- hundred-and-one symptoms of being an internet addict: 270. You are subscribed to a mailing list for every piece of software you use. /// Bram Moolenaar -- b...@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/// -- -- 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/201909151732.x8FHW54C004828%40masaka.moolenaar.net.
Re: Patch 8.1.2035
Am 15.09.2019 um 14:33 schrieb Bram Moolenaar: Patch 8.1.2035 Problem:Recognizing octal numbers is confusing. Solution: Introduce scriptversion 4: do not use octal and allow for single quote inside numbers. Files: runtime/doc/eval.txt, src/vim.h, src/eval.c, src/scriptfile.c, src/evalfunc.c, src/testdir/test_eval_stuff.vim, src/testdir/test_functions.vim Single quotes could be a pitfall for scripts that attempt to skip string literals in Vim script code. // flags for vim_str2nr() ! #define STR2NR_BIN 0x01 ! #define STR2NR_OCT 0x02 ! #define STR2NR_HEX 0x04 #define STR2NR_ALL (STR2NR_BIN + STR2NR_OCT + STR2NR_HEX) ! #define STR2NR_NO_OCT (STR2NR_BIN + STR2NR_HEX) ! ! #define STR2NR_FORCE 0x80 // only when ONE of the above is used Is 0x80 the intended value or 0x08 ? ! #define STR2NR_QUOTE 0x10 // ignore embedded single quotes What happens with :echo 1''234 :echo 1'''234 ? Is it an error? -- Andy -- -- 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/5D7E7BE6.2080801%40yahoo.de.
Patch 8.1.2042
Patch 8.1.2042 Problem:The evalfunc.c file is too big. Solution: Move getchar() and parse_queued_messages() to getchar.c. Files: src/getchar.c, src/proto/getchar.pro, src/evalfunc.c, src/misc2.c, src/proto/misc2.pro *** ../vim-8.1.2041/src/getchar.c 2019-08-21 14:36:29.387376100 +0200 --- src/getchar.c 2019-09-15 20:20:11.909631856 +0200 *** *** 1901,1906 --- 1901,2105 return (retval != NUL); } + #if defined(FEAT_EVAL) || defined(PROTO) + /* + * "getchar()" function + */ + void + f_getchar(typval_T *argvars, typval_T *rettv) + { + varnumber_T n; + int error = FALSE; + + #ifdef MESSAGE_QUEUE + // vpeekc() used to check for messages, but that caused problems, invoking + // a callback where it was not expected. Some plugins use getchar(1) in a + // loop to await a message, therefore make sure we check for messages here. + parse_queued_messages(); + #endif + + /* Position the cursor. Needed after a message that ends in a space. */ + windgoto(msg_row, msg_col); + + ++no_mapping; + ++allow_keys; + for (;;) + { + if (argvars[0].v_type == VAR_UNKNOWN) + /* getchar(): blocking wait. */ + n = plain_vgetc(); + else if (tv_get_number_chk(&argvars[0], &error) == 1) + /* getchar(1): only check if char avail */ + n = vpeekc_any(); + else if (error || vpeekc_any() == NUL) + /* illegal argument or getchar(0) and no char avail: return zero */ + n = 0; + else + /* getchar(0) and char avail: return char */ + n = plain_vgetc(); + + if (n == K_IGNORE) + continue; + break; + } + --no_mapping; + --allow_keys; + + set_vim_var_nr(VV_MOUSE_WIN, 0); + set_vim_var_nr(VV_MOUSE_WINID, 0); + set_vim_var_nr(VV_MOUSE_LNUM, 0); + set_vim_var_nr(VV_MOUSE_COL, 0); + + rettv->vval.v_number = n; + if (IS_SPECIAL(n) || mod_mask != 0) + { + char_u temp[10]; /* modifier: 3, mbyte-char: 6, NUL: 1 */ + int i = 0; + + /* Turn a special key into three bytes, plus modifier. */ + if (mod_mask != 0) + { + temp[i++] = K_SPECIAL; + temp[i++] = KS_MODIFIER; + temp[i++] = mod_mask; + } + if (IS_SPECIAL(n)) + { + temp[i++] = K_SPECIAL; + temp[i++] = K_SECOND(n); + temp[i++] = K_THIRD(n); + } + else if (has_mbyte) + i += (*mb_char2bytes)(n, temp + i); + else + temp[i++] = n; + temp[i++] = NUL; + rettv->v_type = VAR_STRING; + rettv->vval.v_string = vim_strsave(temp); + + #ifdef FEAT_MOUSE + if (is_mouse_key(n)) + { + int row = mouse_row; + int col = mouse_col; + win_T *win; + linenr_Tlnum; + win_T *wp; + int winnr = 1; + + if (row >= 0 && col >= 0) + { + /* Find the window at the mouse coordinates and compute the +* text position. */ + win = mouse_find_win(&row, &col, FIND_POPUP); + if (win == NULL) + return; + (void)mouse_comp_pos(win, &row, &col, &lnum, NULL); + # ifdef FEAT_TEXT_PROP + if (WIN_IS_POPUP(win)) + winnr = 0; + else + # endif + for (wp = firstwin; wp != win && wp != NULL; + wp = wp->w_next) + ++winnr; + set_vim_var_nr(VV_MOUSE_WIN, winnr); + set_vim_var_nr(VV_MOUSE_WINID, win->w_id); + set_vim_var_nr(VV_MOUSE_LNUM, lnum); + set_vim_var_nr(VV_MOUSE_COL, col + 1); + } + } + #endif + } + } + + /* + * "getcharmod()" function + */ + void + f_getcharmod(typval_T *argvars UNUSED, typval_T *rettv) + { + rettv->vval.v_number = mod_mask; + } + #endif // FEAT_EVAL + + #if defined(MESSAGE_QUEUE) || defined(PROTO) + # define MAX_REPEAT_PARSE 8 + + /* + * Process messages that have been queued for netbeans or clientserver. + * Also check if any jobs have ended. + * These functions can call arbitrary vimscript and should only be called when + * it is safe to do so. + */ + void + parse_queued_messages(void) + { + int old_curwin_id = curwin->w_id; + int old_curbuf_fnum = curbuf->b_fnum; + int i; + int save_may_garbage_collect = may_garbage_collect; + + // Do not handle messages while redrawing, because it may cause buffers to + // change or be wiped while they are being redrawn. + if (updating_screen) + return; + + // may_garbage_collect is set in main_loop() to do garbage collection when + // blocking to
Re: Patch 8.1.2035
Andy Wokula wrote: > Am 15.09.2019 um 14:33 schrieb Bram Moolenaar: > > Patch 8.1.2035 > > Problem:Recognizing octal numbers is confusing. > > Solution: Introduce scriptversion 4: do not use octal and allow for single > > quote inside numbers. > > Files: runtime/doc/eval.txt, src/vim.h, src/eval.c, > > src/scriptfile.c, > > src/evalfunc.c, src/testdir/test_eval_stuff.vim, > > src/testdir/test_functions.vim > > Single quotes could be a pitfall for scripts that attempt to skip string > literals in Vim script code. It's not difficult to handle this syntax. > >// flags for vim_str2nr() > > ! #define STR2NR_BIN 0x01 > > ! #define STR2NR_OCT 0x02 > > ! #define STR2NR_HEX 0x04 > >#define STR2NR_ALL (STR2NR_BIN + STR2NR_OCT + STR2NR_HEX) > > ! #define STR2NR_NO_OCT (STR2NR_BIN + STR2NR_HEX) > > ! > > ! #define STR2NR_FORCE 0x80 // only when ONE of the above is used > > Is 0x80 the intended value or 0x08 ? Doesn't matter, just wanted to make sure it's further away from the BIN/OCT/HEX values. > > ! #define STR2NR_QUOTE 0x10 // ignore embedded single quotes > > What happens with > :echo 1''234 > :echo 1'''234 > ? Is it an error? A double single quote is not part of the number, thus 1''234 is the same as :echo 1 '' 234 Should add a test for that. -- Women are probably the main cause of free software starvation. /// Bram Moolenaar -- b...@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/// -- -- 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/201909151913.x8FJD0Hj023528%40masaka.moolenaar.net.
Patch 8.1.2043
Patch 8.1.2043 Problem:Not sufficient testing for quoted numbers. Solution: Add a few more test cases. Files: src/testdir/test_functions.vim, src/testdir/test_eval_stuff.vim *** ../vim-8.1.2042/src/testdir/test_functions.vim 2019-09-15 14:32:49.556731456 +0200 --- src/testdir/test_functions.vim 2019-09-15 21:12:10.012973544 +0200 *** *** 161,166 --- 161,167 call assert_equal(256, str2nr("1''", 2, 1)) call assert_equal(262144, str2nr("1'000'000", 8, 1)) call assert_equal(100, str2nr("1'000'000", 10, 1)) + call assert_equal(1000, str2nr("1'000''000", 10, 1)) call assert_equal(65536, str2nr("1'00'00", 16, 1)) call assert_equal(0, str2nr('0x10')) *** ../vim-8.1.2042/src/testdir/test_eval_stuff.vim 2019-09-15 17:49:06.516490668 +0200 --- src/testdir/test_eval_stuff.vim 2019-09-15 21:10:45.265204915 +0200 *** *** 200,205 --- 200,208 call assert_equal(64, 0b1'00'00'00) call assert_equal(1048576, 0x10'00'00) call assert_equal(100, 1'000'000) + call assert_equal("1234", execute("echo 1'234")->trim()) + call assert_equal('1 234', execute("echo 1''234")->trim()) + call assert_fails("echo 1'''234", 'E115:') endfunc scriptversion 1 *** ../vim-8.1.2042/src/version.c 2019-09-15 21:00:51.362604284 +0200 --- src/version.c 2019-09-15 21:09:49.189355077 +0200 *** *** 759,760 --- 759,762 { /* Add new patch number below this line */ + /**/ + 2043, /**/ -- Edison's greatest achievement came in 1879, when he invented the electric company. Edison's design was a brilliant adaptation of the simple electrical circuit: the electric company sends electricity through a wire to a customer, then immediately gets the electricity back through another wire /// Bram Moolenaar -- b...@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/// -- -- 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/201909151913.x8FJD0Oq023541%40masaka.moolenaar.net.
Re: Channel based plugins and scheduling
I was wondering where to trigger SafeState. I first thought it would be sufficient to do this higher up, where we are going to wait for the user to type a character and nothing is pending. Then it's safe to deal with any callbacks. However, think of this scenario: 1. In a safe state, SafeState is triggered. 2. Waiting for a character, receive a message. 3. Invoke callback for the message, it uses ch_evalexpr(). 4. While in ch_evalexpr() another message arrives. Since it's not safe now, work is postponed. 5. ch_evalexpr() finishes 6. go back to waiting for a character Now, so long as the user doesn't type anything, the work won't be executed. That may take long time. Or the user is actually waiting for the work to be done, which is a kind of deadlock. Thus it seems that we need to trigger SafeState also before 6. Under the condition we started waiting for a character in a safe state. And it was not safe at some moment (to avoid it being triggered too often). It does mean that the display won't be updated, thus we would need to do that, like when a timer callback was invoked. Does this sound OK? -- This sentence is not sure that it exists, but if it does, it will certainly consider the possibility that other sentences exist. /// Bram Moolenaar -- b...@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/// -- -- 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/201909152019.x8FKJ6NF002969%40masaka.moolenaar.net.
Patch 8.1.2044
Patch 8.1.2044 Problem:No easy way to process postponed work. (Paul Jolly) Solution: Add the SafeState autocommand event. Files: runtime/doc/autocmd.txt, src/main.c, src/proto/main.pro, src/vim.h, src/autocmd.c, src/channel.c, src/edit.c, src/ex_getln.c *** ../vim-8.1.2043/runtime/doc/autocmd.txt 2019-09-09 18:35:28.119252725 +0200 --- runtime/doc/autocmd.txt 2019-09-15 21:50:17.266633152 +0200 *** *** 355,360 --- 355,363 when popup menu visible |TextYankPost|after text has been yanked or deleted + |SafeState| nothing pending, going to wait for the user to type a + character + |ColorSchemePre| before loading a color scheme |ColorScheme| after loading a color scheme *** *** 956,961 --- 958,984 Note that even if an autocommand is defined, the reply should be read with |remote_read()| to consume it. + *SafeState* + SafeState When nothing is pending, going to wait for the + user to type a character. + This will not be triggered when: + - an operator is pending + - a register was entered with "r + - halfway executing a command + - executing a mapping + - there is typeahead + - Insert mode completion is active + - Command line completion is active + You can use `mode()` to find out what state + Vim is in. That may be: + - VIsual mode + - Normal mode + - Insert mode + - Command-line mode + Depending on what you want to do, you may also + check more with `state()`, e.g. whether the + screen was scrolled for messages. + *SessionLoadPost* SessionLoadPost After loading the session file created using the |:mksession| command. *** ../vim-8.1.2043/src/main.c 2019-09-14 21:00:01.379100893 +0200 --- src/main.c 2019-09-15 22:53:15.929911499 +0200 *** *** 1028,1033 --- 1028,1091 return params.not_a_term; } + + static intwas_safe = FALSE; + static intnot_safe_now = 0; + + /* + * Trigger SafeState if currently in a safe state for main_loop(). + */ + static void + may_trigger_safestate_main(oparg_T *oap) + { + may_trigger_safestate( + !finish_op + && oap->prev_opcount > 0 + && oap->prev_count0 == 0 + && oap->op_type == OP_NOP + && oap->regname == NUL + && restart_edit == 0); + } + + /* + * Trigger SafeState if currently in s safe state, that is "safe" is TRUE and + * there is no typeahead. + */ + void + may_trigger_safestate(int safe) + { + int is_safe = safe + && stuff_empty() + && typebuf.tb_len == 0 + && !global_busy; + + if (is_safe) + apply_autocmds(EVENT_SAFESTATE, NULL, NULL, FALSE, curbuf); + was_safe = is_safe; + } + + /* + * Entering a not-safe state. + */ + void + enter_unsafe_state(void) + { + ++not_safe_now; + } + + /* + * Leaving a not-safe state. Trigger SafeState if we were in a safe state + * before first calling enter_not_safe_state(). + */ + void + leave_unsafe_state(void) + { + --not_safe_now; + if (not_safe_now == 0 && was_safe) + apply_autocmds(EVENT_SAFESTATE, NULL, NULL, FALSE, curbuf); + } + + /* * Main loop: Execute Normal mode commands until exiting Vim. * Also used to handle commands in the command-line window, until the window *** *** 1133,1138 --- 1191,1199 msg_scroll = FALSE; quit_more = FALSE; + // it's not safe unless may_trigger_safestate_main() is called + was_safe = FALSE; + /* * If skip redraw is set (for ":" in wait_return()), don't redraw now. * If there is nothing in the stuff_buffer or do_redraw is TRUE, *** *** 1211,1216 --- 1272,1281 curbuf->b_last_changedtick = CHANGEDTICK(curbuf); } + // If nothing is pending and we are going to wait for the user to + // type a character, trigger SafeState. + may_trigger_safestate_main(&oa); + #if defined(FEAT_DIFF) // Updating diffs from c