vim-patch:9.1.0573: ex: no implicit print for single addresses

Problem:  ex: no implicit print for single addresses
Solution: explicitly print even during single addresses,
          as requested by POSIX (Mohamed Akram)

See the POSIX behaviour here:
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ex.html#tag_20_40_13_03
Section 6b

closes: vim/vim#15230

c25a7084e9

Co-authored-by: Mohamed Akram <mohd.akram@outlook.com>
This commit is contained in:
zeertzjq
2024-07-14 06:38:26 +08:00
parent 49ba36becd
commit 9093fbdd02
5 changed files with 32 additions and 4 deletions

View File

@@ -32,8 +32,8 @@ if exists('s:did_load')
endif
if g:testname !~ 'test_mapping.vim$'
" Make "Q" switch to Ex mode.
" This does not work for all tests.
nnoremap Q gQ
" This does not work for all tests as Nvim only supports Vim Ex mode.
nnoremap Q gQ<Cmd>call<SID>ExStart()<CR>
endif
endif
@@ -45,6 +45,21 @@ if exists('s:did_load')
endif
let s:did_load = 1
func s:ExStart()
call feedkeys($"\<Cmd>call{expand('<SID>')}ExMayEnd()\<CR>")
endfunc
func s:ExMayEnd()
" When :normal runs out of characters in Vim, the behavior is different in
" normal Ex mode vs. Vim Ex mode.
" - In normal Ex mode, "\n" is used.
" - In Vim Ex mode, Ctrl-C is used.
" Nvim only supports Vim Ex mode, so emulate the normal Ex mode behavior.
if state('m') == '' && mode(1) == 'cv' && getcharstr(1) == "\<C-C>"
call feedkeys("\n")
endif
endfunc
" Clear Nvim default user commands, mappings and menus.
comclear
mapclear