mirror of
https://github.com/feather-wallet/feather.git
synced 2024-12-22 11:39:25 +00:00
wizard: don't add space if there is already one, never insert tab
Some checks failed
ci/gh-actions/guix / cache-sources (push) Has been cancelled
ci/gh-actions/guix / aarch64-linux-gnu (push) Has been cancelled
ci/gh-actions/guix / arm-linux-gnueabihf (push) Has been cancelled
ci/gh-actions/guix / x86_64-w64-mingw32.installer (push) Has been cancelled
ci/gh-actions/build / build-ubuntu-without-scanner (push) Has been cancelled
ci/gh-actions/guix / arm64-apple-darwin (push) Has been cancelled
ci/gh-actions/guix / i686-linux-gnu (push) Has been cancelled
ci/gh-actions/guix / riscv64-linux-gnu (push) Has been cancelled
ci/gh-actions/guix / x86_64-apple-darwin (push) Has been cancelled
ci/gh-actions/guix / x86_64-linux-gnu.no-tor-bundle (push) Has been cancelled
ci/gh-actions/guix / x86_64-linux-gnu.pack (push) Has been cancelled
ci/gh-actions/guix / x86_64-linux-gnu (push) Has been cancelled
ci/gh-actions/guix / bundle-logs (push) Has been cancelled
ci/gh-actions/guix / x86_64-w64-mingw32 (push) Has been cancelled
Some checks failed
ci/gh-actions/guix / cache-sources (push) Has been cancelled
ci/gh-actions/guix / aarch64-linux-gnu (push) Has been cancelled
ci/gh-actions/guix / arm-linux-gnueabihf (push) Has been cancelled
ci/gh-actions/guix / x86_64-w64-mingw32.installer (push) Has been cancelled
ci/gh-actions/build / build-ubuntu-without-scanner (push) Has been cancelled
ci/gh-actions/guix / arm64-apple-darwin (push) Has been cancelled
ci/gh-actions/guix / i686-linux-gnu (push) Has been cancelled
ci/gh-actions/guix / riscv64-linux-gnu (push) Has been cancelled
ci/gh-actions/guix / x86_64-apple-darwin (push) Has been cancelled
ci/gh-actions/guix / x86_64-linux-gnu.no-tor-bundle (push) Has been cancelled
ci/gh-actions/guix / x86_64-linux-gnu.pack (push) Has been cancelled
ci/gh-actions/guix / x86_64-linux-gnu (push) Has been cancelled
ci/gh-actions/guix / bundle-logs (push) Has been cancelled
ci/gh-actions/guix / x86_64-w64-mingw32 (push) Has been cancelled
This commit is contained in:
parent
5acbd9a20f
commit
849269f53f
3 changed files with 26 additions and 23 deletions
|
@ -118,13 +118,4 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class SpaceCompleter : public QCompleter {
|
|
||||||
protected:
|
|
||||||
QString pathFromIndex(const QModelIndex &index) const override
|
|
||||||
{
|
|
||||||
QString completion = QCompleter::pathFromIndex(index);
|
|
||||||
return completion + ' ';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif //FEATHER_COMPONENTS_H
|
#endif //FEATHER_COMPONENTS_H
|
||||||
|
|
|
@ -89,6 +89,9 @@ void TextEdit::insertCompletion(const QString &completion) {
|
||||||
tc.movePosition(QTextCursor::Left);
|
tc.movePosition(QTextCursor::Left);
|
||||||
tc.movePosition(QTextCursor::EndOfWord);
|
tc.movePosition(QTextCursor::EndOfWord);
|
||||||
tc.insertText(completion.right(extra));
|
tc.insertText(completion.right(extra));
|
||||||
|
if (this->document()->characterAt(tc.position()) != ' ') {
|
||||||
|
tc.insertText(" ");
|
||||||
|
}
|
||||||
setTextCursor(tc);
|
setTextCursor(tc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +108,8 @@ void TextEdit::focusInEvent(QFocusEvent *e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextEdit::keyPressEvent(QKeyEvent *e) {
|
void TextEdit::keyPressEvent(QKeyEvent *e) {
|
||||||
if (c && c->popup()->isVisible()) {
|
if (c) {
|
||||||
|
if (c->popup()->isVisible()) {
|
||||||
// The following keys are forwarded by the completer to the widget
|
// The following keys are forwarded by the completer to the widget
|
||||||
switch (e->key()) {
|
switch (e->key()) {
|
||||||
case Qt::Key_Enter:
|
case Qt::Key_Enter:
|
||||||
|
@ -119,6 +123,14 @@ void TextEdit::keyPressEvent(QKeyEvent *e) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
// Never insert a tab char if we have a completer
|
||||||
|
if (e->key() == Qt::Key_Tab) {
|
||||||
|
e->accept();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const bool isShortcut = (e->modifiers().testFlag(Qt::ControlModifier) && e->key() == Qt::Key_E); // CTRL+E
|
const bool isShortcut = (e->modifiers().testFlag(Qt::ControlModifier) && e->key() == Qt::Key_E); // CTRL+E
|
||||||
if (!c || !isShortcut) // do not process the shortcut when we have a completer
|
if (!c || !isShortcut) // do not process the shortcut when we have a completer
|
||||||
|
|
|
@ -43,7 +43,7 @@ private:
|
||||||
int length;
|
int length;
|
||||||
QStringList words;
|
QStringList words;
|
||||||
QStringListModel completerModel;
|
QStringListModel completerModel;
|
||||||
SpaceCompleter completer;
|
QCompleter completer;
|
||||||
Seed::Type type;
|
Seed::Type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue