on master help sign in
Cleanup
8098279Blaž Hrastnik
helix-core/src/state.rs+1−10
@@ -261,20 +261,11 @@ impl State {
261 granularity: Granularity,
261 granularity: Granularity,
262 count: usize,
262 count: usize,
263 ) -> Selection {
263 ) -> Selection {
264− // TODO: move all selections according to normal cursor move semantics by collapsing it
264+ // move all selections according to normal cursor move semantics by collapsing it
265 // into cursors and moving them vertically
265 // into cursors and moving them vertically
266
266
267 self.selection.transform(|range| {
267 self.selection.transform(|range| {
268− // let pos = if !range.is_empty() {
269− // // if selection already exists, bump it to the start or end of current select first
270− // if dir == Direction::Backward {
271− // range.from()
272− // } else {
273− // range.to()
274− // }
275− // } else {
276 let pos = self.move_pos(range.head, dir, granularity, count);
268 let pos = self.move_pos(range.head, dir, granularity, count);
277− // };
278 Range::new(pos, pos)
269 Range::new(pos, pos)
279 })
270 })
280 }
271 }
helix-core/src/transaction.rs+1−9
@@ -45,12 +45,7 @@ impl ChangeSet {
45 /// In other words, If `this` goes `docA` → `docB` and `other` represents `docB` → `docC`, the
45 /// In other words, If `this` goes `docA` → `docB` and `other` represents `docB` → `docC`, the
46 /// returned value will represent the change `docA` → `docC`.
46 /// returned value will represent the change `docA` → `docC`.
47 pub fn compose(self, other: ChangeSet) -> Result<Self, ()> {
47 pub fn compose(self, other: ChangeSet) -> Result<Self, ()> {
48− // TODO: len before should match len after
48+ // TODO: len before b should match len after a
49−
50− // if self.len != other.len {
51− // // length mismatch
52− // return Err(());
53− // }
54
49
55 let len = self.changes.len();
50 let len = self.changes.len();
56
51
@@ -335,9 +330,6 @@ impl ChangeSet {
335 }
330 }
336}
331}
337
332
338−// trait Transaction
339−// trait StrictTransaction
340−
341/// Transaction represents a single undoable unit of changes. Several changes can be grouped into
333/// Transaction represents a single undoable unit of changes. Several changes can be grouped into
342/// a single transaction.
334/// a single transaction.
343#[derive(Debug, Clone)]
335#[derive(Debug, Clone)]
helix-term/src/editor.rs+2−15
@@ -52,7 +52,6 @@ impl Editor {
52 size,
52 size,
53 surface: Surface::empty(area),
53 surface: Surface::empty(area),
54 cache: Surface::empty(area),
54 cache: Surface::empty(area),
55− // TODO; move to state
56 };
55 };
57
56
58 if let Some(file) = args.values_of_t::<PathBuf>("files").unwrap().pop() {
57 if let Some(file) = args.values_of_t::<PathBuf>("files").unwrap().pop() {
@@ -225,15 +224,7 @@ impl Editor {
225 // lavender
224 // lavender
226 }
225 }
227
226
228− // let lines = state
229− // .doc
230− // .lines_at(self.first_line as usize)
231− // .take(self.size.1 as usize)
232− // .map(|x| x.as_str().unwrap());
233−
234 // // iterate over selections and render them
227 // // iterate over selections and render them
235− // let select = Style::default().bg(tui::style::Color::LightBlue);
236− // let text = state.doc.slice(..);
237 // for range in state.selection.ranges() {
228 // for range in state.selection.ranges() {
238 // // get terminal coords for x,y for each range pos
229 // // get terminal coords for x,y for each range pos
239 // // TODO: this won't work with multiline
230 // // TODO: this won't work with multiline
@@ -246,8 +237,6 @@ impl Editor {
246 // (y2 - y1 + 1) as u16,
237 // (y2 - y1 + 1) as u16,
247 // );
238 // );
248 // self.surface.set_style(area, select);
239 // self.surface.set_style(area, select);
249−
250− // // TODO: don't highlight next char in append mode
251 // }
240 // }
252
241
253 // statusline
242 // statusline
@@ -330,13 +319,13 @@ impl Editor {
330 }
319 }
331
320
332 Some(Ok(Event::Key(event))) => {
321 Some(Ok(Event::Key(event))) => {
322+ // TODO: sequences (`gg`)
323+ // TODO: handle count other than 1
333 if let Some(view) = &mut self.view {
324 if let Some(view) = &mut self.view {
334 match view.state.mode() {
325 match view.state.mode() {
335 Mode::Insert => {
326 Mode::Insert => {
336− // TODO: handle modes and sequences (`gg`)
337 let keys = vec![event];
327 let keys = vec![event];
338 if let Some(command) = keymap[&Mode::Insert].get(&keys) {
328 if let Some(command) = keymap[&Mode::Insert].get(&keys) {
339− // TODO: handle count other than 1
340 command(view, 1);
329 command(view, 1);
341 } else if let KeyEvent {
330 } else if let KeyEvent {
342 code: KeyCode::Char(c),
331 code: KeyCode::Char(c),
@@ -350,10 +339,8 @@ impl Editor {
350 self.render();
339 self.render();
351 }
340 }
352 Mode::Normal => {
341 Mode::Normal => {
353− // TODO: handle modes and sequences (`gg`)
354 let keys = vec![event];
342 let keys = vec![event];
355 if let Some(command) = keymap[&Mode::Normal].get(&keys) {
343 if let Some(command) = keymap[&Mode::Normal].get(&keys) {
356− // TODO: handle count other than 1
357 command(view, 1);
344 command(view, 1);
358
345
359 // TODO: simplistic ensure cursor in view for now
346 // TODO: simplistic ensure cursor in view for now
helix-view/src/view.rs+1−1
@@ -25,7 +25,7 @@ impl View {
25 let view = Self {
25 let view = Self {
26 state,
26 state,
27 first_line: 0,
27 first_line: 0,
28− size, // TODO: pass in from term
28+ size,
29 theme,
29 theme,
30 history: History::default(),
30 history: History::default(),
31 };
31 };