Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2861fc7

Browse files
Fix problem with not checking None values in a nearest_node_from_offset
relevant to their factoring going on due to #19 The loop was not checking if the token produced is None which caused problems when the cursor Was at the beginning of the file in an empty line
1 parent cb0fb87 commit 2861fc7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

‎library/selection_node.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ def nearest_node_from_offset(root,atok,offset,special=False):
1111
converter = atok._line_numbers
1212
original_token = atok.get_token_from_offset(offset)
1313
token = original_token
14-
while token.string.isspace() or nottoken.string:
14+
while tokenand (nottoken.string or token.string.isspace()):
1515
token = previous_token(atok,token)
16-
if converter.offset_to_line(offset)[0] != converter.offset_to_line(token.startpos)[0]:
16+
if nottokenorconverter.offset_to_line(offset)[0] != converter.offset_to_line(token.startpos)[0]:
1717
following = next_token(atok,original_token)
1818
while following and following.string.isspace():
1919
token = following

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /