mirror of https://github.com/encounter/objdiff.git
Add hotkeys to change target and base functions
This commit is contained in:
parent
4616058103
commit
98e971d0ce
|
@ -92,3 +92,15 @@ const SYMBOL_FILTER_SHORTCUT: KeyboardShortcut = KeyboardShortcut::new(Modifiers
|
||||||
pub fn consume_symbol_filter_shortcut(ctx: &Context) -> bool {
|
pub fn consume_symbol_filter_shortcut(ctx: &Context) -> bool {
|
||||||
ctx.input_mut(|i| i.consume_shortcut(&SYMBOL_FILTER_SHORTCUT))
|
ctx.input_mut(|i| i.consume_shortcut(&SYMBOL_FILTER_SHORTCUT))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const CHANGE_TARGET_SHORTCUT: KeyboardShortcut = KeyboardShortcut::new(Modifiers::CTRL, Key::T);
|
||||||
|
|
||||||
|
pub fn consume_change_target_shortcut(ctx: &Context) -> bool {
|
||||||
|
ctx.input_mut(|i| i.consume_shortcut(&CHANGE_TARGET_SHORTCUT))
|
||||||
|
}
|
||||||
|
|
||||||
|
const CHANGE_BASE_SHORTCUT: KeyboardShortcut = KeyboardShortcut::new(Modifiers::CTRL, Key::B);
|
||||||
|
|
||||||
|
pub fn consume_change_base_shortcut(ctx: &Context) -> bool {
|
||||||
|
ctx.input_mut(|i| i.consume_shortcut(&CHANGE_BASE_SHORTCUT))
|
||||||
|
}
|
||||||
|
|
|
@ -714,10 +714,11 @@ pub fn function_diff_ui(
|
||||||
.color(appearance.highlight_color),
|
.color(appearance.highlight_color),
|
||||||
);
|
);
|
||||||
if right_ctx.map_or(false, |m| m.has_symbol())
|
if right_ctx.map_or(false, |m| m.has_symbol())
|
||||||
&& ui
|
&& (ui
|
||||||
.button("Change target")
|
.button("Change target")
|
||||||
.on_hover_text_at_pointer("Choose a different symbol to use as the target")
|
.on_hover_text_at_pointer("Choose a different symbol to use as the target")
|
||||||
.clicked()
|
.clicked()
|
||||||
|
|| hotkeys::consume_change_target_shortcut(ui.ctx()))
|
||||||
{
|
{
|
||||||
if let Some(symbol_ref) = state.symbol_state.right_symbol.as_ref() {
|
if let Some(symbol_ref) = state.symbol_state.right_symbol.as_ref() {
|
||||||
ret = Some(DiffViewAction::SelectingLeft(symbol_ref.clone()));
|
ret = Some(DiffViewAction::SelectingLeft(symbol_ref.clone()));
|
||||||
|
@ -791,6 +792,7 @@ pub fn function_diff_ui(
|
||||||
"Choose a different symbol to use as the base",
|
"Choose a different symbol to use as the base",
|
||||||
)
|
)
|
||||||
.clicked()
|
.clicked()
|
||||||
|
|| hotkeys::consume_change_base_shortcut(ui.ctx())
|
||||||
{
|
{
|
||||||
if let Some(symbol_ref) = state.symbol_state.left_symbol.as_ref() {
|
if let Some(symbol_ref) = state.symbol_state.left_symbol.as_ref() {
|
||||||
ret = Some(DiffViewAction::SelectingRight(symbol_ref.clone()));
|
ret = Some(DiffViewAction::SelectingRight(symbol_ref.clone()));
|
||||||
|
|
Loading…
Reference in New Issue