on master help sign in
Support entering newlines.
commiteb6b9a9ca958b0141a4cf6cc4dc59781e905fcc7 authorBlaž Hrastnik <blaz@mxxn.io> dateSun 13 Sep 2020, 19:23 (6 years ago) parent22cb7b3
1 file changed+5−18
helix-term/src/editor.rs+5−18
helix-term/src/editor.rs+5−18
@@ -185,23 +185,6 @@ impl Editor {
185185 // .take(self.size.1 as usize)
186186 // .map(|x| x.as_str().unwrap());
187187
188− // for (n, line) in lines.enumerate() {
189− // execute!(
190− // stdout,
191− // SetForegroundColor(Color::DarkCyan),
192− // cursor::MoveTo(0, n as u16),
193− // Print((n + 1).to_string())
194− // );
195−
196− // surface.set_string(2, n as u16, line, Style::default());
197− // // execute!(
198− // // stdout,
199− // // SetForegroundColor(Color::Reset),
200− // // cursor::MoveTo(2, n as u16),
201− // // Print(line)
202− // // );
203− // }
204−
205188 // // iterate over selections and render them
206189 // let select = Style::default().bg(tui::style::Color::LightBlue);
207190 // let text = state.doc.slice(..);
@@ -234,7 +217,7 @@ impl Editor {
234217 // );
235218
236219 use tui::backend::Backend;
237− // // TODO: double buffer and diff here
220+
238221 self.terminal
239222 .backend_mut()
240223 .draw(self.surface.diff(&surface).into_iter());
@@ -296,6 +279,10 @@ impl Editor {
296279 code: KeyCode::Char(c),
297280 ..
298281 } => helix_core::commands::insert_char(state, c),
282+ KeyEvent {
283+ code: KeyCode::Enter,
284+ ..
285+ } => helix_core::commands::insert_char(state, '\n'),
299286 _ => (), // skip
300287 }
301288 self.render();