Skip to content

Commit

Permalink
to_string to output
Browse files Browse the repository at this point in the history
  • Loading branch information
ynqa committed Oct 8, 2023
1 parent c66427c commit ba2e785
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ pub trait Editor {
fn gen_pane(&self, width: u16) -> Pane;
fn handle_event(&mut self, event: &Event);
fn reset(&mut self);
fn to_string(&self) -> String;
fn output(&self) -> String;
}
2 changes: 1 addition & 1 deletion src/editor/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl Editor for Text {

fn reset(&mut self) {}

fn to_string(&self) -> String {
fn output(&self) -> String {
self.text.to_string()
}
}
2 changes: 1 addition & 1 deletion src/editor/text_editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl Editor for TextEditor {
self.textbuffer = TextBuffer::default();
}

fn to_string(&self) -> String {
fn output(&self) -> String {
self.textbuffer.to_string()
}
}
6 changes: 1 addition & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,7 @@ impl Prompt {
}
}

let ret = self
.editors
.iter()
.map(|editor| editor.to_string())
.collect();
let ret = self.editors.iter().map(|editor| editor.output()).collect();
self.editors.iter_mut().for_each(|editor| {
editor.reset();
});
Expand Down

0 comments on commit ba2e785

Please sign in to comment.