mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-01-22 20:49:47 +08:00
reader: Apply fish_color_selection fg color and options in vi visual mode
Vi visual mode selection highlighting behaves unexpectedly when the selection
foreground and background in the highlight spec don't match. The following
unexpected behaviors are:
* The foreground color is not being applied when defined by the
`fish_color_selection` variable.
* `set_color` options (e.g., `--bold`) would not be applied under the cursor
when selection begins in the middle of the command line or when the cursor
moves forward after visually selecting text backward.
With this change, visual selection respects the foreground color and any
`set_color` options are applied consistently regardless of where visual
selection begins and the position of the cursor during selection.
(cherry picked from commit 4ed53d4e3f
)
This commit is contained in:
parent
cf535f0f76
commit
5df36130b7
|
@ -1212,7 +1212,7 @@ void reader_data_t::paint_layout(const wchar_t *reason) {
|
|||
|
||||
// Apply any selection.
|
||||
if (data.selection.has_value()) {
|
||||
highlight_spec_t selection_color = {highlight_role_t::normal, highlight_role_t::selection};
|
||||
highlight_spec_t selection_color = {highlight_role_t::selection, highlight_role_t::selection};
|
||||
auto end = std::min(selection->stop, colors.size());
|
||||
for (size_t i = data.selection->start; i < end; i++) {
|
||||
colors.at(i) = selection_color;
|
||||
|
|
Loading…
Reference in New Issue
Block a user