on master help sign in
Address some PR comments.
5ee6ba5Nathan Vegdahl
helix-core/src/textobject.rs+3−4
@@ -32,10 +32,9 @@ fn find_word_boundary(slice: RopeSlice, mut pos: usize, direction: Direction) ->
32 if category != prev_category && pos != 0 && pos != slice.len_chars() {
32 if category != prev_category && pos != 0 && pos != slice.len_chars() {
33 return pos;
33 return pos;
34 } else {
34 } else {
35+ match direction {
35− if direction == Direction::Forward {
36+ Direction::Forward => pos += 1,
36− pos += 1;
37− } else {
38− pos = pos.saturating_sub(1);
37+ Direction::Backward => pos = pos.saturating_sub(1),
39 }
38 }
40 prev_category = category;
39 prev_category = category;
41 }
40 }
helix-view/src/view.rs+4−4
@@ -92,17 +92,17 @@ impl View {
92 let line = pos.row;
92 let line = pos.row;
93 let col = pos.col;
93 let col = pos.col;
94 let height = self.area.height.saturating_sub(1); // - 1 for statusline
94 let height = self.area.height.saturating_sub(1); // - 1 for statusline
95− let last_line = self.first_line + height as usize;
95+ let last_line = (self.first_line + height as usize).saturating_sub(1);
96
96
97 let scrolloff = PADDING.min(self.area.height as usize / 2); // TODO: user pref
97 let scrolloff = PADDING.min(self.area.height as usize / 2); // TODO: user pref
98
98
99 // TODO: not ideal
99 // TODO: not ideal
100 const OFFSET: usize = 7; // 1 diagnostic + 5 linenr + 1 gutter
100 const OFFSET: usize = 7; // 1 diagnostic + 5 linenr + 1 gutter
101− let last_col = self.first_col + (self.area.width as usize - OFFSET);
101+ let last_col = (self.first_col + self.area.width as usize).saturating_sub(OFFSET + 1);
102
102
103− if line > last_line.saturating_sub(scrolloff + 1) {
103+ if line > last_line.saturating_sub(scrolloff) {
104 // scroll down
104 // scroll down
105− self.first_line += line - (last_line.saturating_sub(scrolloff + 1));
105+ self.first_line += line - (last_line.saturating_sub(scrolloff));
106 } else if line < self.first_line + scrolloff {
106 } else if line < self.first_line + scrolloff {
107 // scroll up
107 // scroll up
108 self.first_line = line.saturating_sub(scrolloff);
108 self.first_line = line.saturating_sub(scrolloff);