aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/autoload/man.vim19
-rw-r--r--src/nvim/ex_getln.c7
-rw-r--r--test/functional/ui/cmdline_spec.lua21
3 files changed, 37 insertions, 10 deletions
diff --git a/runtime/autoload/man.vim b/runtime/autoload/man.vim
index 4d43a4582b..f21e2ee4f3 100644
--- a/runtime/autoload/man.vim
+++ b/runtime/autoload/man.vim
@@ -19,7 +19,7 @@ function! s:init() abort
let s:find_arg = '-l'
endif
" Check for -l support.
- call s:get_page(s:get_path('', 'man')[0:-2])
+ call s:get_page(s:get_path('', 'man'))
catch /E145:/
" Ignore the error in restricted mode
catch /command error .*/
@@ -213,14 +213,16 @@ endfunction
function! s:get_path(sect, name) abort
if empty(a:sect)
- return s:system(['man', s:find_arg, a:name])
+ " Some man implementations (OpenBSD) return all available paths from the
+ " search command, so we get() the first one. #8341
+ return substitute(get(split(s:system(['man', s:find_arg, a:name])), 0, ''), '\n\+$', '', '')
endif
" '-s' flag handles:
" - tokens like 'printf(echo)'
" - sections starting with '-'
" - 3pcap section (found on macOS)
" - commas between sections (for section priority)
- return s:system(['man', s:find_arg, s:section_arg, a:sect, a:name])
+ return substitute(s:system(['man', s:find_arg, s:section_arg, a:sect, a:name]), '\n\+$', '', '')
endfunction
function! s:verify_exists(sect, name) abort
@@ -233,13 +235,10 @@ function! s:verify_exists(sect, name) abort
let path = s:get_path('', a:name)
endtry
endtry
- " We need to extract the section from the path because sometimes
- " the actual section of the manpage is more specific than the section
- " we provided to `man`. Try ':Man 3 App::CLI'.
- " Also on linux, it seems that the name is case insensitive. So if one does
- " ':Man PRIntf', we still want the name of the buffer to be 'printf' or
- " whatever the correct capitilization is.
- let path = path[:len(path)-2]
+ " Extract the section from the path, because sometimes the actual section is
+ " more specific than what we provided to `man` (try `:Man 3 App::CLI`).
+ " Also on linux, name seems to be case-insensitive. So for `:Man PRIntf`, we
+ " still want the name of the buffer to be 'printf'.
return s:extract_sect_and_name_path(path) + [path]
endfunction
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index e1198d6f1c..96388a2a9d 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -347,6 +347,13 @@ static uint8_t *command_line_enter(int firstc, long count, int indent)
redrawcmd();
}
+ // redraw the statusline for statuslines that display the current mode
+ // using the mode() function.
+ if (KeyTyped) {
+ curwin->w_redr_status = true;
+ redraw_statuslines();
+ }
+
did_emsg = false;
got_int = false;
s->state.check = command_line_check;
diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua
index f8680678ef..41c290a462 100644
--- a/test/functional/ui/cmdline_spec.lua
+++ b/test/functional/ui/cmdline_spec.lua
@@ -157,6 +157,27 @@ describe('external cmdline', function()
end)
end)
+ it("redraws statusline on entering", function()
+ command('set laststatus=2')
+ command('set statusline=%{mode()}')
+ feed(':')
+ screen:expect([[
+ |
+ {1:~ }|
+ {1:~ }|
+ {3:c^ }|
+ |
+ ]], nil, nil, function()
+ eq({{
+ content = { { {}, "" } },
+ firstc = ":",
+ indent = 0,
+ pos = 0,
+ prompt = ""
+ }}, cmdline)
+ end)
+ end)
+
it("works with input()", function()
feed(':call input("input", "default")<cr>')
screen:expect([[