on master help sign in
Cleanup
commit809827967687ea7e6b645e7a9a60f9c523250578 authorBlaž Hrastnik <blaz@mxxn.io> dateTue 6 Oct 2020, 18:59 (6 years ago) parent1dba0f2
4 files changed+5−35
helix-core/src/state.rs+1−10 helix-core/src/transaction.rs+1−9 helix-term/src/editor.rs+2−15 helix-view/src/view.rs+1−1
helix-core/src/state.rs+1−10
@@ -261,20 +261,11 @@ impl State {
261261 granularity: Granularity,
262262 count: usize,
263263 ) -> 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
265265 // into cursors and moving them vertically
266266
267267 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 {
276268 let pos = self.move_pos(range.head, dir, granularity, count);
277− // };
278269 Range::new(pos, pos)
279270 })
280271 }
helix-core/src/transaction.rs+1−9
@@ -45,12 +45,7 @@ impl ChangeSet {
4545 /// In other words, If `this` goes `docA` → `docB` and `other` represents `docB` → `docC`, the
4646 /// returned value will represent the change `docA` → `docC`.
4747 pub fn compose(self, other: ChangeSet) -> Result<Self, ()> {
48− // TODO: len before should match len after
49−
50− // if self.len != other.len {
51− // // length mismatch
52− // return Err(());
53− // }
48+ // TODO: len before b should match len after a
5449
5550 let len = self.changes.len();
5651
@@ -335,9 +330,6 @@ impl ChangeSet {
335330 }
336331}
337332
338−// trait Transaction
339−// trait StrictTransaction
340−
341333/// Transaction represents a single undoable unit of changes. Several changes can be grouped into
342334/// a single transaction.
343335#[derive(Debug, Clone)]
helix-term/src/editor.rs+2−15
@@ -52,7 +52,6 @@ impl Editor {
5252 size,
5353 surface: Surface::empty(area),
5454 cache: Surface::empty(area),
55− // TODO; move to state
5655 };
5756
5857 if let Some(file) = args.values_of_t::<PathBuf>("files").unwrap().pop() {
@@ -225,15 +224,7 @@ impl Editor {
225224 // lavender
226225 }
227226
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−
234227 // // iterate over selections and render them
235− // let select = Style::default().bg(tui::style::Color::LightBlue);
236− // let text = state.doc.slice(..);
237228 // for range in state.selection.ranges() {
238229 // // get terminal coords for x,y for each range pos
239230 // // TODO: this won't work with multiline
@@ -246,8 +237,6 @@ impl Editor {
246237 // (y2 - y1 + 1) as u16,
247238 // );
248239 // self.surface.set_style(area, select);
249−
250− // // TODO: don't highlight next char in append mode
251240 // }
252241
253242 // statusline
@@ -330,13 +319,13 @@ impl Editor {
330319 }
331320
332321 Some(Ok(Event::Key(event))) => {
322+ // TODO: sequences (`gg`)
323+ // TODO: handle count other than 1
333324 if let Some(view) = &mut self.view {
334325 match view.state.mode() {
335326 Mode::Insert => {
336− // TODO: handle modes and sequences (`gg`)
337327 let keys = vec![event];
338328 if let Some(command) = keymap[&Mode::Insert].get(&keys) {
339− // TODO: handle count other than 1
340329 command(view, 1);
341330 } else if let KeyEvent {
342331 code: KeyCode::Char(c),
@@ -350,10 +339,8 @@ impl Editor {
350339 self.render();
351340 }
352341 Mode::Normal => {
353− // TODO: handle modes and sequences (`gg`)
354342 let keys = vec![event];
355343 if let Some(command) = keymap[&Mode::Normal].get(&keys) {
356− // TODO: handle count other than 1
357344 command(view, 1);
358345
359346 // TODO: simplistic ensure cursor in view for now
helix-view/src/view.rs+1−1
@@ -25,7 +25,7 @@ impl View {
2525 let view = Self {
2626 state,
2727 first_line: 0,
28− size, // TODO: pass in from term
28+ size,
2929 theme,
3030 history: History::default(),
3131 };