[vim/vim] Error when calling searchcount() at statusline (#6194)

30 views
Skip to first unread message

zhmars

unread,
Jun 3, 2020, 1:30:11 AM6/3/20
to vim/vim, Subscribed

Describe the bug
When calling searchcount() at statusline, search a file with any character. I get the following error:

Error detected while processing function SearchCount:
line    1:
did_save_last_search_spat is not zero
did_save_last_search_spat is not one

To Reproduce

  1. Run vim --clean minimal.vim -S minimal.vim with:
 " minimal.vim
function! SearchCount() abort
  let search_count = searchcount()
  if !empty(search_count)
    return '[' . search_count.current . '/' . search_count.total . ']'
  else
    return ''
  endif
endfunction

set laststatus=2 statusline+=%{SearchCount()}
  1. Type /a in Normal mode.

Expected behavior
Not sure, no errors when calling searchcount()?

Environment (please complete the following information):

  • Vim version: 8.2.0890
  • OS: Arch Linux
  • Terminal: GNOME Terminal
The result of `vim --version`
  
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Jun  3 2020 05:03:33)
Included patches: 1-890
Compiled by Arch Linux
Huge version with GTK3 GUI.  Features included (+) or not (-):
+acl               -farsi             +mouse_sgr         +tag_binary
+arabic            +file_in_path      -mouse_sysmouse    -tag_old_static
+autocmd           +find_in_path      +mouse_urxvt       -tag_any_white
+autochdir         +float             +mouse_xterm       -tcl
-autoservername    +folding           +multi_byte        +termguicolors
+balloon_eval      -footer            +multi_lang        +terminal
+balloon_eval_term +fork()            -mzscheme          +terminfo
+browse            +gettext           +netbeans_intg     +termresponse
++builtin_terms    -hangul_input      +num64             +textobjects
+byte_offset       +iconv             +packages          +textprop
+channel           +insert_expand     +path_extra        +timers
+cindent           +ipv6              -perl              +title
+clientserver      +job               +persistent_undo   +toolbar
+clipboard         +jumplist          +popupwin          +user_commands
+cmdline_compl     +keymap            +postscript        +vartabs
+cmdline_hist      +lambda            +printer           +vertsplit
+cmdline_info      +langmap           +profile           +virtualedit
+comments          +libcall           -python            +visual
+conceal           +linebreak         +python3/dyn       +visualextra
+cryptv            +lispindent        +quickfix          +viminfo
+cscope            +listcmds          +reltime           +vreplace
+cursorbind        +localmap          +rightleft         +wildignore
+cursorshape       +lua/dyn           -ruby              +wildmenu
+dialog_con_gui    +menu              +scrollbind        +windows
+diff              +mksession         +signs             +writebackup
+digraphs          +modify_fname      +smartindent       +X11
+dnd               +mouse             +sound             -xfontset
-ebcdic            +mouseshape        +spell             +xim
+emacs_tags        +mouse_dec         +startuptime       +xpm
+eval              +mouse_gpm         +statusline        +xsmp_interact
+ex_extra          -mouse_jsbterm     -sun_workshop      +xterm_clipboard
+extra_search      +mouse_netterm     +syntax            -xterm_save
   system vimrc file: "/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "/etc/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gio-unix-2.0 -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/at-spi-2.0 -pthread    -march=haswell -mtune=haswell -O3 -fno-plt -falign-functions=32 -fno-semantic-interposition -fgraphite-identity -floop-nest-optimize -ftree-loop-distribution -ftree-vectorize -pipe -D_REENTRANT  -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -Wl,--hash-style=gnu -L/usr/local/lib -Wl,--as-needed -o vim   -lgtk-3 -lgdk-3 -lz -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0  -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE  -lm -ltinfo -lelf   -lcanberra  -lacl -lattr -lgpm -ldl
   


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

lacygoill

unread,
Jun 3, 2020, 9:10:35 AM6/3/20
to vim/vim, Subscribed

Can also reproduce without defaults.vim, by setting 'incsearch' and 'ruler':

vim -Nu NONE -S minimal.vim +'set is ru | call feedkeys("/a")' minimal.vim

Here is a backtrace

Bram Moolenaar

unread,
Jun 4, 2020, 2:57:02 PM6/4/20
to vim/vim, Subscribed

Closed #6194 via 442a853.

Reply all
Reply to author
Forward
0 new messages