'In shell, avoid editing text except between prompt and EOF'

def restrict_cursor_position(self, position_from, position_to):

    position_from = self.get_position(position_from)
    position_to = self.get_position(position_to)
    cursor = self.textCursor()
    cursor_position = cursor.position()
    if ((cursor_position < position_from) or (cursor_position > position_to)):
        self.set_cursor_position(position_to)
