def _get_candidate_display_text(self, index: int) -> str:
    source_names = self._context['source_names']
    candidate = self._candidates[index]
    terms = []
    if (self._is_multi and (source_names != 'hide')):
        terms.append(self._context['max_source_name_format'].format(self._get_display_source_name(candidate['source_name'])))
    encoding = self._context['encoding']
    abbr = candidate.get('abbr', candidate['word']).encode(encoding, errors='replace').decode(encoding, errors='replace')
    terms.append(abbr[:int(self._context['max_candidate_width'])])
    return ((self._context['selected_icon'] if (index in self._selected_candidates) else ' ') + ' '.join(terms).replace('\n', ''))
def _get_candidate_display_text(self, index: int) -> str:
    source_names = self._context['source_names']
    candidate = self._candidates[index]
    terms = []
    if (self._is_multi and (source_names != 'hide')):
        terms.append(self._context['max_source_name_format'].format(self._get_display_source_name(candidate['source_name'])))
    encoding = self._context['encoding']
    abbr = candidate.get('abbr', candidate['word']).encode(encoding, errors='replace').decode(encoding, errors='replace')
    terms.append(abbr[:int(self._context['max_candidate_width'])])
    return ((self._context['selected_icon'] if (index in self._selected_candidates) else ' ') + ' '.join(terms).replace('\n', ))