set second mark magical when copy to clipboard

This commit is contained in:
chrys 2016-10-07 23:01:43 +02:00
parent 8041e8809f
commit 562fa78795
2 changed files with 12 additions and 5 deletions

View File

@ -18,10 +18,12 @@ class command():
return 'copies marked text to the currently selected clipboard' return 'copies marked text to the currently selected clipboard'
def run(self): def run(self):
if not (self.env['commandBuffer']['Marks']['1'] and \ if not self.env['commandBuffer']['Marks']['1']:
self.env['commandBuffer']['Marks']['2']): self.env['runtime']['outputManager'].presentText("one or two marks needed", interrupt=True)
self.env['runtime']['outputManager'].presentText("two marks needed", interrupt=True)
return return
if not self.env['commandBuffer']['Marks']['2']:
self.env['runtime']['cursorManager'].setMark()
# use the last first and the last setted mark as range # use the last first and the last setted mark as range
startMark = self.env['commandBuffer']['Marks']['1'].copy() startMark = self.env['commandBuffer']['Marks']['1'].copy()
endMark = self.env['commandBuffer']['Marks']['2'].copy() endMark = self.env['commandBuffer']['Marks']['2'].copy()

View File

@ -25,11 +25,16 @@ class cursorManager():
return self.env['commandBuffer']['Marks']['1'] != None and \ return self.env['commandBuffer']['Marks']['1'] != None and \
self.env['commandBuffer']['Marks']['2'] != None self.env['commandBuffer']['Marks']['2'] != None
def setMark(self): 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']: 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 return 1
else: else:
self.env['commandBuffer']['Marks']['2'] = self.env['screenData']['newCursorReview'].copy() self.env['commandBuffer']['Marks']['2'] = currCursor.copy()
return 2 return 2
return 0 return 0
def getReviewOrTextCursor(self): def getReviewOrTextCursor(self):