Code format cleanup
This commit is contained in:
parent
dcd0c3bec1
commit
3ae040f1fc
@ -158,7 +158,7 @@ impl Editor {
|
|||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
// Match escape sequence
|
// Match escape sequence
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
let mut seq = [0;4];
|
let mut seq = [0; 4];
|
||||||
br.read_exact(&mut seq);
|
br.read_exact(&mut seq);
|
||||||
let seq_str = String::from_utf8(seq.to_vec());
|
let seq_str = String::from_utf8(seq.to_vec());
|
||||||
|
|
||||||
@ -278,7 +278,11 @@ impl Editor {
|
|||||||
// Input
|
// Input
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
fn prompt(&mut self, prompt: &str, cb: Option<&mut dyn Fn(&mut Self, &str, EditorKey<char>)>) -> String {
|
fn prompt(
|
||||||
|
&mut self,
|
||||||
|
prompt: &str,
|
||||||
|
cb: Option<&mut dyn Fn(&mut Self, &str, EditorKey<char>)>,
|
||||||
|
) -> String {
|
||||||
let mut buffer = String::new();
|
let mut buffer = String::new();
|
||||||
let default_cb = &mut Self::_noop_prompt_cb;
|
let default_cb = &mut Self::_noop_prompt_cb;
|
||||||
|
|
||||||
@ -298,10 +302,10 @@ impl Editor {
|
|||||||
match char {
|
match char {
|
||||||
Backspace => {
|
Backspace => {
|
||||||
buffer.pop();
|
buffer.pop();
|
||||||
},
|
}
|
||||||
DeleteKey => {
|
DeleteKey => {
|
||||||
buffer.pop();
|
buffer.pop();
|
||||||
},
|
}
|
||||||
Escape => {
|
Escape => {
|
||||||
self.set_status_message("");
|
self.set_status_message("");
|
||||||
cb(self, &String::from(""), char);
|
cb(self, &String::from(""), char);
|
||||||
@ -683,7 +687,7 @@ impl Editor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn row_rx_to_cx(&mut self, index: usize, rx: usize) -> usize {
|
fn row_rx_to_cx(&mut self, index: usize, rx: usize) -> usize {
|
||||||
let mut current_rx:usize = 0;
|
let mut current_rx: usize = 0;
|
||||||
let mut cx: usize = 0;
|
let mut cx: usize = 0;
|
||||||
let row = &mut self.rows[index];
|
let row = &mut self.rows[index];
|
||||||
|
|
||||||
@ -870,7 +874,7 @@ impl Editor {
|
|||||||
self.filename = self.prompt("Save as (ESC to cancel):", None);
|
self.filename = self.prompt("Save as (ESC to cancel):", None);
|
||||||
if self.filename.len() == 0 {
|
if self.filename.len() == 0 {
|
||||||
self.set_status_message("Save aborted");
|
self.set_status_message("Save aborted");
|
||||||
return Ok(())
|
return Ok(());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user