1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-11-23 15:23:29 +03:00
kakoune/rc/tools
Aaron Bull Schaefer 3a401f0771 Trim whitespace from spell check word length variable
Due to ambiguity in the POSIX standard, GNU and BSD versions of the `wc`
utility use slightly different whitespace conventions when formatting
their output [1]. When limiting the output to just counting the number
of bytes (as is done by Kakoune when calculating the length of words
for spell check highlighting), the BSD version of `wc -c` has some
additional leading whitespace:

    gnu$ printf %s "test" | wc -c
    4
    bsd$ printf %s "test" | wc -c
           4

This leading whitespace needs to be removed before defining the "region"
to highlight, or `set-option` will not be able to parse the given
`spell_regions` and will complain that there are "not enough elements
in tuple." In other words, the region `1.21+8|Error` on Linux ends up
looking like `1.21+       8|Error` on macOS, which is invalid.

Removing the whitespace could be accomplished in a number of ways, but
using arithmetic expansion [2] is POSIX compliant and does not require
shelling out to another process.

[1]: https://unix.stackexchange.com/questions/205906/extra-space-with-counted-line-number
[2]: https://mywiki.wooledge.org/ArithmeticExpression
2019-06-02 20:23:42 -07:00
..
go Modified a bunch of language support files to use modules 2019-04-08 17:02:44 -07:00
python Merge remote-tracking branch 'laelath/provides-requires' 2019-04-25 11:59:42 +01:00
rust simplify rust completion to match generic Kakoune completions 2019-05-17 20:00:40 +03:00
autorestore.kak Added modules to extra files 2019-04-08 17:05:55 -07:00
autowrap.kak Add categories in rc/ 2019-03-21 01:06:16 +01:00
clang.kak Merge remote-tracking branch 'laelath/provides-requires' 2019-04-25 11:59:42 +01:00
comment.kak Add categories in rc/ 2019-03-21 01:06:16 +01:00
ctags.kak Automatic insert completion using ctags 2019-05-28 10:00:39 -04:00
doc.kak Add categories in rc/ 2019-03-21 01:06:16 +01:00
formatter.kak Add categories in rc/ 2019-03-21 01:06:16 +01:00
git.kak git.kak: support highlighting git log decorations 2019-05-23 12:42:38 +10:00
grep.kak Add categories in rc/ 2019-03-21 01:06:16 +01:00
lint.kak changes the name of a buffer being linted from /tmp/kak-lint.XXXXXX/buf.$extension to /tmp/kak-lint.XXXXXX/$filename. This allows the linter to compile Java files, which fail to compile if the Class name does not match the File name being linted. 2019-05-23 15:52:57 -04:00
make.kak Add categories in rc/ 2019-03-21 01:06:16 +01:00
man.kak Add categories in rc/ 2019-03-21 01:06:16 +01:00
spell.kak Trim whitespace from spell check word length variable 2019-06-02 20:23:42 -07:00