Text Editor: Use active text selection as search query #115247

Merged
Harley Acheson merged 4 commits from guishe/blender:quick-search into main 2023-11-30 18:27:02 +01:00
Contributor

Now when using the shortcut/operator to begin search in the
text editor the active text selection is used as search query.

Also previously while using the operator to begin search, the input
field that contains the query was activated, but it was not
properly highlighted as active, now using the shortcut shows
correctly the input field as active.

The text selection is used as search query only if the mouse is
over the main region of the text space and if the selection is in
just one line.

Now when using the shortcut/operator to begin search in the text editor the active text selection is used as search query. Also previously while using the operator to begin search, the input field that contains the query was activated, but it was not properly highlighted as active, now using the shortcut shows correctly the input field as active. The text selection is used as search query only if the mouse is over the main region of the text space and if the selection is in just one line.
Guillermo Venegas added 1 commit 2023-11-21 20:31:28 +01:00
Guillermo Venegas requested review from Pablo Vazquez 2023-11-21 20:33:07 +01:00
Guillermo Venegas requested review from Harley Acheson 2023-11-21 20:33:07 +01:00
Author
Contributor

<video src="/attachments/acff306c-f6c7-44e3-b2f5-f59c6f1476de" title="2023-11-21 14-46-50.mp4" controls></video>
Author
Contributor

find_set_selected, does the same thing in some way, but that operator copies the selected text and looks for the next location

Personally, I am more used to pressing ctrl + f and having a search window open with the text I have selected and search the next or previous one

`find_set_selected`, does the same thing in some way, but that operator copies the selected text and looks for the next location Personally, I am more used to pressing `ctrl + f` and having a search window open with the text I have selected and search the next or previous one
Member

Hey, that works really well. I especially like how it properly activates the Find box with text cursor too.

I like that it only puts the selected text into the Find box for single-line selections. This means we could potentially still an option later to search within the selected text only (assuming it is multiline). But this should probably be in a comment, like alter your existing comment to something like "Use active text selection as a search query, if single line" or similar.

There is only one part that feels a bit off, but could be intentional. If I have searched for something earlier, but now the sidebar is closed. I select multiple lines of text, then press Ctrl-F. The sidebar pops out nicely, the Find box is activated, but the last search string is in there. Is the last search string useful in this case or should the search text just be blank?

Hey, that works really well. I especially like how it properly activates the Find box with text cursor too. I like that it only puts the selected text into the Find box for single-line selections. This means we could potentially still an option later to search within the selected text only (assuming it is multiline). But this should probably be in a comment, like alter your existing comment to something like "Use active text selection as a search query, if single line" or similar. There is only one part that feels a bit off, but could be intentional. If I have searched for something earlier, but now the sidebar is closed. I select multiple lines of text, then press Ctrl-F. The sidebar pops out nicely, the Find box is activated, but the last search string is in there. Is the last search string useful in this case or should the search text just be blank?
Author
Contributor

Is the last search string useful in this case or should the search text just be blank

It also happens without selection, but I don't have a strong opinion about it.
I feel that it can be useful to be able to continue searching what we were already looking for, change the search string only if selection is in a single line.

With search highlight feels better (#115417)

> Is the last search string useful in this case or should the search text just be blank It also happens without selection, but I don't have a strong opinion about it. I feel that it can be useful to be able to continue searching what we were already looking for, change the search string only if selection is in a single line. With search highlight feels better (https://projects.blender.org/blender/blender/pulls/115417) <video src="/attachments/8f371203-8fd0-434f-8989-6064d393e118" title="2023-11-29 16-23-49.mp4" controls></video>
Member

It also happens without selection, but I don't have a strong opinion about it.

Yes, I'm not sure either. I guess what I worry about is the differing result if you select a portion of a line and press Ctrl-F versus selecting a portion that spans two lines. Having it blank in the latter keeps from not noticing.

With search highlight feels better (#115417)

Oh that is nice! You have to finish that baby. I can imagine it being a bit different with syntax highlighting on.

> It also happens without selection, but I don't have a strong opinion about it. Yes, I'm not sure either. I guess what I worry about is the differing result if you select a portion of a line and press Ctrl-F versus selecting a portion that spans two lines. Having it blank in the latter keeps from not noticing. > With search highlight feels better (https://projects.blender.org/blender/blender/pulls/115417) Oh that is nice! You have to finish that baby. I can imagine it being a bit different with syntax highlighting on.
Guillermo Venegas added 2 commits 2023-11-30 16:12:08 +01:00
Member

@blender-bot build

@blender-bot build
Member

I guess I also don't have a strong opinion on that. I think we should just put this in as an obvious solution and we can adjust that behavior later if need be.

I guess I also don't have a strong opinion on that. I think we should just put this in as an obvious solution and we can adjust that behavior later if need be.
Harley Acheson approved these changes 2023-11-30 18:23:54 +01:00
Harley Acheson left a comment
Member

Love it.

Love it.
Harley Acheson added 1 commit 2023-11-30 18:24:36 +01:00
Harley Acheson merged commit cf08b088ba into main 2023-11-30 18:27:02 +01:00
Guillermo Venegas deleted branch quick-search 2023-11-30 19:57:39 +01:00
Author
Contributor

I've been testing and I think it may be a matter of preference.
By the way, is find_set_selected is still useful?
This operator allows to put multi line text in find_text, the search only allow matches in single lines

I've been testing and I think it may be a matter of preference. By the way, is `find_set_selected` is still useful? This operator allows to put multi line text in `find_text`, the search only allow matches in single lines
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#115247
No description provided.