Re-implement PR #1927 - man bufname should indicate man page.

This commit is contained in:
Steven Chan 2019-04-20 12:39:40 -07:00
parent 51730316ff
commit 734a7d0707

View File

@ -1,7 +1,7 @@
declare-option -docstring "name of the client in which documentation is to be displayed" \ declare-option -docstring "name of the client in which documentation is to be displayed" \
str docsclient str docsclient
declare-option -hidden str manpage declare-option -hidden str-list manpage
hook -group man-highlight global WinSetOption filetype=man %{ hook -group man-highlight global WinSetOption filetype=man %{
add-highlighter window/man-highlight group add-highlighter window/man-highlight group
@ -18,7 +18,7 @@ hook -group man-highlight global WinSetOption filetype=man %{
} }
hook global WinSetOption filetype=man %{ hook global WinSetOption filetype=man %{
hook -group man-hooks window WinResize .* %{ man-impl %val{bufname} %opt{manpage} } hook -group man-hooks window WinResize .* %{ man-impl %opt{manpage} }
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window man-hooks } hook -once -always window WinSetOption filetype=.* %{ remove-hooks window man-hooks }
} }
@ -33,11 +33,11 @@ define-command -hidden -params 2..3 man-impl %{ evaluate-commands %sh{
rm ${manout} rm ${manout}
if [ "${retval}" -eq 0 ]; then if [ "${retval}" -eq 0 ]; then
printf %s\\n " printf %s\\n "
edit -scratch '$buffer_name' edit -scratch %{*$buffer_name ${*}*}
execute-keys '%|cat<space>${colout}<ret>gk' execute-keys '%|cat<space>${colout}<ret>gk'
nop %sh{rm ${colout}} nop %sh{rm ${colout}}
set-option buffer filetype man set-option buffer filetype man
set-option window manpage '$@' set-option window manpage $buffer_name $*
" "
else else
printf %s\\n "echo -markup %{{Error}man '$@' failed: see *debug* buffer for details}" printf %s\\n "echo -markup %{{Error}man '$@' failed: see *debug* buffer for details}"
@ -64,5 +64,5 @@ The page can be a word, or a word directly followed by a section number between
;; ;;
esac esac
printf %s\\n "evaluate-commands -try-client %opt{docsclient} man-impl *man* $pagenum $subject" printf %s\\n "evaluate-commands -try-client %opt{docsclient} man-impl man $pagenum $subject"
} } } }