Gvim 9 with patches 1-1506 is broken, need patch 1556

I tried disabling all customizations and plugins. This is a new issue. I have the gvim package, which includes the command line vim, but the issue is the same in the vim package with the same version.

I normally open multiple files (splits) with the :Sexplore command. This is built into vim. Opening the third window now ruins the second one.

Repro with:

$ cd
$ mv .vim .vim-backup
$ mv .vimrc .vimrc-backup
$ echo Hello > foo.txt
$ echo World > bar.txt
$ vim foo.txt

Inside vim I write the following commands:

:Sexplore

This opens a second split (window) with a file picker. I use arrow keys and enter to pick bar.txt.

I now have two splits (windows) with foo.txt and bar.txt. I now open the file explorer again with:

:Sexplore

At this point the file picker opens, but also, bar.txt gets replaced with a second file picker. So now I have two file pickers and no split (window) with bar.txt. When I have picked a file I have three splits, but one of them is just the unneeded file picker instead of bar.txt.

If you followed this recipe, you can restore your vim config afterwards with:

mv .vim .vim-deleteme
mv .vim-backup .vim
mv .vimrc-backup .vimrc

Output of vim --version:

$ vim --version
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled May 04 2023 08:18:27)
Included patches: 1-1506
Compiled by Arch Linux
Huge version with GTK3 GUI.  Features included (+) or not (-):
+acl               +file_in_path      +mouse_urxvt       -tag_any_white
+arabic            +find_in_path      +mouse_xterm       +tcl/dyn
+autocmd           +float             +multi_byte        +termguicolors
+autochdir         +folding           +multi_lang        +terminal
-autoservername    -footer            -mzscheme          +terminfo
+balloon_eval      +fork()            +netbeans_intg     +termresponse
+balloon_eval_term +gettext           +num64             +textobjects
+browse            -hangul_input      +packages          +textprop
++builtin_terms    +iconv             +path_extra        +timers
+byte_offset       +insert_expand     +perl/dyn          +title
+channel           +ipv6              +persistent_undo   +toolbar
+cindent           +job               +popupwin          +user_commands
+clientserver      +jumplist          +postscript        +vartabs
+clipboard         +keymap            +printer           +vertsplit
+cmdline_compl     +lambda            +profile           +vim9script
+cmdline_hist      +langmap           -python            +viminfo
+cmdline_info      +libcall           +python3/dyn       +virtualedit
+comments          +linebreak         +quickfix          +visual
+conceal           +lispindent        +reltime           +visualextra
+cryptv            +listcmds          +rightleft         +vreplace
+cscope            +localmap          +ruby/dyn          +wildignore
+cursorbind        +lua/dyn           +scrollbind        +wildmenu
+cursorshape       +menu              +signs             +windows
+dialog_con_gui    +mksession         +smartindent       +writebackup
+diff              +modify_fname      -sodium            +X11
+digraphs          +mouse             +sound             -xfontset
+dnd               +mouseshape        +spell             +xim
-ebcdic            +mouse_dec         +startuptime       -xpm
+emacs_tags        +mouse_gpm         +statusline        +xsmp_interact
+eval              -mouse_jsbterm     -sun_workshop      +xterm_clipboard
+ex_extra          +mouse_netterm     +syntax            -xterm_save
+extra_search      +mouse_sgr         +tag_binary        
-farsi             -mouse_sysmouse    -tag_old_static    
   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/sysprof-4 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cloudproviders -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -pthread -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -g -ffile-prefix-map=/build/vim/src=/usr/src/debug/vim -flto=auto -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 
Linking: gcc -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.36/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -flto=auto -L/usr/local/lib -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 -lXt -lX11 -lXdmcp -lSM -lICE -lm -ltinfo -lelf -lcanberra -lacl -lattr -lgpm -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.36/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -flto=auto -fstack-protector-strong -L/usr/local/lib -L/usr/lib/perl5/5.36/core_perl/CORE -lperl -lpthread -ldl -lm -lcrypt -lutil -lc -L/usr/lib -ltclstub8.6 -ldl -lz -lpthread -lm 

Output of pacman -Qi gvim

$ pacman -Qi gvim
Name            : gvim
Version         : 9.0.1506-1
Description     : Vi Improved, a highly configurable, improved version of the vi text editor (with advanced features, such
                  as a GUI)
Architecture    : x86_64
URL             : https://www.vim.org
Licenses        : custom:vim
Groups          : None
Provides        : vim=9.0.1506-1  xxd  vim-plugin-runtime
Depends On      : vim-runtime=9.0.1506-1  gpm  libxt  gtk3  glibc  libgcrypt  zlib  libcanberra  perl
Optional Deps   : python: Python language support [installed]
                  ruby: Ruby language support
                  lua: Lua language support [installed]
                  tcl: Tcl language support [installed]
Required By     : None
Optional For    : pacman
Conflicts With  : vim-minimal  vim
Replaces        : None
Installed Size  : 5.16 MiB
Packager        : Morten Linderud <foxboron@archlinux.org>
Build Date      : Thu 04 May 2023 10:18:27 AM CEST
Install Date    : Wed 14 Jun 2023 10:27:42 AM CEST
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : Signature

Here is the upstream bug with a patch: Vex is broken in latest build · Issue #12304 · vim/vim · GitHub

Looks like it was fixed in https://github.com/vim/vim/commit/b7398fe41c9e1e731d058105a34158871ee83e3f
Which means it’s included in vim patches later than 1556