검증 실행에 Ctrl+Enter 추가 — 단축키를 선언으로 옮겼다

Ctrl+Enter 로도 검증이 돌게 했다(F5 는 그대로 남는다).

■ PreviewKeyDown 대신 KeyBinding 으로

처음에는 PreviewKeyDown 에서 Keyboard.Modifiers 를 읽어 처리했는데, 그 경로는 검사할 수가 없다 —
Keyboard.Modifiers 는 <b>실제 키보드 상태</b>에서 나오므로 합성 키 이벤트로는 Ctrl 이 잡히지 않는다.
진단을 쓰다 이걸 발견했고(검사 2건이 계속 실패했다), 단축키를 Window.InputBindings 선언으로 옮겼다.
이제 진단이 등록된 KeyBinding 을 찾아 그 명령을 직접 실행해 배선을 확인한다.

■ 자동완성 Enter 와 뜻이 갈린다

목록이 떠 있을 때 Enter 는 후보 확정이다. Ctrl+Enter 가 그 처리에 먼저 걸리면 검증이 안 돈다.
PreviewKeyDown 의 목록 처리에서 Ctrl+Enter 만 비켜 가게 하고, 실행할 때 목록을 닫는다.

--query-popup 진단에 4건 추가(Ctrl+Enter 등록 · F5 유지 · 실행됨 · 실행하며 목록 닫힘). 현재 16/16.

회귀: 테스트 230/230, 편집 스모크 실패 0, 팝업·정렬·결과표·단축키 점검 16/16,
DB 왕복 1,271건 diff 0/예외 0, 종이 렌더 P062 바이트 동일.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Msystech
2026-08-13 16:19:41 +09:00
co-authored by Claude Opus 5
parent 6c71159dad
commit 0e2e2fb0e6
3 changed files with 47 additions and 10 deletions
@@ -744,6 +744,29 @@ public static class DbSmoke
Check("결과 표에 열이 생긴다", grid.Columns.Count >= 2, $"열 {grid.Columns.Count}개"); Check("결과 표에 열이 생긴다", grid.Columns.Count >= 2, $"열 {grid.Columns.Count}개");
Check("결과 표에 행이 채워진다", grid.Items.Count >= 1, $"행 {grid.Items.Count}개"); Check("결과 표에 행이 채워진다", grid.Items.Count >= 1, $"행 {grid.Items.Count}개");
// ⑩ 검증 실행 단축키가 실제로 배선돼 있는가.
// 합성 키 이벤트로는 Keyboard.Modifiers 가 잡히지 않으므로(실제 키 상태를 읽는다)
// 선언된 KeyBinding 을 찾아 그 명령을 직접 실행해 확인한다.
var bindings = window.InputBindings.OfType<System.Windows.Input.KeyBinding>().ToList();
var ctrlEnter = bindings.FirstOrDefault(b =>
b.Key == System.Windows.Input.Key.Return
&& b.Modifiers == System.Windows.Input.ModifierKeys.Control);
var f5 = bindings.FirstOrDefault(b => b.Key == System.Windows.Input.Key.F5);
Check("Ctrl+Enter 단축키가 등록돼 있다", ctrlEnter is not null);
Check("F5 단축키도 남아 있다", f5 is not null);
if (ctrlEnter?.Command is { } trialCommand)
{
pane.Visibility = System.Windows.Visibility.Collapsed;
Type("SELECT 1 FROM DUAL WHERE 1=1 AND SEL");
var popupWasOpen = popup.IsOpen;
trialCommand.Execute(null);
DrainDispatcher();
Check("Ctrl+Enter 로 검증이 실행된다", pane.Visibility == System.Windows.Visibility.Visible);
// 목록이 떠 있어도 검증이 돈다 — Enter(목록 확정)와 뜻이 갈려야 한다
Check("실행하면서 자동완성 목록을 닫는다", popupWasOpen && !popup.IsOpen);
}
window.Close(); window.Close();
DrainDispatcher(); DrainDispatcher();
} }
@@ -61,6 +61,13 @@
</Style> </Style>
</Window.Resources> </Window.Resources>
<!-- 검증 실행 단축키 — 선언으로 두면 실제 배선을 진단이 그대로 확인할 수 있다.
PreviewKeyDown 에서 손으로 Keyboard.Modifiers 를 읽으면 그 경로를 검사할 방법이 없다. -->
<Window.InputBindings>
<KeyBinding Modifiers="Control" Key="Return" Command="{Binding TrialCommand}"/>
<KeyBinding Key="F5" Command="{Binding TrialCommand}"/>
</Window.InputBindings>
<DockPanel Margin="16,14,16,14"> <DockPanel Margin="16,14,16,14">
<!-- ── 머리말 ── --> <!-- ── 머리말 ── -->
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="0,0,0,12"> <StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="0,0,0,12">
@@ -82,7 +89,7 @@
TextTrimming="CharacterEllipsis"/> TextTrimming="CharacterEllipsis"/>
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal"> <StackPanel DockPanel.Dock="Right" Orientation="Horizontal">
<Button x:Name="TrialButton" Padding="14,6" Click="OnTrial" <Button x:Name="TrialButton" Padding="14,6" Click="OnTrial"
ToolTip="DB 에서 실제로 돌려 봅니다 (F5). 조회만 실행되며 표본 몇 행만 가져옵니다."> ToolTip="DB 에서 실제로 돌려 봅니다 (Ctrl+Enter 또는 F5). 조회만 실행되며 표본 몇 행만 가져옵니다.">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<TextBlock Text="▶" FontSize="10" VerticalAlignment="Center" Margin="0,0,6,0"/> <TextBlock Text="▶" FontSize="10" VerticalAlignment="Center" Margin="0,0,6,0"/>
<TextBlock Text="검증 실행" VerticalAlignment="Center"/> <TextBlock Text="검증 실행" VerticalAlignment="Center"/>
@@ -60,6 +60,9 @@ public partial class QueryEditorWindow : Window
#region Properties - Commands #region Properties - Commands
/// <summary>목록 행의 + 버튼 — 더블클릭을 모르는 사람도 넣을 수 있어야 한다</summary> /// <summary>목록 행의 + 버튼 — 더블클릭을 모르는 사람도 넣을 수 있어야 한다</summary>
public M.Framework.WPF.ICustomCommand InsertCommand { get; } public M.Framework.WPF.ICustomCommand InsertCommand { get; }
/// <summary>검증 실행 — Ctrl+Enter / F5 단축키가 이것을 부른다</summary>
public M.Framework.WPF.ICustomCommand TrialCommand { get; }
#endregion #endregion
#region Properties #region Properties
@@ -88,6 +91,16 @@ public partial class QueryEditorWindow : Window
InsertVariable(variable); InsertVariable(variable);
} }
}); });
TrialCommand = new M.Framework.WPF.Command((sender, e) =>
{
if (!isSql)
{
return;
}
// 자동완성 목록이 떠 있으면 닫고 실행한다 — Enter 의 뜻(목록 확정)과 겹치지 않게
CompletionPopup.IsOpen = false;
OnTrial(this, new RoutedEventArgs());
});
DataContext = this; DataContext = this;
SqlBox.Text = initialQuery; SqlBox.Text = initialQuery;
TargetChipText.Text = ownerLabel; TargetChipText.Text = ownerLabel;
@@ -603,19 +616,13 @@ public partial class QueryEditorWindow : Window
var ctrl = (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control; var ctrl = (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control;
var shift = (Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift; var shift = (Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift;
// 목록이 떠 있으면 방향키·Enter·Tab 은 목록 것이다 // 목록이 떠 있으면 방향키·Enter·Tab 은 목록 것이다.
if (HandleCompletionKey(e)) // 단 Ctrl+Enter 는 검증 실행이라 목록이 가로채면 안 된다 — 그건 KeyBinding 이 받는다.
if (!(ctrl && e.Key is Key.Return or Key.Enter) && HandleCompletionKey(e))
{ {
e.Handled = true; e.Handled = true;
return; return;
} }
if (e.Key == Key.F5 && isSql)
{
OnTrial(sender, e);
e.Handled = true;
return;
}
// Ctrl+Space — 목록을 손으로 부른다 // Ctrl+Space — 목록을 손으로 부른다
if (ctrl && e.Key == Key.Space) if (ctrl && e.Key == Key.Space)
{ {