As well as ordinary `//` line-comments, Rust regards `///` comments
as documentation applying to the following item, and `//!` comments as
documentation applying to the enclosing item, so we should copy those
to new lines, too.
* move most of the kakoune implementation outside of the shell scope
to avoid unnecessary escaping
* let kakoune do the option expansions to avoid injection of special
characters
* split block commenting options into two and do the < to <lt>
conversion directly
* show error messages directly in the buffer rather than in *debug*
Fixes#1600 and #875
That means we can now have highlighters active at global, buffer, and
window scope. The add-highlighter and remove-highlighter syntax changed
to take the parent path (scope/group/...) as a mandatory argument,
superseeding the previous -group switch.
boost regex tolerates non-escaped special characters, and escaped
non-special characters. Standardize on stricter syntax, where
special characters must be escaped, and non-special characters must
not.
this uses 'export' to set $TMPDIR instead; fish provides an 'export'
function for bash-compatibility, so this should work for both shells.
note that prior to this change, opening new panes with fish did not
work, as fish does not support `FOO=1 bar` syntax.
- the file was edited with a different editor/program or
- kak didn't restore a backup or
- if old backups weren't purged or
- if autorestore wasn't loaded (e.g. `kak -n`) after backups were generated.
Sometimes the implementation of `man` will display errors, e.g.
```
<standard input>:4808: warning [p 54, 13.2i]: can't break line
```
Those errors are harmless but are still reported on the debug buffer,
so we hide them by redirecting the standard error stream to /dev/null.
When using the `man` filetype to make use of the text highlighters
of the `man.kak` script, the documentation pages inherit from the
window resizing hooks that won't work on `doc` buffers.
Fixes#1591
Highlighting perl regex patterns with regular expressions (with
highlighters) caused several misses that made most of the file
unreadable. This commit makes `perl.kak` not try to highlight
those patterns in the code, and also addresses issues with string
highlighting.
Import keywords are put in keyword face instead of meta face.
This leaves room for pragmas and macros to be in the meta face.
Operator keywords are put in keyword face too.
Finally, expression keywords are put in face attribute.
Previously, if you opened a new line after an underlined heading (what
the CommonMark spec calls a "Setext heading") or inserted a newline into
a line that started with `**strong emphasis**` the Markdown autoindent
hook would assume the leading symbols were list bullets and paste them
at the beginning of the new line.
However, the CommonMark specification says that list bullets must be
followed by at least one horizontal whitespace character, so Setext
heading underlines and strong emphasis are not valid list bullets and
should not be matched by the autoindent pattern.
This commit changes the regex that selects the pastable prefix of the
previous line so that it must match either:
- One or more `>` characters with optional whitespace between them
(a blockquote prefix), optionally followed by a list bullet; or
- An optional blockquote prefix and a list bullet
Since we don't strictly need either the blockquote prefix nor the list
bullet, we could concievably just make both optional... but for lines
without either, the regex would find a zero-length match, and for the
purposes of copy/paste Kakoune treats that as a one-character match.
Therefore, the regex is written to fail if neither pattern is found.
When used just after grepping, grep-next-match ended up jumping to
the second match, as `0g` is the same as `g`.
The fix itself is pretty ugly, a better one might be to distinguish
the `0` count from no count given, so that `0g` could fail with
"no such line" or similar.
Looking up the man page for `index` was failing on systems using
GNU/coreutils. The `:man` command matched whatever page it was given with
the `expr` utility. This tool behaves as expected when it follows strictly
the POSIX standard but the GNU implementation introduces additional commands
(including `index`), about which the standard states:
```
The use of string arguments length, substr, index, or match produces unspecified results.
```
As a result, parsing the man page number is now implemented with pure
shell expansions, to avoid triggering an undefined behavior when the topic
searched is one of the keywords above.
The previous implementation used to replace the contents of the buffer with
whatever the `formatcmd` was returning, regardless of the exit code of the
command, which led to the buffer being wiped out on error.
This commit does the formatting in a temporary file, and only replaces the
current buffer with the contents of the -formatted- temporary file if the
`formatcmd` returned successfully.
Fixes#1357
this uses the string opening regex from the c-family highlighter to prevent
highlighting the rest of the file as a string on encountering the character
literal '"'