code: def _default_buffer_pos_changed(self, _):
          
          # Only when this buffer has the focus.
          if self.app.current_buffer == self.default_buffer:
              try:
                  line_no = self.default_buffer.document.cursor_position_row - \
                      self.history_mapping.result_line_offset
  
                  if line_no < 0:  # When the cursor is above the inserted region.
                      raise IndexError
  
                  history_lineno = sorted(self.history_mapping.selected_lines)[line_no]
              except IndexError:
                  pass
              else:
                  self.history_buffer.cursor_position = \
                      self.history_buffer.document.translate_row_col_to_index(history_lineno, 0)
docs: When the cursor changes in the default buffer. Synchronize with
          history buffer.