@@ -678,7 +678,7 @@ LRESULT CALLBACK PhpSearchWndSubclassProc(
678
678
if (
679
679
PhIsNullOrEmptyString (context -> CueBannerText ) ||
680
680
GetFocus () == hWnd ||
681
- Edit_GetTextLength ( hWnd ) > 0
681
+ CallWindowProc ( oldWndProc , hWnd , WM_GETTEXTLENGTH , 0 , 0 ) > 0 // Edit_GetTextLength
682
682
)
683
683
{
684
684
return CallWindowProc (oldWndProc , hWnd , uMsg , wParam , lParam );
@@ -740,6 +740,55 @@ LRESULT CALLBACK PhpSearchWndSubclassProc(
740
740
return DefWindowProc (hWnd , uMsg , wParam , lParam );
741
741
}
742
742
break ;
743
+ case WM_KEYDOWN :
744
+ {
745
+ // Delete previous word for ctrl+backspace (thanks to Katayama Hirofumi MZ) (modified) (dmex)
746
+ if (wParam == VK_BACK && GetAsyncKeyState (VK_CONTROL ) < 0 )
747
+ {
748
+ UINT textStart = 0 ;
749
+ UINT textEnd = 0 ;
750
+ UINT textLength ;
751
+
752
+ textLength = (UINT )CallWindowProc (oldWndProc , hWnd , WM_GETTEXTLENGTH , 0 , 0 );
753
+ CallWindowProc (oldWndProc , hWnd , EM_GETSEL , (WPARAM )& textStart , (LPARAM )& textEnd );
754
+
755
+ if (textLength > 0 && textStart == textEnd )
756
+ {
757
+ PWSTR textBuffer ;
758
+
759
+ textBuffer = PhAllocateZero ((textLength + 1 ) * sizeof (WCHAR ));
760
+ GetWindowText (hWnd , textBuffer , textLength );
761
+
762
+ for (; 0 < textStart ; -- textStart )
763
+ {
764
+ if (textBuffer [textStart - 1 ] == L' ' && iswalnum (textBuffer [textStart ]))
765
+ {
766
+ CallWindowProc (oldWndProc , hWnd , EM_SETSEL , textStart , textEnd );
767
+ CallWindowProc (oldWndProc , hWnd , EM_REPLACESEL , TRUE, (LPARAM )L"" );
768
+ PhFree (textBuffer );
769
+ return 1 ;
770
+ }
771
+ }
772
+
773
+ if (textStart == 0 )
774
+ {
775
+ SetWindowText (hWnd , L"" );
776
+ PhFree (textBuffer );
777
+ return 1 ;
778
+ }
779
+
780
+ PhFree (textBuffer );
781
+ }
782
+ }
783
+ }
784
+ break ;
785
+ case WM_CHAR :
786
+ {
787
+ // Delete previous word for ctrl+backspace (dmex)
788
+ if (wParam == VK_F16 && GetAsyncKeyState (VK_CONTROL ) < 0 )
789
+ return 1 ;
790
+ }
791
+ break ;
743
792
}
744
793
745
794
return CallWindowProc (oldWndProc , hWnd , uMsg , wParam , lParam );
0 commit comments