'Smart HOME feature: cursor is first moved at
indentation position, then at the start of the line'

def stdkey_home(self, shift, ctrl, prompt_pos=None):

    move_mode = self.__get_move_mode(shift)
    if ctrl:
        self.moveCursor(QTextCursor.Start, move_mode)
    else:
        cursor = self.textCursor()
        if (prompt_pos is None):
            start_position = self.get_position('sol')
        else:
            start_position = self.get_position(prompt_pos)
        text = self.get_text(start_position, 'eol')
        indent_pos = ((start_position + len(text)) - len(text.lstrip()))
        if (cursor.position() != indent_pos):
            cursor.setPosition(indent_pos, move_mode)
        else:
            cursor.setPosition(start_position, move_mode)
        self.setTextCursor(cursor)
