code: def item_selected(self, item=None):
          
          if item is None:
              item = self.currentItem()
  
          # stack history is in inverse order
          try:
              index = self.stack_history[-(self.currentRow()+1)]
          except IndexError:
              pass
          else:
              self.editor.set_stack_index(index)
              self.editor.current_changed(index)
          self.hide()
docs: Change to the selected document and hide this widget.