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'
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()

View File

@ -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):