mirror of
https://github.com/gitui-org/gitui
synced 2026-05-24 09:28:21 +00:00
switch more missing places to use new keyconfig
This commit is contained in:
parent
19177ec9bb
commit
7da34eb3e4
5 changed files with 17 additions and 22 deletions
|
|
@ -122,7 +122,6 @@ impl Component for InspectCommitComponent {
|
||||||
{
|
{
|
||||||
self.details.focus(true);
|
self.details.focus(true);
|
||||||
self.diff.focus(false);
|
self.diff.focus(false);
|
||||||
} else {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// stop key event propagation
|
// stop key event propagation
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ use crate::{
|
||||||
strings, ui,
|
strings, ui,
|
||||||
};
|
};
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use crossterm::event::{Event, KeyCode};
|
use crossterm::event::Event;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use tui::{
|
use tui::{
|
||||||
backend::Backend,
|
backend::Backend,
|
||||||
|
|
@ -81,19 +81,13 @@ impl Component for ResetComponent {
|
||||||
fn event(&mut self, ev: Event) -> Result<bool> {
|
fn event(&mut self, ev: Event) -> Result<bool> {
|
||||||
if self.visible {
|
if self.visible {
|
||||||
if let Event::Key(e) = ev {
|
if let Event::Key(e) = ev {
|
||||||
return match e.code {
|
if e == self.key_config.exit_popup {
|
||||||
KeyCode::Esc => {
|
self.hide();
|
||||||
self.hide();
|
} else if e == self.key_config.enter {
|
||||||
Ok(true)
|
self.confirm();
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyCode::Enter => {
|
return Ok(true);
|
||||||
self.confirm();
|
|
||||||
Ok(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
_ => Ok(true),
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ use crate::{
|
||||||
};
|
};
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use asyncgit::{sync, CWD};
|
use asyncgit::{sync, CWD};
|
||||||
use crossterm::event::{Event, KeyCode};
|
use crossterm::event::Event;
|
||||||
use tui::{backend::Backend, layout::Rect, Frame};
|
use tui::{backend::Backend, layout::Rect, Frame};
|
||||||
|
|
||||||
pub struct StashMsgComponent {
|
pub struct StashMsgComponent {
|
||||||
|
|
@ -61,7 +61,7 @@ impl Component for StashMsgComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Event::Key(e) = ev {
|
if let Event::Key(e) = ev {
|
||||||
if let KeyCode::Enter = e.code {
|
if e == self.key_config.enter {
|
||||||
match sync::stash_save(
|
match sync::stash_save(
|
||||||
CWD,
|
CWD,
|
||||||
if self.input.get_text().is_empty() {
|
if self.input.get_text().is_empty() {
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ use asyncgit::{
|
||||||
sync::{self, CommitId},
|
sync::{self, CommitId},
|
||||||
CWD,
|
CWD,
|
||||||
};
|
};
|
||||||
use crossterm::event::{Event, KeyCode};
|
use crossterm::event::Event;
|
||||||
use tui::{backend::Backend, layout::Rect, Frame};
|
use tui::{backend::Backend, layout::Rect, Frame};
|
||||||
|
|
||||||
pub struct TagCommitComponent {
|
pub struct TagCommitComponent {
|
||||||
|
|
@ -63,7 +63,7 @@ impl Component for TagCommitComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Event::Key(e) = ev {
|
if let Event::Key(e) = ev {
|
||||||
if let KeyCode::Enter = e.code {
|
if e == self.key_config.enter {
|
||||||
self.tag()
|
self.tag()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -209,13 +209,15 @@ impl Component for TextInputComponent {
|
||||||
fn event(&mut self, ev: Event) -> Result<bool> {
|
fn event(&mut self, ev: Event) -> Result<bool> {
|
||||||
if self.visible {
|
if self.visible {
|
||||||
if let Event::Key(e) = ev {
|
if let Event::Key(e) = ev {
|
||||||
|
if e == self.key_config.exit_popup {
|
||||||
|
self.hide();
|
||||||
|
return Ok(true);
|
||||||
|
}
|
||||||
|
|
||||||
let is_ctrl =
|
let is_ctrl =
|
||||||
e.modifiers.contains(KeyModifiers::CONTROL);
|
e.modifiers.contains(KeyModifiers::CONTROL);
|
||||||
|
|
||||||
match e.code {
|
match e.code {
|
||||||
KeyCode::Esc => {
|
|
||||||
self.hide();
|
|
||||||
return Ok(true);
|
|
||||||
}
|
|
||||||
KeyCode::Char(c) if !is_ctrl => {
|
KeyCode::Char(c) if !is_ctrl => {
|
||||||
self.msg.insert(self.cursor_position, c);
|
self.msg.insert(self.cursor_position, c);
|
||||||
self.incr_cursor();
|
self.incr_cursor();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue