doc: small UX improvements.

Place the cursor at the beginning of the file (and not at
the end of the first line) and improve error message in
case of failure.
This commit is contained in:
Markus F.X.J. Oberhumer 2021-05-02 11:24:17 +02:00
parent 47c0d20388
commit c4c093d764

View File

@ -125,6 +125,8 @@ define-command -params 1 -hidden doc-render %{
# Remove escaping of * and ` # Remove escaping of * and `
try %{ execute-keys -draft <percent> s \\((?=\*)|(?=`)) <ret> d } try %{ execute-keys -draft <percent> s \\((?=\*)|(?=`)) <ret> d }
# Go to beginning of file
execute-keys 'gg'
set-option buffer readonly true set-option buffer readonly true
add-highlighter buffer/ ranges doc_render_ranges add-highlighter buffer/ ranges doc_render_ranges
@ -184,7 +186,7 @@ define-command -params 0..2 \
fi fi
printf %s\\n "evaluate-commands -try-client %opt{docsclient} %{ doc-render ${page}; ${jump_cmd} }" printf %s\\n "evaluate-commands -try-client %opt{docsclient} %{ doc-render ${page}; ${jump_cmd} }"
else else
printf 'fail No such doc file: %s\n' "${page}" printf 'fail No such doc file: %s\n' "$topic.asciidoc"
fi fi
} }
} }