[vim/vim] c-x c-o error (Issue #14073)

11 views
Skip to first unread message

MikeWang

unread,
Feb 22, 2024, 3:21:02 AMFeb 22
to vim/vim, Subscribed

Steps to reproduce

c-x c-o error

Expected behaviour

image.png (view on web)

Version of Vim

9.125

Environment

linux

Logs and stack traces

No response


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14073@github.com>

Sean Dewar

unread,
Feb 22, 2024, 3:45:52 AMFeb 22
to vim/vim, Subscribed

If this started happening recently, it may be due to the change in f865895 which disallowed win_gotoid from switching windows during textlock (it was a bug that it was allowed previously).

Looking at the line numbers in the error, it seems to correspond to this :sleep command in vim-go's completion function.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14073/1958964840@github.com>

Christian Brabandt

unread,
Feb 22, 2024, 4:07:37 AMFeb 22
to vim/vim, Subscribed

Is this 9.1.0125 or 9.0.0125 ?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14073/1958999549@github.com>

MikeWang

unread,
Feb 22, 2024, 4:13:35 AMFeb 22
to vim/vim, Subscribed

9.1.125
image.png (view on web)


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14073/1959009491@github.com>

Christian Brabandt

unread,
Feb 22, 2024, 4:58:41 AMFeb 22
to vim/vim, Subscribed

thanks, always post the :version output, so this is clear. text prefered.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14073/1959088738@github.com>

Christian Brabandt

unread,
Feb 22, 2024, 5:14:08 AMFeb 22
to vim/vim, Subscribed

Actually, can you please provide more input when this happens? Are you in any window where switching from is disallowed like the cmdwin window? Or is this happening when evaluating the balloonexpr (in which case the text is locked?) or in other special circumstances?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14073/1959118597@github.com>

Sean Dewar

unread,
Feb 22, 2024, 5:22:16 AMFeb 22
to vim/vim, Subscribed

It looks like it's happening while evaluating an 'omnifunc' or 'completefunc', where textlock is set (expand_by_function).

There was a time where it was allowed (v8.2.0670) and where "E839: Completion function changed window" was given if the window was detected to have been changed after invoking the function, but it was reverted in v8.2.2426 for being problematic.

vim-go seems to have a few uses of win_gotoid used to temporarily switch windows that may be responsible for the error. These would likely be better served by using win_execute instead anyway.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14073/1959133166@github.com>

MikeWang

unread,
Feb 22, 2024, 5:47:39 AMFeb 22
to vim/vim, Subscribed

:version
VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Feb 22 2024 16:14:59)
Included patches: 1-125
Compiled by mikewang@VM-16-8-debian
Huge version without GUI. Features included (+) or not (-):
+acl +cryptv +fork() +modify_fname +persistent_undo -sun_workshop +viminfo
+arabic +cscope -gettext +mouse +popupwin +syntax +virtualedit
+autocmd +cursorbind -hangul_input -mouseshape +postscript +tag_binary +visual
+autochdir +cursorshape +iconv +mouse_dec +printer -tag_old_static +visualextra
-autoservername +dialog_con +insert_expand -mouse_gpm +profile -tag_any_white +vreplace
-balloon_eval +diff +ipv6 -mouse_jsbterm -python -tcl +wildignore
+balloon_eval_term +digraphs +job +mouse_netterm +python3 +termguicolors +wildmenu
-browse -dnd +jumplist +mouse_sgr +quickfix +terminal +windows
++builtin_terms -ebcdic +keymap -mouse_sysmouse +reltime +terminfo +writebackup
+byte_offset +emacs_tags +lambda +mouse_urxvt +rightleft +termresponse -X11
+channel +eval +langmap +mouse_xterm -ruby +textobjects +xattr
+cindent +ex_extra +libcall +multi_byte +scrollbind +textprop -xfontset
-clientserver +extra_search +linebreak +multi_lang +signs +timers -xim
-clipboard -farsi +lispindent -mzscheme +smartindent +title -xpm
+cmdline_compl +file_in_path +listcmds +netbeans_intg -sodium -toolbar -xsmp
+cmdline_hist +find_in_path +localmap +num64 -sound +user_commands -xterm_clipboard
+cmdline_info +float -lua +packages +spell +vartabs -xterm_save
+comments +folding +menu +path_extra +startuptime +vertsplit
+conceal -footer +mksession -perl +statusline +vim9script
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
defaults file: "$VIMRUNTIME/defaults.vim"
fall-back for $VIM: "/home/mikewang/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -g -O2 -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking:
gcc -L/usr/local/lib -Wl,--as-needed -o vim -lm -ltinfo -L/usr/lib/python3.11/config-3.11-x86_64-linux-gnu -lpython3.11 -ldl -lm


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14073/1959179769@github.com>

MikeWang

unread,
Feb 22, 2024, 5:53:09 AMFeb 22
to vim/vim, Subscribed

./configure --prefix=$HOME --enable-python3interp --enable-cscope --enable-terminal --enable-multibyte


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14073/1959189352@github.com>

MikeWang

unread,
Feb 22, 2024, 5:54:54 AMFeb 22
to vim/vim, Subscribed

mikewang@VM-16-8-debian:~/.vim$ cat vimrc
set nocompatible

call plug#begin()

Plug 'fatih/vim-go'
Plug 'majutsushi/tagbar'

Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'

"Plug 'flazz/vim-colorschemes'
Plug 'crusoexia/vim-monokai'
Plug 'morhetz/gruvbox'
Plug 'nanotech/jellybeans.vim'
Plug 'tpope/vim-vividchalk'
Plug 'joshdick/onedark.vim'
Plug 'jaredgorski/SpaceCamp'
Plug 'kaicataldo/material.vim', { 'branch': 'main' }

Plug 'junegunn/vim-easy-align'

Plug 'ctrlpvim/ctrlp.vim'
Plug 'vim-scripts/DrawIt'
Plug 'Yggdroot/vim-mark'

Plug 'mg979/vim-visual-multi'

Plug 'ervandew/SuperTab'
" Plug 'jiangmiao/auto-pairs'
" Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'

" git
Plug 'airblade/vim-gitgutter'

Plug 'preservim/nerdtree'
Plug 'preservim/nerdcommenter'
"Plug 'ryanoasis/vim-devicons'
Plug 'Xuyuanp/nerdtree-git-plugin'

" Plug 'dense-analysis/ale'
" Plug 'bufbuild/vim-buf'

Plug 'puremourning/vimspector'

Plug 'jparise/vim-graphql'

" game
Plug 'vim/killersheep'

" Plug 'rust-lang/rust.vim'

call plug#end()

set t_Co=256
set ts=4
set nu

set mouse=a

" ['|', '¦', '┆', '┊']
set list lcs=tab:|\
"set list lcs=tab:\┊
set cc=120

set incsearch
set wildmode=longest,list,full

set cursorline
set cursorcolumn

filetype plugin indent on
syn on

" -------------------- color
"let g:material_theme_style = 'default' | 'palenight' | 'ocean' | 'lighter' | 'darker' | 'default-community' | 'palenight-community' | 'ocean-community' | 'lighter-community' | 'darker-community'
let g:material_theme_style = 'default'
let g:material_terminal_italics = 1
colorscheme material
"set background=dark
"colorscheme onedark
"colorscheme koehler
"colorscheme monokai
"colorscheme gruvbox
"colorscheme jellybeans
"colorscheme vividchalk
"
let g:airline_theme = 'material'

let g:mapleader=","

let g:go_highlight_functions = 1
let g:go_highlight_fields = 1
let g:go_highlight_types = 1
let g:go_highlight_operators = 1
let g:go_highlight_extra_types = 1
let g:go_highlight_build_constraints = 1

let g:go_auto_type_info = 1
let g:go_auto_sameids = 1
let g:go_doc_popup_window = 1

let g:go_metalinter_enabled = ['vet', 'golint', 'errcheck']
let g:go_metalinter_autosave = 1
let g:go_metalinter_autosave_enabled = ['vet', 'golint']
let g:go_metalinter_deadline = "5s"

au FileType go nmap b (go-build)
"au FileType go nmap r (go-run-vertical)
au FileType go nmap r (go-run)
au FileType go nmap t (go-test)
au FileType go nmap e (go-rename)
au FileType go nmap s (go-implements)
au FileType go nmap i (go-iferr)

" ale
"\ '*':['trim_whitespace', 'remove_trailing_lines'],
let g:ale_fixers = {
\ 'rust': ['rustfmt'],
\ 'python': ['yapf', 'isort', 'autoflake', 'autoimport'],
\ 'go': ['gofmt', 'remove_trailing_lines','trim_whitespace'],
}

let g:ale_linters = {
\ 'rust': ['analyzer', 'cargo'],
\ 'go': ['gopls','govte'],
\ }

let g:ale_fix_on_save = 1
let g:ale_completion_enabled = 1
let g:ale_completion_autoimport = 1

let g:ale_set_balloons = 1
let g:ale_floating_preview = 1
let g:ale_hover_to_floating_preview = 1

let g:airline#extensions#ale#enabled = 1

" au FileType rust nmap gd (ale_go_to_definition)
" au FileType rust nmap K (ale_hover)

" set omnifunc=ale#completion#OmniFunc
mikewang@VM-16-8-debian:~/.vim$


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14073/1959191945@github.com>

Sean Dewar

unread,
Feb 22, 2024, 6:47:34 AMFeb 22
to vim/vim, Subscribed

Assuming I'm correct about the cause of the issue in my comment here, vim-go's l:lsp.handleResponse() function may be trying to jump to what is already the current window anyway. We can avoid checking textlock in win_gotoid in that case.

Can you see if applying this fixes your issue @it512?

diff --git a/src/evalwindow.c b/src/evalwindow.c
index 00081d43d..f9b1c1296 100644
--- a/src/evalwindow.c
+++ b/src/evalwindow.c
@@ -824,6 +824,13 @@ f_win_gotoid(typval_T *argvars, typval_T *rettv)
 	return;
 
     id = tv_get_number(&argvars[0]);
+    if (curwin->w_id == id)
+    {
+	// Nothing to do.
+	rettv->vval.v_number = 1;
+	return;
+    }
+
     if (text_or_buf_locked())
 	return;
 #if defined(FEAT_PROP_POPUP) && defined(FEAT_TERMINAL)

Do note it might still be possible that vim-go attempts to switch to a different window during textlock, which this won't address (E565 is correct in that case).


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14073/1959284019@github.com>

MikeWang

unread,
Feb 22, 2024, 7:01:57 AMFeb 22
to vim/vim, Subscribed

image.png (view on web)

@seandewar ok good!
thanks!


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14073/1959305910@github.com>

Sean Dewar

unread,
Feb 22, 2024, 7:04:39 AMFeb 22
to vim/vim, Subscribed

Excellent! Thanks for checking. I'll create a PR with that patch in a moment.

(Mentioning this again: but to be clear, E565 might still be possible in vim-go where it wasn't before v9.1.0119 if it tries to switch to a different window during textlock, but that is not a bug; vim-go can consider using win_execute instead if it wants to temporarily switch windows, which isn't blocked by textlock)


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14073/1959310200@github.com>

Christian Brabandt

unread,
Feb 22, 2024, 1:57:34 PMFeb 22
to vim/vim, Subscribed

Closed #14073 as completed via 2a65e73.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/14073/issue_event/11895357891@github.com>

Reply all
Reply to author
Forward
0 new messages