'Override _handle_special_key to handle string filtering.
Return True if the keypress has been handled, and False if not.
Args:
e: the KeyPressEvent from Qt.
Return:
True if event has been handled, False otherwise.'

def _handle_special_key(self, e):

    log.keyboard.debug('Got    special    key    0x{:x}    text    {}'.format(e.key(), e.text()))
    hintmanager = objreg.get('hintmanager', scope='tab', window=self._win_id, tab='current')
    if (e.key() == Qt.Key_Backspace):
        log.keyboard.debug("Got    backspace,    mode    {},    filtertext    '{}',    keystring    '{}'".format(self._last_press, self._filtertext, self._keystring))
        if ((self._last_press == LastPress.filtertext) and self._filtertext):
            self._filtertext = self._filtertext[:(-1)]
            hintmanager.filter_hints(self._filtertext)
            return True
        elif ((self._last_press == LastPress.keystring) and self._keystring):
            self._keystring = self._keystring[:(-1)]
            self.keystring_updated.emit(self._keystring)
            if ((not self._keystring) and self._filtertext):
                hintmanager.filter_hints(self._filtertext)
                self._last_press = LastPress.filtertext
            return True
        else:
            return super()._handle_special_key(e)
    elif (hintmanager.current_mode() != 'number'):
        return super()._handle_special_key(e)
    elif (not e.text()):
        return super()._handle_special_key(e)
    else:
        self._filtertext += e.text()
        hintmanager.filter_hints(self._filtertext)
        self._last_press = LastPress.filtertext
        return True
