Files
mgpinf 85409e57a3 Option to disable attributes for non matching text in quick select mode (#6683)
* feat: optionally disable non-matching text attributes in Quick Select

Add a configuration option
'disable_attributes_for_non_matching_text_in_quick_select' that disables
all attributes for non-matching text in Quick Select Mode.
The default value for
'disable_attributes_for_non_matching_text_in_quick_select' is false

This resolves the issue https://github.com/wezterm/wezterm/issues/4022

* docs: documentation for disabling attributes for non matching text in QuickSelect

Add documentation for the below configuration option:
- `disable_attributes_for_non_matching_text_in_quick_select`

* feat: display quick select label and match in bold

* refactor: fetch colors from existing reference to config

* fix: reset additional attributes for non matching text

Reset additional below mentioned attributes to default for non matching
text if the configuration option
disable-attributes-for-non-matching-text-in-quick-select-mode is true
- Italic
- Blink
- StrikeThrough
- Invisible
- Hyperlink

* fix: update attributes to reset

* feat: add reset_attributes function in termwiz cell

Add reset_attributes function in termwiz cell
Use the above function to reset cell attributes for the cell

* refactor: update method name to clear_attributes

* termwiz: update version because public method has been added

Update termwiz version because a new method 'reset_attributes' has been
added in termwiz/src/cell.rs

* fix: update get_lines method in quickselect to be same as with_lines_mut

* termwiz: simpler method name, implementation to clear cell attributes

Use simpler method name and implementation as per suggestion
https://github.com/wezterm/wezterm/pull/6683#discussion_r1966596988

* refactor: clear cell attributes for every line if flag is set

Clear attributes for every line if the configuration option
disable-attributes-for-non-matching-text-in-quick-select has been set
Partially implement changes mentioned in suggestion
https://github.com/wezterm/wezterm/pull/6683#discussion_r1966597826

* refactor: replace for loop with for_each method to iterate through cells

Partially implement changes mentioned in suggestion
https://github.com/wezterm/wezterm/pull/6683#discussion_r1966597826

* refactor: rename configuration option to quick_select_remove_styling

Rename option to remove styling in quick select from
'disable_attributes_for_non_matching_text_in_quick_select' to
'quick_select_remove_styling'
Implement changes mentioned in suggestion
https://github.com/wezterm/wezterm/pull/6683#discussion_r1966598496

* fix: remove bold attribute when displaying quick select label, match

This is in order to raise this in a separate PR

Suggestion mentioned here
https://github.com/wezterm/wezterm/pull/6683#issuecomment-2676394535

* docs: update documentation for quick_select_remove_styling

* termwiz: just bump minor part

Since the only change in termwiz is addition of a public method, it
should be forward compatible, so we can just bump the minor part

Apply changes mentioned in suggestion
https://github.com/wezterm/wezterm/pull/6683#discussion_r1966600258

* fix: clear attributes for each cell in all lines in get_lines method

Apply changes mentioned in suggestion
https://github.com/wezterm/wezterm/pull/6683#discussion_r1966848308

* fix: clear appdata for line after clearing attributes of each cell

Move call to clear appdata for line after the call to clear attributes
from each cell when configuration option 'quick_select_remove_styling'
is enabled
Apply changes mentioned in suggestion
https://github.com/wezterm/wezterm/pull/6683#discussion_r1966848015
2025-02-23 15:37:09 -07:00

41 lines
1.8 KiB
Markdown

{{since('20210502-154244-3f7122cb')}}
Quick Select mode allows you to quickly highlight text that matches
commonly copied patterns, select a match by typing a one-or-two character
prefix and copy it to the clipboard.
The `QuickSelect` key assignment is used to enter quick select mode; it is
bound to `CTRL-SHIFT-SPACE` by default.
When quick select mode is activated, the terminal is searched for items that
match the patterns defined by the
[quick_select_patterns](config/lua/config/quick_select_patterns.md)
configuration combined with a default set of patterns that match things such as
URL and path fragments, git hashes, ip addresses and numbers.
Matches are highlighted and shown with a one or two character prefix derived
from the [quick_select_alphabet](config/lua/config/quick_select_alphabet.md)
configuration. The [colors](config/appearance.md#defining-your-own-colors)
of the highlighted text can be configured.
The bottom of the screen shows your input text along with a hint as to what to
do next; typing in a highlighted prefix will cause that text to be selected and
copied to the clipboard, and quick select mode will be cancelled.
Typing in the uppercase form of the prefix will copy AND paste the highlighted
text, and cancel quick select mode.
Pressing `ESCAPE` will cancel quick select mode.
![Screenshot demonstrating the quickselect text highlights](screenshots/wezterm-quick-select.png)
{{since('nightly')}}
A configuration option [quick_select_remove_styling](config/lua/config/quick_select_remove_styling.md)
has been added which when set to `true`, results in all color and styling
being removed from the pane prior to performing matching and highlighting
any matching text in quick select mode.
This can make it easier to focus on the matches, particularly when the pane
already had a lot of styling and colors.