Repository: vscode
Issue: Selection, highlighting and search colors conflict with each other
Labels: feature-request,editor-theming

- VSCode Version: Code 1.16.0 (787b31c0474e6165390b5a5989c9619e3e16f953, 2017-09-06T16:27:49.891Z)
- OS Version: Windows_NT x64 6.1.7601
- Extensions: 

Extension|Author (truncated)|Version
---|---|---
intellij-idea-keybindings|k--|0.2.13
selectline-statusbar|tom|0.0.2

<!-- Launch with `code --disable-extensions` to check. -->
Reproduces without extensions: Yes

---

Background colors for the editor selection, word highlighting and search matches all conflict with each other in an unexpected way, which seems to be caused by multiple bugs in color priorities and mixing rules.

### Text selection color is not restored after searching
The following rules set all three highlighting colors to `#FF0000` and text selection to `#00FF00` on a black background. 

    "workbench.colorCustomizations": {
        "editor.background": "#000000",
        "editor.foreground": "#FFFFFF",
        "editor.lineHighlightBackground": "#000000",
        "editor.selectionHighlightBackground": "#FF0000",
        "editor.findMatchBackground": "#FF0000",
        "editor.findMatchHighlightBackground": "#FF0000",
        "editor.findRangeHighlightBackground": "#000000",
        "editor.selectionBackground": "#00FF00",
        "editor.inactiveSelectionBackground": "#00FF00"
    }

Normal selection works as expected:

![2017-09-11_00-37-43](https://user-images.githubusercontent.com/7759622/30253230-6a5fb4aa-9689-11e7-9587-d2fa735e04d0.gif)

**Case 1**: put the cursor at the start of the second line and press Ctrl+D ("Add Selection To Next Find Match") three times, none of the three selections become partially or completely green. Since there's no search bar opened, I expect the text selection color to apply here. Pressing Shift+Left to shrink selection re-applies the selection color:

![2017-09-10_20-48-29](https://user-images.githubusercontent.com/7759622/30251514-5631aa30-9669-11e7-8102-1d6e204be5e5.gif)

Changing both `editor.findMatch*` settings to different colors and repeating the steps above doesn't change anything, selected regions are still red.

This is even more confusing if you use the search bar, because multiple cursors for Ctrl+D don't get drawn or animated in that mode (**case 2**). 

**Case 3**: put the cursor at the start of the file, press Ctrl+F, type "aaa", press Esc (here I expect green color to be applied to the selection, but it doesn't), press Shift+Left. Only then the selection color appears.

![2017-09-10_20-22-40](https://user-images.githubusercontent.com/7759622/30251300-c0cafa9e-9665-11e7-904f-08a5c39d1103.gif)

This looks a bit different if `editor.findMatchBackground` is set to `#0000FF`, but the green color is still not applied after hitting Esc:

![2017-09-10_21-12-57](https://user-images.githubusercontent.com/7759622/30251654-c1c89134-966c-11e7-8fca-f7f83f566549.gif)

**Case 4**: while "aaa" is still the last searched term, put the cursor at the start of the file, press F3 ("Find Next") and then Esc. This is the only way I could force the green selection color to appear right after using the search:

![2017-09-10_20-34-21](https://user-images.githubusercontent.com/7759622/30251443-eec11fa8-9667-11e7-83c7-222bca9740c5.gif)

**Case 5**: there's something weird going on with the first match. If you repeat the steps from the case above but press F3 several times, after hitting Esc the color of the first match disappears completely:

![2017-09-10_20-42-42](https://user-images.githubusercontent.com/7759622/30251498-e0786bf8-9668-11e7-95aa-58011f9d4894.gif)

---
Expected behavior for all cases above: `editor.selectionBackground` color should be applied to all selected regions when the selection is made without opening the search bar or after it was closed.

### Inconsistent blending of `findMatch*` colors
The following rules set text selection to `#303030` (to affect other colors as little as possible), regions with the same content as selection to `#FF0000`, and current/other search matches to `#0000FF`/`#00FF00`. 

    "workbench.colorCustomizations": {
        "editor.background": "#000000",
        "editor.foreground": "#FFFFFF",
        "editor.lineHighlightBackground": "#000000",
        "editor.selectionHighlightBackground": "#FF0000",
        "editor.findMatchBackground": "#0000FF",
        "editor.findMatchHighlightBackground": "#00FF00",
        "editor.findRangeHighlightBackground": "#000000",
        "editor.selectionBackground": "#303030",
        "editor.inactiveSelectionBackground": "#303030"
    }

In this setup, depending on how and where the search bar is opened, the highlighting of matches changes in an unpredictable and seemingly random way.

**Case 6**: remove the last searched term from the search bar, put the cursor at the start of the file, press Ctrl+F, type "aaa", press Enter or F3 several times. Both `editor.findMatch*` are blended with alpha 50% with the red `editor.selectionHighlightBackground` .

![2017-09-10_22-49-54](https://user-images.githubusercontent.com/7759622/30253129-7e2c12aa-9687-11e7-887a-ce320d84756a.gif)

**Case 7**: while "aaa" is the last searched term, put the cursor at the start of the file, press Ctrl+F, then F3 or Enter several times. Unblended green `editor.findMatchHighlightBackground` appears until you select search matches, then it changes to blended colors from the previous case. 

![2017-09-11_00-10-25](https://user-images.githubusercontent.com/7759622/30253025-83d9a520-9685-11e7-9e08-01a563346a71.gif)

**Case 8**: while "aaa" is the last searched term, put the cursor at the start of the file and press F3 several times (same as in case 5). All colors are unblended, but  `editor.findMatch*` apply only to the first match.

![2017-09-11_00-20-51](https://user-images.githubusercontent.com/7759622/30253093-fd4c348a-9686-11e7-9580-ce571d190c68.gif)

**Case 9**: put the cursor at the start of the second line and press F3 several times. None of `editor.findMatch*` apply at all.

![2017-09-11_00-29-05](https://user-images.githubusercontent.com/7759622/30253159-244ce290-9688-11e7-99f2-223c125777c9.gif)

---
In all four cases the expected behavior would be to apply `editor.findMatch*` correctly no matter how the search was triggered. Also, blending is undocumented and very unexpected: `editor.selection*` and  `editor.findMatch*` pairs seem to be designed to mirror each other, with each active only in their respective editor mode. But only `editor.selectionHighlightBackground` is blended with one or both colors from the other pair, and there's no way to influence or override this. Since there are two pairs, blending seems completely unnecessary to me.