From 562fa7879516d61dac220c1c4f105399ac569d63 Mon Sep 17 00:00:00 2001 From: chrys Date: Fri, 7 Oct 2016 23:01:43 +0200 Subject: [PATCH] set second mark magical when copy to clipboard --- src/fenrir/commands/commands/copy_marked_to_clipboard.py | 8 +++++--- src/fenrir/core/cursorManager.py | 9 +++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/fenrir/commands/commands/copy_marked_to_clipboard.py b/src/fenrir/commands/commands/copy_marked_to_clipboard.py index 1f6aee86..36d96d3e 100644 --- a/src/fenrir/commands/commands/copy_marked_to_clipboard.py +++ b/src/fenrir/commands/commands/copy_marked_to_clipboard.py @@ -18,10 +18,12 @@ class command(): return 'copies marked text to the currently selected clipboard' def run(self): - if not (self.env['commandBuffer']['Marks']['1'] and \ - self.env['commandBuffer']['Marks']['2']): - self.env['runtime']['outputManager'].presentText("two marks needed", interrupt=True) + if not self.env['commandBuffer']['Marks']['1']: + self.env['runtime']['outputManager'].presentText("one or two marks needed", interrupt=True) return + if not self.env['commandBuffer']['Marks']['2']: + self.env['runtime']['cursorManager'].setMark() + # use the last first and the last setted mark as range startMark = self.env['commandBuffer']['Marks']['1'].copy() endMark = self.env['commandBuffer']['Marks']['2'].copy() diff --git a/src/fenrir/core/cursorManager.py b/src/fenrir/core/cursorManager.py index 4d384ef4..32d4cd2f 100644 --- a/src/fenrir/core/cursorManager.py +++ b/src/fenrir/core/cursorManager.py @@ -25,11 +25,16 @@ class cursorManager(): return self.env['commandBuffer']['Marks']['1'] != None and \ self.env['commandBuffer']['Marks']['2'] != None def setMark(self): + currCursor = None + if self.env['screenData']['newCursorReview']: + currCursor = self.env['screenData']['newCursorReview'].copy() + else: + currCursor = self.env['screenData']['newCursor'].copy() if not self.env['commandBuffer']['Marks']['1']: - self.env['commandBuffer']['Marks']['1'] = self.env['screenData']['newCursorReview'].copy() + self.env['commandBuffer']['Marks']['1'] = currCursor.copy() return 1 else: - self.env['commandBuffer']['Marks']['2'] = self.env['screenData']['newCursorReview'].copy() + self.env['commandBuffer']['Marks']['2'] = currCursor.copy() return 2 return 0 def getReviewOrTextCursor(self):