KP_Clear is mapped from numpad 5 on non-Apple keyboards according to Qt
doc [1]. It's mapped from KP_Begin from XKB on X11.
Tests: with numlock off,
numpad 5 => "\e[OE"
Ctrl + numpad 5 => "\e[1;5E"
Alt + numpad 5 => "\e[1;3E"
Shift + numpad 5 => "5"
These results are the same as VTE3 0.56.3. On xterm 346, Shift + numpad
5 generates "\eO2u". However, Qt returns 5 instead of KP_Clear if Shift
is hold even with numlock off, so implementing Shift + numpad 5 might be
rather complicated. As a side note, shifted keypad sequences can be
found in emacs sources [2].
Note that on Wayfire (wlroots-based Wayland compositor), numpad 5 with
numlock off generates an event without Qt::KeypadModifier. Further
investigation needed.
Ref: https://github.com/lxqt/qtermwidget/issues/117
[1] https://doc.qt.io/qt-5/qt.html#Key-enum
[2] https://github.com/emacs-mirror/emacs/blame/master/lisp/term/xterm.el
* Disables automatic conversions from 8-bit strings (char *) to unicode
QStrings.
* Disables automatic conversion from QString to 8-bit strings (char *).
* Disables automatic conversions from QByteArray to const char * or const
void *.
* Disables automatic conversions from QString (or char *) to QUrl.
* Use QStringBuilder for more efficient string creation.
It make us aware of string and encoding conversions.
* Prevent a possible C++11 range for detach
The solution with Qt>=5.7 is to use the qAsConst() macro.
But the qAsConst macro is just a const_cast to const T&.
* Don't call QByteArray::operator[]() on temporary
Just use the QByteArray::at().
* Adds missing reference in foreach
That's an non non trivial type (QString), using a reference as no drawbacks
and it performs better.
* Use QStringList::constFirst()
Drop QStringList::first(). It's faster and we might avoid detaching a
temporary.
* Don't call QList::operator[]() on temporary objects
It's not what we want. The at operator and QList::value() do the job in the
right way.
* Stops allocating an unneeded temporary container
We were allocating an temporary container (_entries.values(keyCode)) which
implies an extra iteration also.
Now we don't use any temporary container and only perform one iteration.