From f012418d62df5f6cd50382707f6677ab2741e3f8 Mon Sep 17 00:00:00 2001 From: chrys87 Date: Tue, 23 Aug 2016 17:37:39 +0200 Subject: [PATCH] Update marked_text.py --- .../commands/commands/marked_text.py | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/fenrir-package/commands/commands/marked_text.py b/src/fenrir-package/commands/commands/marked_text.py index 97e2af63..e3786103 100644 --- a/src/fenrir-package/commands/commands/marked_text.py +++ b/src/fenrir-package/commands/commands/marked_text.py @@ -1,16 +1,23 @@ #!/bin/python +from utils import mark_utils class command(): def __init__(self): pass def run(self, environment): - if len(environment['commandBuffer']['clipboard']) == 0: - environment['runtime']['outputManager'].presentText(environment, 'clipboard empty', interrupt=True) - return environment - environment['commandBuffer']['currClipboard'] = 0 - environment['runtime']['outputManager'].presentText(environment, environment['commandBuffer']['clipboard'][environment['commandBuffer']['currClipboard']], interrupt=True) - return environment + if (environment['commandBuffer']['Marks']['1'] == None) or \ + (environment['commandBuffer']['Marks']['2'] == None): + environment['runtime']['outputManager'].presentText(environment, "two marks needed", interrupt=True) + return environment + + marked = mark_utils.getTextBetweenMarks(environment['commandBuffer']['Marks']['1'], environment['commandBuffer']['Marks']['2'], environment['screenData']['newContentText']) + + if marked.strip(" \t\n") == '': + environment['runtime']['outputManager'].presentText(environment, "blank", soundIcon='EmptyLine', interrupt=True) + else: + environment['runtime']['outputManager'].presentText(environment, marked, interrupt=True) + return environment def setCallback(self, callback): pass def shutdown(self): - pass +pass