Fixed up/down arrows
This commit is contained in:
parent
c7e9309a34
commit
13a730eca1
@ -1,6 +1,9 @@
|
|||||||
# Sqish
|
# Sqish
|
||||||
Rust Shell. This is an attempt to create a simple shell in Rust, because why not.
|
Rust Shell. This is an attempt to create a simple shell in Rust, because why not.
|
||||||
|
|
||||||
|
TODO:
|
||||||
|
* Aliases don't currently handle arguments. My alias "vless" does not work with "vless lib.rs"
|
||||||
|
|
||||||
## sqishrc (Config)
|
## sqishrc (Config)
|
||||||
See the included sqishrc.yaml.example file included, and copy it as ~/.sqishrc.yaml
|
See the included sqishrc.yaml.example file included, and copy it as ~/.sqishrc.yaml
|
||||||
|
|
||||||
|
40
src/lib.rs
40
src/lib.rs
@ -425,27 +425,31 @@ pub mod shell {
|
|||||||
},
|
},
|
||||||
|
|
||||||
Key::Up => {
|
Key::Up => {
|
||||||
mycommand = delete_current_cmd(mycommand);
|
if current_number > 2 {
|
||||||
current_number -= 1;
|
mycommand = delete_current_cmd(mycommand);
|
||||||
let lastcmd = match get_hist_from_number(¤t_number) {
|
current_number -= 1;
|
||||||
Some(c) => c,
|
let lastcmd = match get_hist_from_number(¤t_number) {
|
||||||
None => continue
|
Some(c) => c,
|
||||||
};
|
None => continue
|
||||||
mycommand = lastcmd.trim().to_string();
|
};
|
||||||
(max_pos, current_pos) = get_cmd_curs_pos(&mycommand);
|
mycommand = lastcmd.trim().to_string();
|
||||||
write!(stdout, "{}", mycommand);
|
(max_pos, current_pos) = get_cmd_curs_pos(&mycommand);
|
||||||
|
write!(stdout, "{}", mycommand);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
Key::Down => {
|
Key::Down => {
|
||||||
mycommand = delete_current_cmd(mycommand);
|
if current_number < get_curr_history_number() {
|
||||||
current_number += 1;
|
mycommand = delete_current_cmd(mycommand);
|
||||||
let lastcmd = match get_hist_from_number(¤t_number) {
|
current_number += 1;
|
||||||
Some(c) => c,
|
let lastcmd = match get_hist_from_number(¤t_number) {
|
||||||
None => continue
|
Some(c) => c,
|
||||||
};
|
None => continue
|
||||||
mycommand = lastcmd.trim().to_string();
|
};
|
||||||
(max_pos, current_pos) = get_cmd_curs_pos(&mycommand);
|
mycommand = lastcmd.trim().to_string();
|
||||||
write!(stdout, "{}", mycommand);
|
(max_pos, current_pos) = get_cmd_curs_pos(&mycommand);
|
||||||
|
write!(stdout, "{}", mycommand);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
Key::Ctrl('x') => {
|
Key::Ctrl('x') => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user