rc modeline: Don't select more lines than configured
This commit addresses an off-by-one error that selected `modelines`+1 lines when looking for modelines in a buffer. Note that setting `modelines` to 0 will still select one line. Fixes #3733.
This commit is contained in:
parent
ec3d7c3104
commit
95c095f3fb
|
@ -96,7 +96,7 @@ define-command -hidden modeline-parse-impl %{
|
||||||
# [text]{white}{vi:|vim:|Vim:|ex:}[white]se[t] {options}:[text]
|
# [text]{white}{vi:|vim:|Vim:|ex:}[white]se[t] {options}:[text]
|
||||||
define-command modeline-parse -docstring "Read and interpret vi-format modelines at the beginning/end of the buffer" %{
|
define-command modeline-parse -docstring "Read and interpret vi-format modelines at the beginning/end of the buffer" %{
|
||||||
try %{ evaluate-commands -draft %{
|
try %{ evaluate-commands -draft %{
|
||||||
execute-keys <percent> s\A|.\z<ret> %opt{modelines}k <a-x> %opt{modelines}X \
|
execute-keys <percent> "s(?S)\A(.+\n){,%opt{modelines}}|(.+\n){,%opt{modelines}}\z<ret>" \
|
||||||
s^\S*?\s+?(vim?|kak(oune)?):\s?[^\n]+<ret> <a-x>
|
s^\S*?\s+?(vim?|kak(oune)?):\s?[^\n]+<ret> <a-x>
|
||||||
evaluate-commands -draft -itersel modeline-parse-impl
|
evaluate-commands -draft -itersel modeline-parse-impl
|
||||||
} }
|
} }
|
||||||
|
|
Loading…
Reference in New Issue
Block a user