コード例 #1
0
class RemoveNextTextAction(TextStoreAction):
    """ Represents an action to remove the next character """
    
    def isDoable(self):
        """ Return if the action can be done """
        return not (self.line == self.textStore.lastLine() and self.column == len(self.textStore.text[self.line]))
        
    def performDoOperation(self):
        """ Perform the action """
        if self.column == len(self.textStore.text[self.line]):
            self.removeLine()
        else:
            self.removeChar()
        
    def removeChar(self):
        """ Removes a character from a line """
        self.action = RemoveCharacterAction(self.cursor, self.textStore, self.settings)
        self.action.do()
        
    def removeLine(self):
        """ Removes a line and appends the extra characters to the line above """
        self.action = MergeLinesAction(self.cursor, self.textStore, self.settings)
        self.action.do()
        
    def undo(self):
        """ Undo the remove next text action """
        self.action.undo()
コード例 #2
0
 def removeLine(self):
     """ Removes a line and appends the extra characters to the line above """
     self.action = MergeLinesAction(self.cursor, self.textStore, self.settings)
     self.action.do()
コード例 #3
0
 def removeChar(self):
     """ Removes a character from a line """
     self.action = RemoveCharacterAction(self.cursor, self.textStore, self.settings)
     self.action.do()