Commit Graph

12 Commits

Author SHA1 Message Date
Maxime Coste
c99731ebf1 Use stderr/fail to return errors in modeline.kak 2020-12-20 11:30:32 +11:00
Frank LENORMAND
4025ac8167 rc modeline: Print the final command directly 2020-09-18 15:12:13 +03:00
Frank LENORMAND
2a51ebf105 rc modeline: Factorise the use of kakquote 2020-09-18 15:12:13 +03:00
Frank LENORMAND
2d78b0760d rc modeline: Error out on unsupported formats
This commit makes `:modeline-parse` grab all lines that look like
modelines, and lets the parser deal with invalid formats.

This allows actually printing an error on unsupported modelines
formats, instead of ignoring them upfront.
2020-09-18 14:54:57 +03:00
Frank LENORMAND
30ee97386d rc modeline: Use more idiomatic shell 2020-09-18 14:54:57 +03:00
Frank LENORMAND
7731fe4cb2 rc modeline: Print error messages correctly 2020-09-18 09:01:32 +03:00
Frank LENORMAND
6976b1dce4 rc modeline: Prevent command execution
This commit prevents specially crafted modelines from making the
editor execute arbitrary Kakoune commands.

By using a tabulation character as a separator, commands can be
injected in the value of the options listed in the modeline. For
example:

	# kak: tabstop=2;set-option	buffer	pwned	yes

Fixes #3735.
2020-09-18 09:01:32 +03:00
Frank LENORMAND
95c095f3fb 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.
2020-09-16 11:00:15 +03:00
Johannes Altmanninger
9a7d8df447 Avoid accidentally using environment variables in sh scopes
On the instances with altfile this was already the case, but this makes it more obvious.

Closes #3673
2020-08-24 19:01:05 +02:00
Frank LENORMAND
24c5169400 src: Introduce a <percent> named key
Similarly to the <semicolon> key, make it easier to write
`:execute-keys` commands by replacing <percent> with `%`.

Highlighters can keep escaping the sign when regular expressions are
not quoted, but built-in scripts that use `%` as an editing primitive
have been modified to use the named key, for clarity.
2020-06-03 15:42:38 +03:00
Frank LENORMAND
a7bf625236 rc modeline: Support spelling language options 2019-11-08 17:56:36 +01:00
Alex Leferry 2
c0dccdd90d Add categories in rc/
Closes #2783
2019-03-21 01:06:16 +01:00