Implement screen clearing with Ctrl+l

This commit is contained in:
Justine Pelletreau 2023-02-24 12:17:04 +01:00
parent 0656f163fd
commit df6aee4a49
2 changed files with 7 additions and 7 deletions

View File

@ -32,6 +32,7 @@ Some shortcuts are built in. They may be unique to Sqish or be copied from Zsh f
* Ctrl+A : Jumps to the end of the line
* Ctrl+E : Jumps to the start of the line
* Ctrl+C : Clears the current line and starts a new one
* Ctrl+L : Clears the screen
* Ctrl+P : Jump to the next word (kinda)
* Ctrl+O : Jump to the previous word (kinda)

View File

@ -522,13 +522,6 @@ pub mod shell {
}
},
Key::Ctrl('x') => {
clear_line(&max_pos, &current_pos);
mycommand.clear();
current_pos = 0;
max_pos = 0;
}
Key::Left => {
if current_pos > 0 {
current_pos -= 1;
@ -543,6 +536,12 @@ pub mod shell {
}
},
Key::Ctrl('l') => {
write!(stdout, "{}{}", termion::clear::All, termion::cursor::Goto(1,1));
write!(stdout, "{}{}", conf.promptline, mycommand);
},
Key::Ctrl('p') => {
let steps = find_next_space(&current_pos, &max_pos, &mycommand);
//println!("steps: {:?} cur {:?} max {:?}", steps, current_pos, max_pos);