KTextEditor
completer.cpp
32Completer::Completer(EmulatedCommandBar *emulatedCommandBar, KTextEditor::ViewPrivate *view, QLineEdit *edit)
51 const QString completionPrefix = m_edit->text().mid(completionStartParams.wordStartPos, m_edit->cursorPosition() - completionStartParams.wordStartPos);
81 if (keyEvent->modifiers() == CONTROL_MODIFIER && (keyEvent->key() == Qt::Key_C || keyEvent->key() == Qt::Key_BracketLeft)) {
82 if (m_currentCompletionType != CompletionStartParams::None && m_completer->popup()->isVisible()) {
92 if ((keyEvent->modifiers() == CONTROL_MODIFIER && keyEvent->key() == Qt::Key_P) || keyEvent->key() == Qt::Key_Down) {
94 const CompletionStartParams completionStartParams = m_currentMode->completionInvoked(CompletionInvocation::ExtraContext);
109 if ((keyEvent->modifiers() == CONTROL_MODIFIER && keyEvent->key() == Qt::Key_N) || keyEvent->key() == Qt::Key_Up) {
111 const CompletionStartParams completionStartParams = m_currentMode->completionInvoked(CompletionInvocation::NormalContext);
125 if (!m_completer->popup()->isVisible() || m_currentCompletionType != CompletionStartParams::WordFromDocument) {
142 if (!m_isNextTextChangeDueToCompletionChange && m_completer->popup()->currentIndex().row() != -1) {
146 if (m_currentCompletionType != CompletionStartParams::None && !m_isNextTextChangeDueToCompletionChange) {
180 m_edit->setSelection(m_currentCompletionStartParams.wordStartPos, m_edit->cursorPosition() - m_currentCompletionStartParams.wordStartPos);
188 m_edit->text().mid(m_currentCompletionStartParams.wordStartPos, m_edit->cursorPosition() - m_currentCompletionStartParams.wordStartPos);
190 // Seem to need a call to complete() else the size of the popup box is not altered appropriately.
196 static const QRegularExpression wordRegEx(QStringLiteral("\\w+"), QRegularExpression::UseUnicodePropertiesOption);
224 return m_edit->text().mid(wordBeforeCursorBegin, m_edit->cursorPosition() - wordBeforeCursorBegin);
231 && (m_edit->text()[wordBeforeCursorBegin].isLetterOrNumber() || m_edit->text()[wordBeforeCursorBegin] == QLatin1Char('_'))) {
constexpr int line() const noexcept
Retrieve the line on which this cursor is situated.
Definition cursor.h:174
A KateViewBarWidget that attempts to emulate some of the features of Vim's own command bar,...
Definition emulatedcommandbar.h:38
KCOREADDONS_EXPORT Result match(QStringView pattern, QStringView str)
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const=0
QModelIndex currentIndex() const const
QAbstractItemModel * model() const const
virtual void scrollTo(const QModelIndex &index, ScrollHint hint)=0
void setCurrentIndex(const QModelIndex &index)
void complete(const QRect &rect)
int completionCount() const const
void setCompletionPrefix(const QString &prefix)
QString currentCompletion() const const
int currentRow() const const
QAbstractItemView * popup() const const
bool setCurrentRow(int row)
cursorPosition
void insert(const QString &newText)
void setSelection(int start, int length)
text
iterator begin()
iterator end()
int row() const const
UseUnicodePropertiesOption
bool isEmpty() const const
QString toLower() const const
qsizetype removeDuplicates()
void setStringList(const QStringList &strings)
CaseInsensitive
Key_C
void keyEvent(KeyAction action, QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier, int delay)
void hide()
bool isVisible() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:01:56 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:01:56 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.