Skip to content

Commit

Permalink
while fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
mrshu committed May 9, 2014
1 parent f0cadd1 commit fc06caf
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions nxted/pystc.py
@@ -1,6 +1,9 @@

import keyword

import wxversion
wxversion.select('2.8')

import wx
import wx.stc as stc
import wx.lib.newevent
Expand Down Expand Up @@ -751,9 +754,13 @@ def label_while_clicked(self, event):
line_num = editor.GetCurrentLine()
indent = editor.GetLineIndentation(line_num - 1) * ' '

# if we are on an empty line
if cur_line[1] == 0:
editor.AddText(indent + 'while True:\n')
# if we are on an empty line (as in there is just whitespace)
if len(cur_line[0].strip()) == 0:
if (cur_line[1] != 0):
editor.AddText('while True:\n')
indent = editor.GetLineIndentation(line_num) * ' '
else:
editor.AddText(indent + 'while True:\n')
editor.AddText(indent + editor.GetIndent() * ' ' + 'pass')
else:
line_num = editor.GetCurrentLine()
Expand Down

0 comments on commit fc06caf

Please sign in to comment.