Commit Graph

16 Commits

Author SHA1 Message Date
Maxime Coste
0b56c777c0 Merge remote-tracking branch 'lenormf/fix-spell-next' 2020-05-30 09:22:06 +10:00
Maxime Coste
08e0b663f7 Fix unintended interpretation of ranges length syntax
Ranges specified with a +<length> were inconsistent, with +0 meaning
an empty range, while +1 meant a two character long range (first character
+ the following one). Change that to mean a single character.

Fixes #3479
2020-05-29 12:25:57 +10:00
Frank LENORMAND
05db1e8697 rc spell: Make :spell-next wrap around the buffer 2020-05-15 18:37:03 +03:00
Frank LENORMAND
4eac927a01 rc spell: Rewrite :spell-next in Awk 2020-05-15 12:59:30 +03:00
Frank LENORMAND
e9e15e6a44 rc spell: Simplify selection-descriptions parsing
Remove everything after the first pipe sign. Pop the timestamp.
2020-05-15 12:21:02 +03:00
Frank LENORMAND
7db9062122 rc spell: Don't use expr to format-check
The regular pattern based on `printf`/`grep` is cleaner and less
error prone.
2020-05-15 12:19:29 +03:00
Frank LENORMAND
9bc6bddcac
rc spell: Fix off-by-one highlighting glitch 2020-05-07 10:40:25 +00:00
Jan-Jaap Korpershoek
063a702bf4 Add error handling
Rewrite line by line to make escaping easier
2020-04-27 12:28:29 +02:00
Jan-Jaap Korpershoek
246735520f Add spell-add command 2020-04-27 11:57:14 +02:00
codesoap
94cdd3f9e3 rc spell: Avoid C-style comments in awk 2020-03-22 08:13:30 +01:00
Frank LENORMAND
e83ad2a2a4 rc spell: Re-implement message processing in Awk
Plain shell takes too long on large files.

Fixes #3399
2020-03-09 14:22:34 +03:00
Frank LENORMAND
90ba4d0903 rc spell: Handle errors returned on the first line
The first line returned by `aspell` isn't always an identification
string, it can also be an error.

This commit prevents the first line from being ignored in any case,
and allows errors to be reported consistently.

Related to #3330
2020-02-01 16:04:58 +01:00
Frank LENORMAND
5b1f9255a1 rc: Use the standard fail command to report errors
Merely using `echo` with markup doesn't log errors in the debug
buffers, and is also less readable.
2019-11-14 08:32:55 +01:00
Frank LENORMAND
be8d0e6726 rc spell: Allow storing a language in an option
This commit adds a `spell_lang` option that will be used by the
`spell` command when no language is passed to it directly.

Setting a buffer/window local option allows using `:spell` seamlessly
across several buffers, written in different languages.
2019-11-08 12:44:55 +01:00
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
Alex Leferry 2
c0dccdd90d Add categories in rc/
Closes #2783
2019-03-21 01:06:16 +01:00