Avoid wrapping between punctuation and word

Fixes #1550
This commit is contained in:
Maxime Coste 2017-09-18 09:52:24 +09:00
parent 37589fb7b4
commit d5c10472f6
5 changed files with 10 additions and 1 deletions

View File

@ -835,7 +835,7 @@ struct WrapHighlighter : Highlighter
{ {
StringView line = buffer[coord.line]; StringView line = buffer[coord.line];
utf8::iterator<const char*> it{&line[col], line}; utf8::iterator<const char*> it{&line[col], line};
while (it != line.end() and it != line.begin() and is_word(*it)) while (it != line.end() and it != line.begin() and is_word<WORD>(*it))
--it; --it;
if (it != line.begin() and it != &line[col] and if (it != line.begin() and it != &line[col] and

View File

@ -0,0 +1 @@

View File

@ -0,0 +1,6 @@
{ "jsonrpc": "2.0", "method": "draw", "params": [[[{ "face": { "fg": "black", "bg": "white", "attributes": [] }, "contents": "T" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "his is a long paragraph where we will see if the wrap highlighter tries to " }], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "\"Wrap\" between the quotes and the word.\u000a" }]], { "fg": "default", "bg": "default", "attributes": [] }, { "fg": "blue", "bg": "default", "attributes": [] }] }
{ "jsonrpc": "2.0", "method": "menu_hide", "params": [] }
{ "jsonrpc": "2.0", "method": "info_hide", "params": [] }
{ "jsonrpc": "2.0", "method": "draw_status", "params": [[], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "out 1:1 " }, { "face": { "fg": "black", "bg": "yellow", "attributes": [] }, "contents": "" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": " " }, { "face": { "fg": "blue", "bg": "default", "attributes": [] }, "contents": "1 sel" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": " - unnamed0@[kak-tests]" }], { "fg": "cyan", "bg": "default", "attributes": [] }] }
{ "jsonrpc": "2.0", "method": "set_cursor", "params": ["buffer", { "line": 0, "column": 0 }] }
{ "jsonrpc": "2.0", "method": "refresh", "params": [true] }

View File

@ -0,0 +1 @@
This is a long paragraph where we will see if the wrap highlighter tries to "Wrap" between the quotes and the word.

View File

@ -0,0 +1 @@
add-highlighter wrap -word