aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--helix-core/src/state.rs6
-rw-r--r--helix-term/src/editor.rs7
-rw-r--r--helix-term/test.txt3
3 files changed, 15 insertions, 1 deletions
diff --git a/helix-core/src/state.rs b/helix-core/src/state.rs
index 05380d5e..8ebf3887 100644
--- a/helix-core/src/state.rs
+++ b/helix-core/src/state.rs
@@ -117,6 +117,12 @@ impl State {
Selection::new(ranges.collect(), sel.primary_index)
// TODO: update selection in state via transaction
}
+
+ pub fn file(&self) -> &Rope {
+ // used to access file contents for rendering to screen
+ let copy = &self.doc.contents;
+ copy
+ }
}
/// Coordinates are a 0-indexed line and column pair.
diff --git a/helix-term/src/editor.rs b/helix-term/src/editor.rs
index 1007dc36..3df84d6e 100644
--- a/helix-term/src/editor.rs
+++ b/helix-term/src/editor.rs
@@ -2,7 +2,8 @@ use crossterm::{
cursor,
cursor::position,
event::{self, read, Event, EventStream, KeyCode, KeyEvent},
- execute, queue, style,
+ execute, queue,
+ style::Print,
terminal::{self, disable_raw_mode, enable_raw_mode},
};
use futures::{future::FutureExt, select, StreamExt};
@@ -39,6 +40,10 @@ impl Editor {
fn render(&self) {
// TODO:
+ match &self.state {
+ Some(s) => execute!(stdout(), cursor::MoveTo(0, 0), Print(s.file())).unwrap(),
+ None => (),
+ }
}
pub async fn print_events(&mut self) {
diff --git a/helix-term/test.txt b/helix-term/test.txt
new file mode 100644
index 00000000..1802a747
--- /dev/null
+++ b/helix-term/test.txt
@@ -0,0 +1,3 @@
+aaa
+bbb
+ccc