add indent command
This commit is contained in:
parent
e525c486e9
commit
f0039f957e
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
25
src/fenrir-package/commands/commands/indent_curr_line.py
Normal file
25
src/fenrir-package/commands/commands/indent_curr_line.py
Normal 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
|
Loading…
Reference in New Issue
Block a user