mirror of
https://github.com/apognu/tuigreet.git
synced 2024-09-11 07:25:29 +03:00
Reset cursor offset when switching screens.
This commit is contained in:
parent
a6da45b640
commit
cd778e8058
@ -56,6 +56,7 @@ pub async fn handle(greeter: Arc<RwLock<Greeter>>, input: KeyEvent, ipc: Ipc) ->
|
||||
Mode::Command => {
|
||||
greeter.mode = greeter.previous_mode;
|
||||
greeter.buffer = greeter.previous_buffer.take().unwrap_or_default();
|
||||
greeter.cursor_offset = 0;
|
||||
}
|
||||
|
||||
Mode::Users | Mode::Sessions | Mode::Power => {
|
||||
@ -84,6 +85,7 @@ pub async fn handle(greeter: Arc<RwLock<Greeter>>, input: KeyEvent, ipc: Ipc) ->
|
||||
// Set the edition buffer to the current command.
|
||||
greeter.previous_buffer = Some(greeter.buffer.clone());
|
||||
greeter.buffer = greeter.session_source.command(&greeter).map(str::to_string).unwrap_or_default();
|
||||
greeter.cursor_offset = 0;
|
||||
greeter.mode = Mode::Command;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user