KTextEditor
emulatedcommandbar.cpp
54EmulatedCommandBar::EmulatedCommandBar(KateViInputMode *viInputMode, InputModeManager *viInputModeManager, QWidget *parent)
73 m_interactiveSedReplaceMode.reset(new InteractiveSedReplaceMode(this, m_matchHighligher.get(), m_viInputModeManager, m_view));
75 m_searchMode.reset(new SearchMode(this, m_matchHighligher.get(), m_viInputModeManager, m_view, m_edit));
77 new CommandMode(this, m_matchHighligher.get(), m_viInputModeManager, m_view, m_edit, m_interactiveSedReplaceMode.get(), m_completer.get()));
95 m_searchMode->init(mode == SearchBackward ? SearchMode::SearchDirection::Backward : SearchMode::SearchDirection::Forward);
119void EmulatedCommandBar::setCommandResponseMessageTimeout(long int commandResponseMessageTimeOutMS)
150 if ((keyEvent->modifiers() == CONTROL_MODIFIER && keyEvent->key() == Qt::Key_H) || keyEvent->key() == Qt::Key_Backspace) {
214 // Re-route this keypress through Vim's central keypress handling area, so that we can use the keypress in e.g.
223 while (m_edit->cursorPosition() != 0 && m_edit->text().at(m_edit->cursorPosition() - 1) == QLatin1Char(' ')) {
245 if (charToTheLeftOfCursor.isLetterOrNumber() || charToTheLeftOfCursor == QLatin1Char('_') || charToTheLeftOfCursor == QLatin1Char(' ')) {
266 if (keyEvent->modifiers() == CONTROL_MODIFIER && (keyEvent->key() == Qt::Key_C || keyEvent->key() == Qt::Key_BracketLeft)) {
284 // Send the keypress back to the QLineEdit. Ideally, instead of doing this, we would simply return "false"
285 // and let Qt re-dispatch the event itself; however, there is a corner case in that if the selection
286 // changes (as a result of e.g. incremental searches during Visual Mode), and the keypress that causes it
288 // (so KateViInputModeManager::isHandlingKeypress() returns false), we lose information about whether we are
295 QKeyEvent keyEventCopy(keyEvent->type(), keyEvent->key(), keyEvent->modifiers(), keyEvent->text(), keyEvent->isAutoRepeat(), keyEvent->count());
307void EmulatedCommandBar::startInteractiveSearchAndReplace(std::shared_ptr<SedReplace::InteractiveSedReplacer> interactiveSedReplace)
362 if (m_exitStatusMessageDisplay->isVisible() && !m_exitStatusMessageDisplayHideTimer->isActive()) {
411 connect(m_exitStatusMessageDisplayHideTimer, &QTimer::timeout, this, &EmulatedCommandBar::hideMe);
412 // Make sure the timer is stopped when the user switches views. If not, focus will be given to the
413 // wrong view when KateViewBar::hideCurrentBarWidget() is called as a result of m_commandResponseMessageDisplayHide
415 connect(m_view, &KTextEditor::ViewPrivate::focusOut, m_exitStatusMessageDisplayHideTimer, &QTimer::stop);
417 connect(m_view, &KTextEditor::ViewPrivate::focusIn, this, &EmulatedCommandBar::startHideExitStatusMessageTimer);
QString wordAt(KTextEditor::Cursor cursor) const override
Get the word at the text position cursor.
Definition katedocument.cpp:489
static constexpr Range invalid() noexcept
Returns an invalid range.
Definition include/ktexteditor/range.h:121
void focusOut(KTextEditor::View *view)
This signal is emitted whenever the view loses the focus.
void focusIn(KTextEditor::View *view)
This signal is emitted whenever the view gets the focus.
void addWidget(QWidget *widget, int stretch, Qt::Alignment alignment)
Null
bool isLetterOrNumber(char32_t ucs4)
char32_t toLower(char32_t ucs4)
void processEvents(QEventLoop::ProcessEventsFlags flags)
KeyPress
void setAlignment(Qt::Alignment)
void setText(const QString &)
void addWidget(QWidget *w)
void setContentsMargins(const QMargins &margins)
void backspace()
void setCursorPosition(int)
void setText(const QString &)
void textChanged(const QString &text)
Q_EMITQ_EMIT
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
QList< T > findChildren(Qt::FindChildOptions options) const const
void setObjectName(QAnyStringView name)
qsizetype length() const const
QString & replace(QChar before, QChar after, Qt::CaseSensitivity cs)
AlignLeft
Key_H
void keyEvent(KeyAction action, QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier, int delay)
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
bool isActive() const const
void setSingleShot(bool singleShot)
void start()
void stop()
void timeout()
virtual bool event(QEvent *event) override
void hide()
QLayout * layout() const const
void setFocus()
void show()
virtual void setVisible(bool visible)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:11:27 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:11:27 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.