Felche gauche en cours
This commit is contained in:
parent
b64505106f
commit
19771dbd13
16
src/lib.rs
16
src/lib.rs
@ -12,7 +12,7 @@ pub mod shell {
|
|||||||
use termion::event::Key;
|
use termion::event::Key;
|
||||||
use termion::input::TermRead;
|
use termion::input::TermRead;
|
||||||
use termion::raw::IntoRawMode;
|
use termion::raw::IntoRawMode;
|
||||||
use termion::color;
|
use termion::{color, cursor, cursor::DetectCursorPos};
|
||||||
use unicode_segmentation::UnicodeSegmentation;
|
use unicode_segmentation::UnicodeSegmentation;
|
||||||
|
|
||||||
mod history;
|
mod history;
|
||||||
@ -292,6 +292,20 @@ pub mod shell {
|
|||||||
write!(stdout, "{}", mycommand);
|
write!(stdout, "{}", mycommand);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Key::Left => {
|
||||||
|
//La taille du prompt est incorrecte à cause des couleurs !
|
||||||
|
let pr_length = prompt.chars().count();
|
||||||
|
let curs_pos = stdout.cursor_pos().unwrap().0;
|
||||||
|
if usize::from(curs_pos) > pr_length {
|
||||||
|
write!(stdout, "1{:?}/2{}-{}", curs_pos, pr_length, cursor::Left(10));
|
||||||
|
stdout.flush();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
Key::Right => {
|
||||||
|
print!("{}", cursor::Right(1));
|
||||||
|
}
|
||||||
|
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user