@@ -10,7 +10,7 @@ use crate::surround;
10use crate::syntax::LanguageConfiguration;
10use crate::syntax::LanguageConfiguration;
11use crate::Range;
11use crate::Range;
13−fn find_word_boundary(slice: RopeSlice, mut pos: usize, direction: Direction) -> usize {
13+fn find_word_boundary(slice: RopeSlice, mut pos: usize, direction: Direction, long: bool) -> usize {
14 use CharCategory::{Eol, Whitespace};
14 use CharCategory::{Eol, Whitespace};
16 let iter = match direction {
16 let iter = match direction {
@@ -33,7 +33,7 @@ fn find_word_boundary(slice: RopeSlice, mut pos: usize, direction: Direction) ->
33 match categorize_char(ch) {
33 match categorize_char(ch) {
34 Eol | Whitespace => return pos,
34 Eol | Whitespace => return pos,
35 category => {
35 category => {
36− if category != prev_category && pos != 0 && pos != slice.len_chars() {
36+ if !long && category != prev_category && pos != 0 && pos != slice.len_chars() {
37 return pos;
37 return pos;
39 match direction {
39 match direction {
@@ -70,13 +70,14 @@ pub fn textobject_word(
70 range: Range,
70 range: Range,
71 textobject: TextObject,
71 textobject: TextObject,
72 _count: usize,
72 _count: usize,
73) -> Range {
74) -> Range {
74 let pos = range.cursor(slice);
75 let pos = range.cursor(slice);
76− let word_start = find_word_boundary(slice, pos, Direction::Backward);
77+ let word_start = find_word_boundary(slice, pos, Direction::Backward, long);
77 let word_end = match slice.get_char(pos).map(categorize_char) {
78 let word_end = match slice.get_char(pos).map(categorize_char) {
78 None | Some(CharCategory::Whitespace | CharCategory::Eol) => pos,
79 None | Some(CharCategory::Whitespace | CharCategory::Eol) => pos,
79− _ => find_word_boundary(slice, pos + 1, Direction::Forward),
80+ _ => find_word_boundary(slice, pos + 1, Direction::Forward, long),
82 // Special case.
83 // Special case.
@@ -268,7 +269,7 @@ mod test {
268 let slice = doc.slice(..);
269 let slice = doc.slice(..);
269 for &case in scenario {
270 for &case in scenario {
270 let (pos, objtype, expected_range) = case;
271 let (pos, objtype, expected_range) = case;
271− let result = textobject_word(slice, Range::point(pos), objtype, 1);
272+ let result = textobject_word(slice, Range::point(pos), objtype, 1, false);
272 assert_eq!(
273 assert_eq!(
274 expected_range.into(),
275 expected_range.into(),