add review_line_last_char
This commit is contained in:
parent
09a4d60e0a
commit
0d2c095b62
@ -7,6 +7,7 @@ KEY_KP7=review_prev_line
|
||||
KEY_KP9=review_next_line
|
||||
KEY_FENRIR,KEY_KP4=review_line_begin
|
||||
KEY_FENRIR,KEY_KP6=review_line_end
|
||||
#=review_line_last_char
|
||||
KEY_FENRIR,KEY_ALT,KEY_1=present_first_line
|
||||
KEY_FENRIR,KEY_ALT,KEY_2=present_last_line
|
||||
KEY_KP5=review_curr_word
|
||||
|
@ -7,6 +7,7 @@ KEY_FENRIR,KEY_U=review_prev_line
|
||||
KEY_FENRIR,KEY_O=review_next_line
|
||||
KEY_FENRIR,KEY_SHIFT,KEY_J=review_line_begin
|
||||
KEY_FENRIR,KEY_SHFIT,KEY_L=review_line_end
|
||||
#=review_line_last_char
|
||||
KEY_FENRIR,KEY_ALT,KEY_1=present_first_line
|
||||
KEY_FENRIR,KEY_ALT,KEY_2=present_last_line
|
||||
KEY_FENRIR,KEY_K=review_curr_word
|
||||
|
@ -5,8 +5,9 @@ KEY_FENRIR,KEY_KP7=review_top
|
||||
KEY_KP8=review_curr_line
|
||||
KEY_KP7=review_prev_line
|
||||
KEY_KP9=review_next_line
|
||||
KEY_FENRIR,KEY_KP6=review_line_end
|
||||
#KEY_FENRIR,KEY_KP6=review_line_end
|
||||
KEY_FENRIR,KEY_KP5=review_line_begin
|
||||
KEY_FENRIR,KEY_KP6=review_line_last_char
|
||||
#=present_first_line
|
||||
#=present_last_line
|
||||
KEY_KP5=review_curr_word
|
||||
|
@ -0,0 +1,33 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from core import debug
|
||||
from utils import char_utils
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'set review cursor to end of current line and display the content'
|
||||
|
||||
def run(self):
|
||||
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
|
||||
self.env['runtime']['cursorManager'].setReviewCursorPosition(self.env['screenData']['columns']-1 ,cursorPos['y'])
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], lastChar = \
|
||||
char_utils.getLastCharInLine(self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
|
||||
|
||||
if lastChar.strip(" \t\n") == '':
|
||||
self.env['runtime']['outputManager'].presentText("line is empty" ,interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(lastChar ,interrupt=True, ignorePunctuation=True, announceCapital=True)
|
||||
self.env['runtime']['outputManager'].presentText("last char in line", interrupt=False)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
@ -28,6 +28,16 @@ def getCurrentChar(currX,currY, currText):
|
||||
currChar = wrappedLines[currY][currX]
|
||||
return currX, currY, currChar
|
||||
|
||||
def getLastCharInLine(currY, currText):
|
||||
if currText == '':
|
||||
return -1, -1, ''
|
||||
wrappedLines = currText.split('\n')
|
||||
currX = len(wrappedLines[currY].rstrip())-1
|
||||
if currX < 0:
|
||||
currX = 0
|
||||
currChar = wrappedLines[currY][currX]
|
||||
return currX, currY, currChar
|
||||
|
||||
def getNextChar(currX,currY, currText):
|
||||
if currText == '':
|
||||
return -1, -1, ''
|
||||
|
Loading…
Reference in New Issue
Block a user