add indent command

This commit is contained in:
chrys 2016-08-28 21:24:01 +02:00
parent e525c486e9
commit f0039f957e
4 changed files with 28 additions and 0 deletions

View File

@ -10,6 +10,7 @@
1-KEY_KP1=prev_char
1-KEY_KP3=next_char
#=cursor_position
#=indent_curr_line
1-KEY_KPDOT=exit_review
#=curr_screen
#=curr_screen_before_cursor

View File

@ -14,6 +14,7 @@
#=curr_screen
#=curr_screen_before_cursor
#=curr_screen_after_cursor
#=indent_curr_line
#=last_incomming
1-KEY_CAPSLOCK,1-KEY_F2=toggle_braille
1-KEY_CAPSLOCK,1-KEY_F3=toggle_sound

View File

@ -14,6 +14,7 @@
#=curr_screen
#=curr_screen_before_cursor
#=curr_screen_after_cursor
1-FENRIR,1-KEY_P=indent_curr_line
#=last_incomming
1-FENRIR,1-KEY_F2=toggle_braille
#1-FENRIR,1-KEY_F3=toggle_sound

View File

@ -0,0 +1,25 @@
#!/bin/python
from utils import line_utils
class command():
def __init__(self):
pass
def run(self, environment):
# Prefer review cursor over text cursor
if (environment['screenData']['newCursorReview'] != None):
cursorPos = environment['screenData']['newCursorReview'].copy()
else:
cursorPos = environment['screenData']['newCursor'].copy()
x, y, currLine = \
line_utils.getCurrentLine(cursorPos['x'], cursorPos['y'], environment['screenData']['newContentText'])
if currLine.strip() == '':
environment['runtime']['outputManager'].presentText(environment, "blank", soundIcon='EmptyLine', interrupt=True)
else:
environment['runtime']['outputManager'].presentText(environment, "indent "+ str(len(currLine) - len(currLine.lstrip())), interrupt=True)
return environment
def setCallback(self, callback):
pass
def shutdown(self):
pass