mirror of
https://github.com/extrawurst/gitui.git
synced 2024-12-26 10:33:25 +03:00
tui textarea (#2051)
This commit is contained in:
parent
3439862854
commit
b9a2e131f2
12
Cargo.lock
generated
12
Cargo.lock
generated
@ -740,6 +740,7 @@ dependencies = [
|
||||
"struct-patch",
|
||||
"syntect",
|
||||
"tempfile",
|
||||
"tui-textarea",
|
||||
"unicode-segmentation",
|
||||
"unicode-truncate",
|
||||
"unicode-width",
|
||||
@ -1703,6 +1704,17 @@ version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
||||
|
||||
[[package]]
|
||||
name = "tui-textarea"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a3e38ced1f941a9cfc923fbf2fe6858443c42cc5220bfd35bdd3648371e7bd8e"
|
||||
dependencies = [
|
||||
"crossterm",
|
||||
"ratatui",
|
||||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-bidi"
|
||||
version = "0.3.15"
|
||||
|
@ -54,6 +54,7 @@ syntect = { version = "5.2", default-features = false, features = [
|
||||
"default-themes",
|
||||
"html",
|
||||
] }
|
||||
tui-textarea = "0.4.0"
|
||||
unicode-segmentation = "1.11"
|
||||
unicode-truncate = "0.2"
|
||||
unicode-width = "0.1"
|
||||
|
@ -553,6 +553,12 @@ impl Component for CommitComponent {
|
||||
self.options.borrow().has_commit_msg_history(),
|
||||
true,
|
||||
));
|
||||
|
||||
out.push(CommandInfo::new(
|
||||
strings::commands::newline(&self.key_config),
|
||||
true,
|
||||
true,
|
||||
));
|
||||
}
|
||||
|
||||
visibility_blocking(self)
|
||||
@ -565,7 +571,7 @@ impl Component for CommitComponent {
|
||||
}
|
||||
|
||||
if let Event::Key(e) = ev {
|
||||
if key_match(e, self.key_config.keys.enter)
|
||||
if key_match(e, self.key_config.keys.commit)
|
||||
&& self.can_commit()
|
||||
{
|
||||
try_or_popup!(
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -120,6 +120,8 @@ pub struct KeysList {
|
||||
pub view_submodule_parent: GituiKeyEvent,
|
||||
pub update_submodule: GituiKeyEvent,
|
||||
pub commit_history_next: GituiKeyEvent,
|
||||
pub commit: GituiKeyEvent,
|
||||
pub newline: GituiKeyEvent,
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
@ -209,6 +211,8 @@ impl Default for KeysList {
|
||||
view_submodule_parent: GituiKeyEvent::new(KeyCode::Char('p'), KeyModifiers::empty()),
|
||||
update_submodule: GituiKeyEvent::new(KeyCode::Char('u'), KeyModifiers::empty()),
|
||||
commit_history_next: GituiKeyEvent::new(KeyCode::Char('n'), KeyModifiers::CONTROL),
|
||||
commit: GituiKeyEvent::new(KeyCode::Enter, KeyModifiers::empty()),
|
||||
newline: GituiKeyEvent::new(KeyCode::Char('r'), KeyModifiers::CONTROL),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,6 @@ pub static POPUP_SUCCESS_COPY: &str = "Copied Text";
|
||||
pub static POPUP_COMMIT_SHA_INVALID: &str = "Invalid commit sha";
|
||||
|
||||
pub mod symbol {
|
||||
pub const WHITESPACE: &str = "\u{00B7}"; //·
|
||||
pub const CHECKMARK: &str = "\u{2713}"; //✓
|
||||
pub const SPACE: &str = "\u{02FD}"; //˽
|
||||
pub const EMPTY_SPACE: &str = " ";
|
||||
@ -969,13 +968,24 @@ pub mod commands {
|
||||
CommandText::new(
|
||||
format!(
|
||||
"Commit [{}]",
|
||||
key_config.get_hint(key_config.keys.enter),
|
||||
key_config.get_hint(key_config.keys.commit),
|
||||
),
|
||||
"commit (available when commit message is non-empty)",
|
||||
CMD_GROUP_COMMIT_POPUP,
|
||||
)
|
||||
.hide_help()
|
||||
}
|
||||
pub fn newline(key_config: &SharedKeyConfig) -> CommandText {
|
||||
CommandText::new(
|
||||
format!(
|
||||
"New line [{}]",
|
||||
key_config.get_hint(key_config.keys.newline),
|
||||
),
|
||||
"create line break",
|
||||
CMD_GROUP_COMMIT_POPUP,
|
||||
)
|
||||
.hide_help()
|
||||
}
|
||||
pub fn toggle_verify(
|
||||
key_config: &SharedKeyConfig,
|
||||
current_verify: bool,
|
||||
|
Loading…
Reference in New Issue
Block a user