• R/O
  • SSH
  • HTTPS

tortoisesvn: Commit


Commit MetaInfo

Revision28943 (tree)
Zeit2020-06-26 04:23:15
Autorstefankueng

Log Message

check for all keys: only select text if focus changed due to user interaction.

Ändern Zusammenfassung

Diff

--- trunk/src/Utils/MiscUI/FilterEdit.cpp (revision 28942)
+++ trunk/src/Utils/MiscUI/FilterEdit.cpp (revision 28943)
@@ -436,10 +436,24 @@
436436
437437 void CFilterEdit::OnEnSetfocus()
438438 {
439- if ((GetKeyState(VK_LBUTTON)&0x8000) ||
440- (GetKeyState(VK_MBUTTON) & 0x8000) ||
441- (GetKeyState(VK_RBUTTON) & 0x8000) ||
442- (GetKeyState(VK_TAB) & 0x8000))
439+ // we don't want to select the entered text
440+ // if the focus is set programmatically, because
441+ // we set the focus back to the filter control
442+ // after the filter-timer runs out and we apply
443+ // the filter: if the user is slow to type, that
444+ // could happen *while* typing and we must not
445+ // select the partly entered word.
446+ //
447+ // so we check whether there's any key pressed
448+ // that might be part of a accelerator/shortcut,
449+ // and also if any mouse pointer is pressed:
450+ // that would mean a focus change due to specific
451+ // user interaction and we then *can* select the
452+ // entered text.
453+ bool keyPressed = false;
454+ for (int k = 0x00; !keyPressed && (k <= 0xFF); ++k)
455+ keyPressed |= ((GetKeyState(k) & 0x8000) != 0);
456+ if (keyPressed)
443457 SetSel(0, -1);
444458 InvalidateRect(NULL);
445459 }
Show on old repository browser