@@ -120,76 +120,84 @@ impl State {
123− pub fn move_next_word_start(slice: RopeSlice, mut pos: usize) -> usize {
123+ pub fn move_next_word_start(slice: RopeSlice, mut pos: usize, count: usize) -> usize {
124 // TODO: confirm it's fine without using graphemes, I think it should be
124 // TODO: confirm it's fine without using graphemes, I think it should be
125− let ch = slice.char(pos);
126+ let ch = slice.char(pos);
126− let next = slice.char(pos.saturating_add(1));
127+ let next = slice.char(pos.saturating_add(1));
127− if categorize(ch) != categorize(next) {
128+ if categorize(ch) != categorize(next) {
128− pos += 1;
129+ pos += 1;
131− // refetch
132+ // refetch
132− let ch = slice.char(pos);
133+ let ch = slice.char(pos);
134− if is_word(ch) {
135+ if is_word(ch) {
135− skip_over_next(slice, &mut pos, is_word);
136+ skip_over_next(slice, &mut pos, is_word);
136− } else if ch.is_ascii_punctuation() {
137+ } else if ch.is_ascii_punctuation() {
137− skip_over_next(slice, &mut pos, |ch| ch.is_ascii_punctuation());
138+ skip_over_next(slice, &mut pos, |ch| ch.is_ascii_punctuation());
140− // TODO: don't include newline?
141+ // TODO: don't include newline?
141− skip_over_next(slice, &mut pos, |ch| ch.is_ascii_whitespace());
142+ skip_over_next(slice, &mut pos, |ch| ch.is_ascii_whitespace());
146− pub fn move_prev_word_start(slice: RopeSlice, mut pos: usize) -> usize {
148+ pub fn move_prev_word_start(slice: RopeSlice, mut pos: usize, count: usize) -> usize {
147 // TODO: confirm it's fine without using graphemes, I think it should be
149 // TODO: confirm it's fine without using graphemes, I think it should be
148− let ch = slice.char(pos);
151+ let ch = slice.char(pos);
149− let prev = slice.char(pos.saturating_sub(1)); // TODO: just return original pos if at start
152+ let prev = slice.char(pos.saturating_sub(1)); // TODO: just return original pos if at start
151− if categorize(ch) != categorize(prev) {
154+ if categorize(ch) != categorize(prev) {
152− pos -= 1;
155+ pos -= 1;
155− // TODO: skip while eol
158+ // TODO: skip while eol
157− // TODO: don't include newline?
160+ // TODO: don't include newline?
158− skip_over_prev(slice, &mut pos, |ch| ch.is_ascii_whitespace());
161+ skip_over_prev(slice, &mut pos, |ch| ch.is_ascii_whitespace());
160− // refetch
163+ // refetch
161− let ch = slice.char(pos);
164+ let ch = slice.char(pos);
163− if is_word(ch) {
166+ if is_word(ch) {
164− skip_over_prev(slice, &mut pos, is_word);
167+ skip_over_prev(slice, &mut pos, is_word);
165− } else if ch.is_ascii_punctuation() {
168+ } else if ch.is_ascii_punctuation() {
166− skip_over_prev(slice, &mut pos, |ch| ch.is_ascii_punctuation());
169+ skip_over_prev(slice, &mut pos, |ch| ch.is_ascii_punctuation());
171+ pos = pos.saturating_add(1)
169− pos.saturating_add(1)
174+ pos
172− pub fn move_next_word_end(slice: RopeSlice, mut pos: usize, _count: usize) -> usize {
177+ pub fn move_next_word_end(slice: RopeSlice, mut pos: usize, count: usize) -> usize {
173− // TODO: confirm it's fine without using graphemes, I think it should be
179+ // TODO: confirm it's fine without using graphemes, I think it should be
174− let ch = slice.char(pos);
180+ let ch = slice.char(pos);
175− let next = slice.char(pos.saturating_add(1));
181+ let next = slice.char(pos.saturating_add(1));
176− if categorize(ch) != categorize(next) {
182+ if categorize(ch) != categorize(next) {
177− pos += 1;
183+ pos += 1;
180− // TODO: don't include newline?
186+ // TODO: don't include newline?
181− skip_over_next(slice, &mut pos, |ch| ch.is_ascii_whitespace());
187+ skip_over_next(slice, &mut pos, |ch| ch.is_ascii_whitespace());
183− // refetch
189+ // refetch
184− let ch = slice.char(pos);
190+ let ch = slice.char(pos);
186− if is_word(ch) {
192+ if is_word(ch) {
187− skip_over_next(slice, &mut pos, is_word);
193+ skip_over_next(slice, &mut pos, is_word);
188− } else if ch.is_ascii_punctuation() {
194+ } else if ch.is_ascii_punctuation() {
189− skip_over_next(slice, &mut pos, |ch| ch.is_ascii_punctuation());
195+ skip_over_next(slice, &mut pos, |ch| ch.is_ascii_punctuation());
197+ pos = pos.saturating_sub(1)
192− pos.saturating_sub(1)
200+ pos
195 pub fn move_selection(
203 pub fn move_selection(