sublime-selectuntil icon indicating copy to clipboard operation
sublime-selectuntil copied to clipboard

Swap directions by hitting the shortcut a second time

Open adzenith opened this issue 11 years ago • 5 comments

I love this plugin, but I find it searching backwards to be more difficult than I'd like - I have to add a minus, and square brackets, etc. These changes (which include the commit in https://github.com/xavi-/sublime-selectuntil/pull/7) let you switch the search direction back and forth just by hitting the shortcut again. Also included are some display fixes that work around bugs in Sublime's input panel (commit 7d04bda).

adzenith avatar Aug 19 '13 06:08 adzenith

Hello,

Thanks for the commits. I'm currently in Italy on vacation so it might be a while before I get chance to throughly look at the changes -- a week or so. Just didn't want you to think that I was ignoring the pull requests. =)

Hitting the shortcut again to toggle reverse search is very clever.

Thanks again, Xavi On Aug 19, 2013 8:56 AM, "Nikolaus Wittenstein" [email protected] wrote:

I love this plugin, but I find it searching backwards to be more difficult than I'd like - I have to add a minus, and square brackets, etc. These changes (which include the commit in #7https://github.com/xavi-/sublime-selectuntil/issues/7) let you switch the search direction back and forth just by hitting the shortcut again. Also included are some display fixes that work around bugs in Sublime's input panel (commit 7d04bdahttps://github.com/xavi-/sublime-selectuntil/commit/7d04bda

).

You can merge this Pull Request by running

git pull https://github.com/adzenith/sublime-selectuntil direction-swap

Or view, comment on, or merge it at:

https://github.com/xavi-/sublime-selectuntil/pull/8 Commit Summary

  • Change the way pending changes are drawn
  • Add clean_up command for on_cancel and on_done
  • Fix getting called a second time while open
  • Search regex never fails
  • Simplify logic in find_matching_point
  • Swap search direction on the second press of the shortcut
  • Don't swap direction if changing between extending and not extending selection
  • Don't switch direction if the panel is open but unfocussed

File Changes

  • M README.mdhttps://github.com/xavi-/sublime-selectuntil/pull/8/files#diff-0(4)
  • M select-until.pyhttps://github.com/xavi-/sublime-selectuntil/pull/8/files#diff-1(86)

Patch Links:

  • https://github.com/xavi-/sublime-selectuntil/pull/8.patch
  • https://github.com/xavi-/sublime-selectuntil/pull/8.diff

xavi- avatar Aug 19 '13 12:08 xavi-

Awesome, thanks! Enjoy your vacation!

adzenith avatar Aug 19 '13 14:08 adzenith

What do you think of the idea of instead of getting rid of the minus sign, hitting the shortcut a multiple times automatically inserts (or removes) the minus sign. For example:

  • User hits shortcut
  • Types "hello"
  • User hits shortcut again
  • Show panel automatically changes to "-[hello]", with "hello" highlighted

This way we can preserve backwards compatibility.

xavi- avatar Aug 24 '13 20:08 xavi-

I got a rough implementation working (at least in sublime 2). If you don't mind, I'm gonna take a couple of your ideas (and maybe commits) and implement the feature request.

xavi- avatar Aug 25 '13 23:08 xavi-

reverse selection doesn't work in any of the both ways mentioned on ST 3 Build 3059

ctf0 avatar May 16 '14 20:05 ctf0