1
Vote

Format selection failures when editing

description

Given the following code:
print('Hello World')

class SimpleTest(object):
    def test_simple_addition(self):
        pass

    def test_complex(self):
        pass

class Bar(object):
    def say_hello(self):
        pass
(with an empty line at the end of the document)

If you format selection with the cursor on the empty line at the end of the document, it will format the whole document, which it souldn't.

If you format selection with the cursor ON OR AFTER pass in say_hello, it will delete a lot of code.

If you format selection with the cursor at column 0 on pass line in say_hello, it will add an extra ':' between the class and function definition, which makes the code invalid.

comments

huguesv wrote Mar 4, 2013 at 11:48 PM

Ctrl-K+Ctrl-F is format selection, and if there is no selection it applies to the current line. This explains why sometimes it was formatting and sometimes it didn't, it depended on the location of the cursor. There was an issue with format selection when on an empty line, where you got an exception dialog, and this has been fixed.

huguesv wrote Mar 5, 2013 at 12:50 AM

Edit issue description with examples of failures with format selection (you can ignore the comment from 3:48PM)

Zooba wrote Aug 26, 2013 at 10:50 PM

Ctrl+K-Ctrl+F with the empty line's EOL selected will reformat the entire document.