-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Search behavior in Terminal -- add capability to insert the matched hit #8274
Comments
Out of curiosity, is there any terminal out there that actually has this particular feature? |
Yes. Mac iTerm2 has that feature.
F.
|
So, I'll throw this on the Search v2 backlog, but we'll need to definitely think about how this will work exactly. Right now, tab in the find dialog will move the focus to the "Find Up" button. We'd need to be able to offer some sort of configurable way of intercepting that and performing some other action - in this case, something like "expandSelection(word)".
So idk if we have actions for both of those spec'd in #2840, I'd have to check Then, we'd need to figure out how this plays with copy on select - I'm thinking that we'd probably not have it auto-copy (unless |
The specification of this feature needs to be way more detailed than my
feature request. I can put in an effort in doing this on 2 conditions:
1. Someone takes the time to properly review/discuss the spec with me.
2. This feature request does not end in an endless backlog, and actually
gets into a released product within 1 year.
Otherwise, I see no point on working on a spec for something that ends up
in a drawer. Depending on the language the terminal is written in, and if
it's open source, I might also contribute.
Best,
F.
|
I would love to help you write a spec 😃 Right now, we've got a spec template over here. I'm gonna level with you, I don't love the template, and I'm working on updating it now, but it's certainly a good enough starting point. I'd think that the "Capabilities" header should definitely be renamed to "Concerns" or something similar. There's a bunch of other completed specs in the same folder, with a variety of levels of detail (less, more, most). Those can be a good reference for what we're looking for. As far as details go, I'm a little worried that this feature might run up against the "Keyboard Selection Spec" over in #2840. I'm pretty sure that spec is actually in its final form and has all the details that the team discussed, but we're mostly just backed up a little bit bureaucratically on that on. So I think that's fine to use as a base to build off of. I'd also keep an eye on the fact that currently, the TermControl itself is the thing responsible for handling the key events to try and dispatch an action. If we wanted to have the keybinding for this action configurable, then we'd need some way of identifying that the action is being dispatched from the find dialog, not the terminal control. If you can describe the UX well enough, we can almost certainly help figure the plumbing out. I'm super happy to keep pushing on the discussion and keep bumping the review as much as possible, though I'd just also warn you that as we're heading into the end of the year, there are a lot more holidays and vacation days used, so our response times might be a little slower than usual. The codebase is all C++ (more specifically, C++/WinRT). If you're interested in poking around the code, this directory is probably the most relevant to the discussion. |
Thank you for your detailed answer with the pointers to example specs. Let
me see if I can come up with something spec-wise, but it may take some time.
I am an active developer by profession, but have not touched C++ in many,
many years, favoring C# development since 2006 (.net 2.0) or so. Now all
the stuff I do is .net 5 cross platform, asp.net, ef etc. , ruby, python,
bash and aws devops. I do have extensive WPF desktop experience but have
never touched WinRT (windows stores apps). I'll have a quick look at the
code when I have some time.
So for the spec, you assigned issue #8274 - should I just
1. Fork the repo
2. Clone my fork with branch main
3. Create a new branch dev/brunzefb/spec/insert-matched-search from main
4. Add a new file [root]/doc/specs/#8274 - Insert Matched Search
Hit/spec.md (the spec .md starting from the template and all the .png files
going into the folder?
5. Do the spec writing
6. Commit the branch, push to my fork and issue a PR back (my branch ->main) to the project?
Then ask for a review on the original thread?
If you can point me to other docs that specify how you work, or code of
conduct, pls send me links.
Best,
Friedrich
|
Take however long you need! If you only want to work on the spec, that's perfectly fine too. C++/WinRT is a bit of a weird hybrid of C++ and C#, and it can be a little tricky to get things exactly right. It's really nice once you've gotten the hang of it, but it can have some really nasty edge cases. As far as the process goes, what you've outlined is great. I think we're still trying to find the best way to handle community spec contributions. You'll probably get a couple reviews from the team after submitting the PR, and we tend to hold specs to a 3-approval minimum, to ensure there's a broader consensus across the team. We usually have team syncs on Mondays, so we might have additional feedback for you the Monday after the PR is submitted. I think technically our code of conduct is here, but we operate pretty informally. If you follow the unofficial COC of "don't be an asshole", then you'll get along just fine 😄 |
An idle thought: We've got mark mode now. Maybe we could have the find dialog trigger a mark mode selection, use the dialog to get to the hit you want, then hit /cc @carlos-zamora to run my crazy idea past you [1]: I'm aware that as of 1.16 |
Hmm... I don't like making That said, I'll meet you halfway. What if we did this...
tldr: add an @zadjii-msft shipit? This is a pretty easy task tbh. TerminalSelection already has logic to expand by word. We'd just expand "start" to the beginning of the word and "end" to the end of the word haha. |
I don't hate it. We may want to sanity check something like returning I'd say , and I'll let @brunzefb ACK if this idea would work for them [1]: this is a mild fact, I haven't actually verified it. |
Oh. Minor correction for what I said above. We should escape the find dialog first. Then press tab. That way, tab is bound to something. Hoping to write |
## Summary of the Pull Request Introduces a new action `expandSelectionToWord()` which expands the beginning and end of the selection to encompass the word(s) it's on. This was implemented as a conditional keybinding where the key chord is passed through to the terminal if no selection is active (similar to `copy()`). It is not bound to anything by default. ## PR Checklist * [x] Closes #8274 * [x] Schema updated. ## Validation Steps Performed - Scenario in #8274: - search for some text in the find dialog - ESC to close the dialog - execute `expandSelectionToWord()` - the new selection encompasses the whole word - mark mode - move onto a word - execute `expandSelectionToWord()` - mouse selection (same as above) - select a portion of two words --> new selection fully encompasses both words
🎉This issue was addressed in #13765, which has now been successfully released as Handy links: |
Allow Search functionality to easily expand found text, and insert the expanded found text at current cursor location
as an example take a look at this Kubernetes example:
The system listed a container name - a complex generated name. I need the full container name to delete the container, for instance, what I want is to execute the following
Now the problem is -- how do I get the long name in? The mac iterm2 solves this by allowing a search
ctrl+f
(orctrl+shift+f
)oom-ent
oom-ent
(below the line ending in grep notifications)Tab
oom-ent-notifications-1-0-775c6fb9dc-n476x
AND copies it to clipboardk delete po -n dev
[Ctrl+V
]k delete po -n dev oom-ent-notifications-1-0-775c6fb9dc-n476x
enter
to execute the command.Shift-Tab should work to select up to the beginning of the word. Shift-Tab followed by Tab should select the whole word if letters in the middle of the word are matched.
Allowing this functionality is super-useful.
F.
The text was updated successfully, but these errors were encountered: