Home Download Buy Blog Forum Support

[bug] ctrl-backspace deletes extra space.

[bug] ctrl-backspace deletes extra space.

Postby SteveCooperOrg on Sat Oct 03, 2009 10:40 pm

Summary:

In beta 20091002, ctrl+backspace deletes a character and the preceding whitespace. In previous versions, and in most other text editors, ctrl+backspace deletes only the word adjascent to the cursor.

Steps to reproduce:

write the sentence "I made a spelling misakte'. Hit Hit ctrl-backspace to delete the badly-spelled word. Type the correct word 'mistake'.

Expected behaviour:

The text on screen reads 'I made a spelling mistake'.

Actual behaviour:

The text reads 'I made a spellingmistake'.

Version Seen in:

beta 20091002

Steve.
Maybe what you're looking for is at the http://www.sublimetextwiki.com
SteveCooperOrg
 
Posts: 193
Joined: Thu Mar 20, 2008 9:53 am

Re: [bug] ctrl-backspace deletes extra space.

Postby jps on Sat Oct 03, 2009 11:57 pm

This was introduced in 20090620, when the macro for ctrl+backspace was changed from:

Code: Select all
move words -1 extend
leftDeleteCharacters


to

Code: Select all
move wordends -1 extend
leftDeleteCharacters


both of these don't work in different ways... I'll replace the macro with a bit of python, unless someone has already written a proper implementation of ctrl+backspace?
jps
Site Admin
 
Posts: 3062
Joined: Wed Mar 19, 2008 12:33 pm

Re: [bug] ctrl-backspace deletes extra space.

Postby jps on Sun Oct 04, 2009 3:04 pm

This is fixed in 20091004
jps
Site Admin
 
Posts: 3062
Joined: Wed Mar 19, 2008 12:33 pm

Re: [bug] ctrl-backspace deletes extra space.

Postby SteveCooperOrg on Mon Oct 05, 2009 9:05 am

Genius. Cheers.
Maybe what you're looking for is at the http://www.sublimetextwiki.com
SteveCooperOrg
 
Posts: 193
Joined: Thu Mar 20, 2008 9:53 am

Re: [bug] ctrl-backspace deletes extra space.

Postby aparajita on Fri Aug 05, 2011 7:48 pm

This bug reappeared in ST2. The cause is this block of code from lines 62-67 of delete_word.py:

Code: Select all
        # If there's a single space after the word, eat that too if setting says to
        if not did_eat_extra_space and len(txt) > count and at_boundary:
            is_single_trailing_space = ((classify(txt[count], classes) == 0)
                and (count + 1 == len(txt) or classify(txt[count + 1], classes) != 0))
            if is_single_trailing_space:
                count += 1


If that block is removed/disabled, the bug disappears. If some people like the current behavior, then perhaps a "delete_space_with_word" setting could be checked in the first if condition.
aparajita
 
Posts: 177
Joined: Sun Jul 24, 2011 10:42 pm

Re: [bug] ctrl-backspace deletes extra space.

Postby jps on Fri Aug 05, 2011 11:02 pm

This is by design
jps
Site Admin
 
Posts: 3062
Joined: Wed Mar 19, 2008 12:33 pm

Re: [bug] ctrl-backspace deletes extra space.

Postby aparajita on Sat Aug 06, 2011 12:29 am

jps wrote:This is by design


Fine, but it most definitely is not what some people want. For example, I have this code:

Code: Select all
if (foo === bar)


The cursor is at the end of "bar". I trigger delete word. I don't want the space before "bar" to be deleted, I just want to replace the word "bar". For me at least, 90% of the time I do not want the space deleted along with the word because I am replacing the word. That's why I suggest the following:

Code: Select all
        # If there's a single space after the word, eat that too if setting says to
        if not did_eat_extra_space and len(txt) > count and at_boundary and view.settings().get("delete_space_with_word", True):


This way we at least have the option to change the default behavior without copying and tweaking the command ourselves.
aparajita
 
Posts: 177
Joined: Sun Jul 24, 2011 10:42 pm


Return to Technical Support

Who is online

Users browsing this forum: Yahoo [Bot] and 19 guests