Merge branch 'main' into vim-softwrap-word

This commit is contained in:
Conrad Irwin 2023-09-01 11:05:12 -07:00
commit aa7b65bbaf
111 changed files with 4173 additions and 1585 deletions

View file

@ -89,22 +89,21 @@ fn expand_changed_word_selection(
ignore_punctuation: bool,
) -> bool {
if times.is_none() || times.unwrap() == 1 {
let language = map
let scope = map
.buffer_snapshot
.language_at(selection.start.to_point(map));
.language_scope_at(selection.start.to_point(map));
let in_word = map
.chars_at(selection.head())
.next()
.map(|(c, _)| char_kind(language, c) != CharKind::Whitespace)
.map(|(c, _)| char_kind(&scope, c) != CharKind::Whitespace)
.unwrap_or_default();
if in_word {
selection.end =
movement::find_boundary(map, selection.end, FindRange::MultiLine, |left, right| {
let left_kind =
char_kind(language, left).coerce_punctuation(ignore_punctuation);
let left_kind = char_kind(&scope, left).coerce_punctuation(ignore_punctuation);
let right_kind =
char_kind(language, right).coerce_punctuation(ignore_punctuation);
char_kind(&scope, right).coerce_punctuation(ignore_punctuation);
left_kind != right_kind && left_kind != CharKind::Whitespace
});