def _update_buffer(self) -> None:
    is_current_buffer = (self._bufnr == self._vim.current.buffer.number)
    self._update_status()
    if (self._check_matchdelete and self._context['match_highlight']):
        matches = [x['id'] for x in self._vim.call('getmatches', self._winid)]
        if (self._matched_range_id in matches):
            self._vim.call('matchdelete', self._matched_range_id, self._winid)
            self._matched_range_id = (- 1)
        if (self._matched_char_id in matches):
            self._vim.call('matchdelete', self._matched_char_id, self._winid)
            self._matched_char_id = (- 1)
        if (self._matched_pattern != ''):
            self._matched_range_id = self._vim.call('matchadd', 'deniteMatchedRange', ('\\c' + regex_convert_py_vim(self._matched_pattern)), 10, (- 1), {'window': self._winid})
            matched_char_pattern = '[{}]'.format(re.sub('([\\[\\]\\\\^-])', '\\\\\\1', self._context['input'].replace(' ', '')))
            self._matched_char_id = self._vim.call('matchadd', 'deniteMatchedChar', matched_char_pattern, 10, (- 1), {'window': self._winid})
    prev_linenr = self._vim.call('line', '.')
    prev_candidate = self._get_cursor_candidate()
    buffer = self._vim.buffers[self._bufnr]
    buffer.options['modifiable'] = True
    self._vim.vars['denite#_candidates'] = [x['word'] for x in self._candidates]
    buffer[:] = self._displayed_texts
    buffer.options['modifiable'] = False
    self._previous_text = self._context['input']
    self._resize_buffer(is_current_buffer)
    is_changed = (self._context['reversed'] or (is_current_buffer and (self._previous_text != self._context['input'])))
    if (self._updated and is_changed):
        if (not is_current_buffer):
            save_winid = self._vim.call('win_getid')
            self._vim.call('win_gotoid', self._winid)
        self._init_cursor()
        self._move_to_pos(self._cursor)
        if (not is_current_buffer):
            self._vim.call('win_gotoid', save_winid)
    elif is_current_buffer:
        self._vim.call('cursor', [prev_linenr, 0])
    if is_current_buffer:
        if (self._context['auto_action'] and (prev_candidate != self._get_cursor_candidate())):
            self.do_action(self._context['auto_action'])
    self._updated = False
    self._stop_timer('update_buffer')
def _update_buffer(self) -> None:
    is_current_buffer = (self._bufnr == self._vim.current.buffer.number)
    self._update_status()
    if (self._check_matchdelete and self._context['match_highlight']):
        matches = [x['id'] for x in self._vim.call('getmatches', self._winid)]
        if (self._matched_range_id in matches):
            self._vim.call('matchdelete', self._matched_range_id, self._winid)
            self._matched_range_id = (- 1)
        if (self._matched_char_id in matches):
            self._vim.call('matchdelete', self._matched_char_id, self._winid)
            self._matched_char_id = (- 1)
        if (self._matched_pattern != ):
            self._matched_range_id = self._vim.call('matchadd', 'deniteMatchedRange', ('\\c' + regex_convert_py_vim(self._matched_pattern)), 10, (- 1), {'window': self._winid})
            matched_char_pattern = '[{}]'.format(re.sub('([\\[\\]\\\\^-])', '\\\\\\1', self._context['input'].replace(' ', )))
            self._matched_char_id = self._vim.call('matchadd', 'deniteMatchedChar', matched_char_pattern, 10, (- 1), {'window': self._winid})
    prev_linenr = self._vim.call('line', '.')
    prev_candidate = self._get_cursor_candidate()
    buffer = self._vim.buffers[self._bufnr]
    buffer.options['modifiable'] = True
    self._vim.vars['denite#_candidates'] = [x['word'] for x in self._candidates]
    buffer[:] = self._displayed_texts
    buffer.options['modifiable'] = False
    self._previous_text = self._context['input']
    self._resize_buffer(is_current_buffer)
    is_changed = (self._context['reversed'] or (is_current_buffer and (self._previous_text != self._context['input'])))
    if (self._updated and is_changed):
        if (not is_current_buffer):
            save_winid = self._vim.call('win_getid')
            self._vim.call('win_gotoid', self._winid)
        self._init_cursor()
        self._move_to_pos(self._cursor)
        if (not is_current_buffer):
            self._vim.call('win_gotoid', save_winid)
    elif is_current_buffer:
        self._vim.call('cursor', [prev_linenr, 0])
    if is_current_buffer:
        if (self._context['auto_action'] and (prev_candidate != self._get_cursor_candidate())):
            self.do_action(self._context['auto_action'])
    self._updated = False
    self._stop_timer('update_buffer')