mirror of
https://github.com/ilyakooo0/helix.git
synced 2024-09-11 16:07:00 +03:00
added file rendering
This commit is contained in:
parent
8119f1ec3d
commit
8958f06f08
@ -117,6 +117,12 @@ pub fn extend_selection(
|
||||
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.
|
||||
|
@ -2,7 +2,8 @@
|
||||
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 @@ pub fn open(&mut self, path: PathBuf) -> Result<(), Error> {
|
||||
|
||||
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) {
|
||||
|
3
helix-term/test.txt
Normal file
3
helix-term/test.txt
Normal file
@ -0,0 +1,3 @@
|
||||
aaa
|
||||
bbb
|
||||
ccc
|
Loading…
Reference in New Issue
Block a user