Merge branch 'deedra'

This commit is contained in:
Storm Dragon committed 2026-10-14 20:13:11 -04:00
commit 4c47cc5fc4
5 files changed
+112 -12

No files matched your search

+29 -1
View File
@@ -15,6 +15,7 @@ typedef struct EditState {
WCHAR *text;
DWORD length;
BOOL busy, known, destroyed;
BOOL history_key, history_replaced;
WCHAR pending_high;
DWORD pending_caret;
} EditState;
@@ -102,6 +103,10 @@ static LRESULT CALLBACK edit_proc(HWND window, UINT message, WPARAM wp, LPARAM l
BOOL requested_focus = message == RegisterWindowMessageW(EDIT_FOCUS_MESSAGE);
BOOL focus = message == WM_SETFOCUS || requested_focus;
BOOL selected = message == EM_SETSEL;
// A dispatched arrow belongs to ordinary caret navigation. Applications
// such as MUSHclient consume history arrows before DispatchMessage instead.
if (navigation || focus) state->history_key = state->history_replaced = FALSE;
BOOL history_replacement = message == WM_SETTEXT && state->history_key;
if (!navigation && !changing && !focus && !selected && message != EM_SETPASSWORDCHAR)
return DefSubclassProc(window, message, wp, lp);
@@ -152,7 +157,17 @@ static LRESULT CALLBACK edit_proc(HWND window, UINT message, WPARAM wp, LPARAM l
if (focus) {
current_line(window, start, text);
kind = WINE_ACCESS_TEXT_FOCUS; report = TRUE;
} else if ((navigation || selected) && (start != old_start || end != old_end)) {
} else if (history_replacement && result) {
// Pretranslated Up/Down recalls arrive as SetWindowText followed by
// SetSel, without any WM_KEYDOWN reaching this procedure. Read the whole
// recalled command once, including blank and equal-length replacements.
if (state->text) copy_range(text, state->text, 0, state->length);
else current_line(window, start, text);
state->history_key = FALSE;
state->history_replaced = TRUE;
report = TRUE;
} else if ((navigation || (selected && !state->history_replaced)) &&
(start != old_start || end != old_end)) {
if (start != end && state->text && end <= state->length) {
// Speak the changed portion when extending or shrinking a selection.
DWORD first = start, last = end;
@@ -262,6 +277,19 @@ __declspec(dllexport) LRESULT CALLBACK WineAccessInputHook(int code, WPARAM wp,
HWND focus = GetFocus();
if (wine_access_watch_edit(focus))
SendMessageW(focus, RegisterWindowMessageW(EDIT_FOCUS_MESSAGE), 0, 0);
EditState *state = (EditState *)GetPropW(focus, EDIT_STATE_PROPERTY);
WCHAR class_name[64];
// Scintilla uses the same attachment property with a different state.
if (state && GetClassNameW(focus, class_name, 64) &&
wine_access_class_matches(class_name, L"Edit") && !state->busy) {
const MSG *message = (const MSG *)lp;
// Restrict replacement feedback to this retrieved input message.
// Timers, unrelated programmatic changes and background edits stay silent.
state->history_key = message->hwnd == focus && message->message == WM_KEYDOWN &&
(message->wParam == VK_UP || message->wParam == VK_DOWN) &&
!(GetKeyState(VK_CONTROL) & 0x8000);
state->history_replaced = FALSE;
}
#ifdef _WIN64
wine_access_scintilla_input(focus, (const MSG *)lp);
#endif