Implement screen clearing with Ctrl+l
This commit is contained in:
parent
0656f163fd
commit
df6aee4a49
@ -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+A : Jumps to the end of the line
|
||||||
* Ctrl+E : Jumps to the start of the line
|
* Ctrl+E : Jumps to the start of the line
|
||||||
* Ctrl+C : Clears the current line and starts a new one
|
* 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+P : Jump to the next word (kinda)
|
||||||
* Ctrl+O : Jump to the previous word (kinda)
|
* Ctrl+O : Jump to the previous word (kinda)
|
||||||
|
|
||||||
|
13
src/lib.rs
13
src/lib.rs
@ -522,13 +522,6 @@ pub mod shell {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
Key::Ctrl('x') => {
|
|
||||||
clear_line(&max_pos, ¤t_pos);
|
|
||||||
mycommand.clear();
|
|
||||||
current_pos = 0;
|
|
||||||
max_pos = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Key::Left => {
|
Key::Left => {
|
||||||
if current_pos > 0 {
|
if current_pos > 0 {
|
||||||
current_pos -= 1;
|
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') => {
|
Key::Ctrl('p') => {
|
||||||
let steps = find_next_space(¤t_pos, &max_pos, &mycommand);
|
let steps = find_next_space(¤t_pos, &max_pos, &mycommand);
|
||||||
//println!("steps: {:?} cur {:?} max {:?}", steps, current_pos, max_pos);
|
//println!("steps: {:?} cur {:?} max {:?}", steps, current_pos, max_pos);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user