Fixed up/down arrows
This commit is contained in:
@ -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
|
||||||
|
|
||||||
|
@ -425,6 +425,7 @@ pub mod shell {
|
|||||||
},
|
},
|
||||||
|
|
||||||
Key::Up => {
|
Key::Up => {
|
||||||
|
if current_number > 2 {
|
||||||
mycommand = delete_current_cmd(mycommand);
|
mycommand = delete_current_cmd(mycommand);
|
||||||
current_number -= 1;
|
current_number -= 1;
|
||||||
let lastcmd = match get_hist_from_number(¤t_number) {
|
let lastcmd = match get_hist_from_number(¤t_number) {
|
||||||
@ -434,9 +435,11 @@ pub mod shell {
|
|||||||
mycommand = lastcmd.trim().to_string();
|
mycommand = lastcmd.trim().to_string();
|
||||||
(max_pos, current_pos) = get_cmd_curs_pos(&mycommand);
|
(max_pos, current_pos) = get_cmd_curs_pos(&mycommand);
|
||||||
write!(stdout, "{}", mycommand);
|
write!(stdout, "{}", mycommand);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
Key::Down => {
|
Key::Down => {
|
||||||
|
if current_number < get_curr_history_number() {
|
||||||
mycommand = delete_current_cmd(mycommand);
|
mycommand = delete_current_cmd(mycommand);
|
||||||
current_number += 1;
|
current_number += 1;
|
||||||
let lastcmd = match get_hist_from_number(¤t_number) {
|
let lastcmd = match get_hist_from_number(¤t_number) {
|
||||||
@ -446,6 +449,7 @@ pub mod shell {
|
|||||||
mycommand = lastcmd.trim().to_string();
|
mycommand = lastcmd.trim().to_string();
|
||||||
(max_pos, current_pos) = get_cmd_curs_pos(&mycommand);
|
(max_pos, current_pos) = get_cmd_curs_pos(&mycommand);
|
||||||
write!(stdout, "{}", mycommand);
|
write!(stdout, "{}", mycommand);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
Key::Ctrl('x') => {
|
Key::Ctrl('x') => {
|
||||||
|
Reference in New Issue
Block a user