From 2a0db27bb149e03f99874fa335bf1d105165bce6 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Wed, 4 Sep 2019 15:55:21 +0200 Subject: ui: allow (Shift+)Tab to move focus to sibling controls in RichEdit With RTF control consuming Tab and Enter keystrokes, there was no way to create or edit a tunnel using keyboard only. This was a major concern for accessibility. Should user want to explicitly insert \t into configuration, one can use Ctrl+Tab, paste it, or use Alt+09 (on numeric keyboard). Signed-off-by: Simon Rozman --- ui/syntax/syntaxedit.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ui/syntax/syntaxedit.c b/ui/syntax/syntaxedit.c index 70ebca63..2e53b011 100644 --- a/ui/syntax/syntaxedit.c +++ b/ui/syntax/syntaxedit.c @@ -362,6 +362,14 @@ static LRESULT CALLBACK child_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lP case WM_THEMECHANGED: highlight_text(hWnd); break; + case WM_GETDLGCODE: { + MSG *m = (MSG *)lParam; + LRESULT lres = parent_proc(hWnd, Msg, wParam, lParam); + lres &= ~DLGC_WANTTAB; + if (m && m->message == WM_KEYDOWN && m->wParam == VK_TAB && GetKeyState(VK_CONTROL) >= 0) + lres &= ~DLGC_WANTMESSAGE; + return lres; + } } return parent_proc(hWnd, Msg, wParam, lParam); } -- cgit v1.2.3-59-g8ed1b