Home Download Buy Blog Forum Support

Small bug in find panel

Small bug in find panel

Postby edanm on Sun Apr 11, 2010 1:26 pm

In the find panel, when hitting ctrl+backspace to delete the last word, it will always leave 2 letters.

For example, if I have this in the find bar:
"this is a test example"

Then after hitting numerous ctrl+backspaces, I'll still be left with:
"th".
In the find panel, when hitting ctrl+backspace to delete the last word, it will always leave 2 letters.

For example, if I have this in the find bar:
"this is a test example"

Then after hitting numerous ctrl+backspaces, I'll still be left with:
"th".
edanm
 
Posts: 131
Joined: Thu Mar 04, 2010 11:05 pm

Re: Small bug in find panel

Postby jbrooksuk on Sun Apr 11, 2010 4:24 pm

I'm not experiencing such behaviour. Are you using beta?
jbrooksuk
 
Posts: 782
Joined: Sun Apr 11, 2010 10:37 am
Location: England

Re: Small bug in find panel

Postby tgkeul on Sun Apr 11, 2010 7:41 pm

I'm always using the current beta and this behavior is annoying me a long time. Maybe because of my non default keybinding ?
Code: Select all
  <binding key="ctrl+backspace" command="leftEraseByCharClass"/>
tgkeul
 
Posts: 140
Joined: Tue Dec 02, 2008 9:35 pm

Re: Small bug in find panel

Postby jbrooksuk on Sun Apr 11, 2010 7:44 pm

Try turning it off. I don't have that custom key binding so it might well be the problem.
jbrooksuk
 
Posts: 782
Joined: Sun Apr 11, 2010 10:37 am
Location: England

Re: Small bug in find panel

Postby tgkeul on Sun Apr 11, 2010 7:48 pm

Why should I turn this keybinding off?
I selected it with intent and not by random. I'm using sublime a little longer than two days.
tgkeul
 
Posts: 140
Joined: Tue Dec 02, 2008 9:35 pm

Re: Small bug in find panel

Postby jbrooksuk on Sun Apr 11, 2010 8:56 pm

You turn it off to test that the binding isn't the problem.
jbrooksuk
 
Posts: 782
Joined: Sun Apr 11, 2010 10:37 am
Location: England

Re: Small bug in find panel

Postby jps on Sun Apr 11, 2010 10:48 pm

leftEraseByCharClass isn't a built-in command - you'll have to check its source code
jps
Site Admin
 
Posts: 3077
Joined: Wed Mar 19, 2008 12:33 pm

Re: Small bug in find panel

Postby edanm on Mon Apr 12, 2010 6:06 am

UPDATE:

I checked it out, turns out it *was* leftEraseByCharClass. I forgot that PowerUser added that binding.
Turning it off makes the bug disappear.

I'll have a look at the source code later, try and find the source of the bug.

Thanks!
edanm
 
Posts: 131
Joined: Thu Mar 04, 2010 11:05 pm

Re: Small bug in find panel

Postby tgkeul on Sat Apr 17, 2010 8:50 am

I changed "while pos > 1" to "while pos >=0" to get rid of the 2 letters
Original see http://www.sublimetext.com/forum/viewtopic.php?f=5&t=158&p=852&hilit=erase#p852
Code: Select all
class LeftEraseByCharClassCommand (sublimeplugin.TextCommand):
  def run (self, view, args):
    # patterns
    space_pattern  = re.compile (r"\s")
    word_pattern   = re.compile (r"\w")
    symbol_pattern = re.compile (r"[^\w\s]")

    for region in view.sel():
      pos = region.end()-1

      # check last char
      if word_pattern.match (view.substr (pos)):
        pattern = word_pattern
      elif space_pattern.match (view.substr (pos)):
        pattern = space_pattern
      else :
        pattern = symbol_pattern

      # removes according to last char
      while pos >= 0 and pattern.match (view.substr (pos)):
        view.erase (sublime.Region (pos, pos+1))
        pos -= 1
tgkeul
 
Posts: 140
Joined: Tue Dec 02, 2008 9:35 pm


Return to Ideas and Feature Requests

Who is online

Users browsing this forum: Exabot [Bot] and 8 guests