Search unblocking followups #5537

Closed
opened 2026-01-31 00:15:41 +00:00 by claunia · 1 comment
Owner

Originally created by @KaiyuWang16 on GitHub (Dec 12, 2019).

Originally assigned to: @KaiyuWang16 on GitHub.

Description of the new feature/enhancement

These are the follow-up works that worthen trying but are not blocking the Search project to be checked-in:

  1. The place holder text in the TextBox ("Find...") needs to be localizable.
  2. Search event should have a delegate with more args. This is illustrated below in Issue 2.
  3. Escape should be handled in the control too, as opposed to bubbling, this is illustrated in issue 3 below.

Proposed technical implementation details (optional)

Issue 2:
In the current implementation of search, case match and search direction information are stored in SearchBoxControl as Booleans and passed to TermControl through getter methods. Besides, "Shift + Enter" reverse search are implemented by temporarily change direction state value. These are not safe approaches and should be refactored.

One solution is to use a delegate.

delegate void SearchHandler(String query, Boolean forward, Boolean caseSensitive);
...
runtimeclass xxx {
event SearchHandler Search();
}

In this way, we do not have to create an object, and we do not even need to use TypedEventHandler.

Then, the consumer can still add a search handler like this:
searchBoxControl.Search([](hstring query, bool forward, bool caseSensitive) {
})

Issue 3:
TermControl is using PreviewKeyDown as the event handler for KeyDown events, which is applying a Tunneling strategy. In tunneling, the event will first received by the Root element in the XAML tree and then pass down to the element that triggers the event. Thus, an early return check is added in TermControl::_KeyDownHandler to make sure inputs from the search dialog is handled separately. However, it is worth trying if we can handle search dialog inputs in SearchBoxControl.

(Please make sure you mention all the extra work you've moved into this bug!)

Originally created by @KaiyuWang16 on GitHub (Dec 12, 2019). Originally assigned to: @KaiyuWang16 on GitHub. <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> # Description of the new feature/enhancement These are the follow-up works that worthen trying but are not blocking the Search project to be checked-in: 1. The place holder text in the TextBox ("Find...") needs to be localizable. 2. Search event should have a delegate with more args. This is illustrated below in Issue 2. 3. Escape should be handled in the control too, as opposed to bubbling, this is illustrated in issue 3 below. # Proposed technical implementation details (optional) Issue 2: In the current implementation of search, case match and search direction information are stored in SearchBoxControl as Booleans and passed to TermControl through getter methods. Besides, "Shift + Enter" reverse search are implemented by temporarily change direction state value. These are not safe approaches and should be refactored. One solution is to use a delegate. delegate void SearchHandler(String query, Boolean forward, Boolean caseSensitive); ... runtimeclass xxx { event SearchHandler Search(); } In this way, we do not have to create an object, and we do not even need to use TypedEventHandler. Then, the consumer can still add a search handler like this: searchBoxControl.Search([](hstring query, bool forward, bool caseSensitive) { }) Issue 3: TermControl is using PreviewKeyDown as the event handler for KeyDown events, which is applying a Tunneling strategy. In tunneling, the event will first received by the Root element in the XAML tree and then pass down to the element that triggers the event. Thus, an early return check is added in TermControl::_KeyDownHandler to make sure inputs from the search dialog is handled separately. However, it is worth trying if we can handle search dialog inputs in SearchBoxControl. > (Please make sure you mention all the extra work you've moved into this bug!)
Author
Owner

@DHowett-MSFT commented on GitHub (Dec 16, 2019):

(Please make sure you mention all the extra work you've moved into this bug!)

@DHowett-MSFT commented on GitHub (Dec 16, 2019): (Please make sure you mention all the extra work you've moved into this bug!)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#5537