code: def update_history(self, directory):
          
          try:
              directory = osp.abspath(to_text_string(directory))
              if directory in self.history:
                  self.histindex = self.history.index(directory)
          except Exception:
              user_directory = get_home_dir()
              self.chdir(directory=user_directory, browsing_history=True)
docs: Update browse history