modeline-parse: parse set and : correctly

When `set` or `se` is found at the start of the modeline, it should stop parsing options after `:`.

When `modeline-parse` is called in the following file, it should _not_ recognize `tabstop=4` and `invalid_option=3`.
```
# kak: set indentwidth=0 tabstop=16: tabstop=4 invalid_option=3
```

More info: http://vimdoc.sourceforge.net/htmldoc/options.html#modeline
This commit is contained in:
throwawayaccount12345-1 2021-12-31 11:02:15 -03:00 committed by GitHub
parent f68e8313b2
commit 74874aa4b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -88,7 +88,7 @@ define-command -hidden modeline-parse-impl %{
# More info: http://vimdoc.sourceforge.net/htmldoc/options.html#modeline # More info: http://vimdoc.sourceforge.net/htmldoc/options.html#modeline
printf %s "${kak_selection}" | sed \ printf %s "${kak_selection}" | sed \
-e 's/^[^:]\{1,\}://' \ -e 's/^[^:]\{1,\}://' \
-e 's/[ \t]*set\{0,1\}[ \t]//' \ -e 's/[ \t]*set\{0,1\}[ \t]\([^:]*\).*$/\1/' \
-e 's/:[^a-zA-Z0-9_=-]*$//' \ -e 's/:[^a-zA-Z0-9_=-]*$//' \
-e 's/:/ /g' \ -e 's/:/ /g' \
| tr ' ' '\n' \ | tr ' ' '\n' \