def history_selected(self, line, idx):
        """
        This should be called when a history line was selected.
        :param line: selected line
        :type line: str
        :param idx: index of selected line
        :type idx: int
        """
        # Save the unfinished line user is typing before showing entries from history
        if self.stash.runtime.history.idx == -1:
            self.stash.runtime.history.templine = self.stash.mini_buffer.modifiable_string.rstrip()
        self.stash.mini_buffer.feed(None, line)
        self.stash.runtime.history.idx = idx

        This should be called when a history line was selected.
        :param line: selected line
        :type line: str
        :param idx: index of selected line
        :type idx: int
        
system/shui/base.py