Remove CharKind::Newline
This is just a character, and so it seems clearer to refer to it specifically when we want to know if a character is a newline. There was only one case where we relied on Newline being different from Whitespace, and we special-cased that instance. Changing this actually makes us match the behavior of VS Code when double-clicking runs of multiple newlines. /cc @as-cii Co-Authored-By: Keith Simmons <keith@the-simmons.net>
This commit is contained in:
co-authored by
Keith Simmons
parent
baeb7d27b8
commit
210fa4c443
@@ -1407,7 +1407,7 @@ impl MultiBufferSnapshot {
|
||||
);
|
||||
|
||||
for ch in prev_chars {
|
||||
if Some(char_kind(ch)) == word_kind {
|
||||
if Some(char_kind(ch)) == word_kind && ch != '\n' {
|
||||
start -= ch.len_utf8();
|
||||
} else {
|
||||
break;
|
||||
@@ -1415,7 +1415,7 @@ impl MultiBufferSnapshot {
|
||||
}
|
||||
|
||||
for ch in next_chars {
|
||||
if Some(char_kind(ch)) == word_kind {
|
||||
if Some(char_kind(ch)) == word_kind && ch != '\n' {
|
||||
end += ch.len_utf8();
|
||||
} else {
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user