Sublime Forum

'Expand selection to tag' ST3 issue

#1

I have a problem when I’m trying to expand my selection to any empty HTML tag it fails and cancel all my selections. that does happen only on Sublime Text 3
I had no issue using it in Sublime Text 2. can you please look into that and let me know if you have any ideas!
I’m using build 3114 on Mac.

0 Likes

#3

Thanks for your reply @kingkeith.
The link you provided is very helpful, unfortunately, this isn’t my issue case.
what I’m trying to do is to mark multi-selections and then move my cursors inside these tags even when it doesn’t have content in it.
this achieved by ‘Expand Selection To Tag’ (cmd + shift + a) option. it does work when i have anything inside these tags. usually, i make these tags empty to fill it out by this way

0 Likes

#5

Confirmed (on 3113 on Windows 7 x64). Reproduction steps:

  1. open a new tab
  2. set the syntax to HTML
  3. type html
  4. press Tab
  5. move the cursor to <ti|tle></title> where | represents the cursor
  6. Selection menu -> Expand Selection to Tag

0 selection regions

Expected behavior:

  1. put the cursor at <title>|</title> and try again, and it selects everything between the | chars: |<title></title>|

Please consider logging an issue here for it: https://github.com/SublimeTextIssues/Core/issues

as command: expand_selection {"to": "tag"} is built in to ST

2 Likes

#6

Found another issue while experimenting.

  1. Have these contents:
<head><title>  </title></head>
  1. Run the expand selection to tag command (anywhere, can take a few iterations) until you get this:
<head>[<title>  </title>]|</head>

where [, ], and | represent a selection (and the caret position).
3. Run the command again any number of times and observe no change in the selection.

For comparison, this works:

<head> <title>  </title> </head>
2 Likes

#7

@FichteFoll you have a better way of representing selections than I do :smiley:

yeah, I can confirm the same. It should expand up to the “next” parent tag each time you run it, as it does to get from <head><title>[ ]|</title></head> to <head>[<title> </title>]|</head>

0 Likes

#8

Okay, I have logged it here: https://github.com/SublimeTextIssues/Core/issues/1223

1 Like

#9

@kingkeith @FichteFoll Thank you guys for experimenting on this issue and logging it on Github.

0 Likes