sublimehq/sublime_text

Expand selection does not expanding correctly

Closed this issue · 4 comments

Description

Using the 'expand selection' menu item does not result in predictable selections.

Steps to reproduce

create a CSS file with the following content:

.selector-1 {
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    color: #dedede;
    flex-wrap: nowrap;
}

.selector-2 {
    flex: 0 0 15px;
    color: #dcdcdc;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}
  1. Place caret somewhere inside the braces of a selector
  2. invoke 'expand selection' from menu or shortcut

Expected behavior

I would expect it to select: word, word and symbol, line, within braces, braces plus selector name

Actual behavior

Seems to break when hitting color if color present, when no color present, selects straight from word to whole curly braces (missing line selection)

Reference files are this issue plus VScode as comparative example:

selection2.mov
selection-vscode.mov

Environment

  • Build: 4102
  • Operating system and version: macOS 10.15.7

Seems to work as expected including line selection with ST4102 on Windows 10.

The command called is: command: expand_selection {"to": "smart"}

in SAFE MODE

Animation

normal setup

Animation

@deathaxe edited due to error between keyboard and chair :)

For future travelers, it was kind of plugin related. Bracket Highlighter had this in the docs: https://facelessuser.github.io/BracketHighlighter/usage/ to add to Preferences.

	    "match_brackets": false,
    "match_brackets_angle": false,
    "match_brackets_braces": false,
    "match_brackets_content": false,
    "match_brackets_square": false,
    "match_tags": false,

Once I removed those lines from preferences, all worked predictably. Have opened an issue there: facelessuser/BracketHighlighter#582

Thanks for the assistance.

I would argue that this is still an undesirable behavior in Sublime. Just because a user wants to hide visual bracket matching, I think completely disabling bracket expansion behavior makes no sense. I'd argue this should change in Sublime IMHO. I think match_brackets and such should hide the visual indication if turned off, but not entirely disable all bracket related functionality.

While I still stand by my original statement about disabling the visualization vs disabling the entire set of bracket features, I'm thinking that the better recommendation is to just have people override these options in their themes if they don't want Sublime bracket visualizations clashing with BH:

		"bracket_contents_options": "none",
        "brackets_options": "none",
		"tags_options": "none"