add new command cursor_position

This commit is contained in:
chrys 2016-08-28 19:19:55 +02:00
parent 49aebcec80
commit 0080e1aeb8
8 changed files with 27 additions and 3 deletions

View File

@ -9,6 +9,7 @@
1-KEY_KP2=curr_char
1-KEY_KP1=prev_char
1-KEY_KP3=next_char
#=cursor_position
1-KEY_KPDOT=exit_review
#=curr_screen
#=curr_screen_before_cursor

View File

@ -10,6 +10,7 @@
1-KEY_m=prev_char
1-KEY_DOT=next_char
1-KEY_SLASH=exit_review
#=cursor_position
#=curr_screen
#=curr_screen_before_cursor
#=curr_screen_after_cursor

View File

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

View File

@ -7,7 +7,7 @@ class command():
pass
def run(self, environment):
# Prefer review cursor over text cursor
if (environment['screenData']['newCursorReview'] != None)
if (environment['screenData']['newCursorReview'] != None):
cursorPos = environment['screenData']['newCursorReview'].copy()
else:
cursorPos = environment['screenData']['newCursor'].copy()

View File

@ -7,7 +7,7 @@ class command():
pass
def run(self, environment):
# Prefer review cursor over text cursor
if (environment['screenData']['newCursorReview'] != None)
if (environment['screenData']['newCursorReview'] != None):
cursorPos = environment['screenData']['newCursorReview'].copy()
else:
cursorPos = environment['screenData']['newCursor'].copy()

View File

@ -0,0 +1,20 @@
#!/bin/python
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()
environment['runtime']['outputManager'].presentText(environment, "line "+ str(cursorPos['y']+1) + " column "+ str(cursorPos['x']+1), interrupt=True)
return environment
def setCallback(self, callback):
pass
def shutdown(self):
pass

View File

@ -12,4 +12,4 @@ class command():
def setCallback(self, callback):
pass
def shutdown(self):
pass
pass

View File

@ -24,6 +24,7 @@ class commandManager():
spec.loader.exec_module(command_mod)
environment['commands'][section][fileName] = command_mod.command()
except Exception as e:
print(e)
environment['runtime']['debug'].writeDebugOut(environment,"Error while loading command:" + currCommand ,debug.debugLevel.ERROR)
environment['runtime']['debug'].writeDebugOut(environment,str(e),debug.debugLevel.ERROR)
continue