Text rules: auto-capitalization, double-space period, backspace repeat
- TextContext: field purpose/hints and text before the cursor, reported by the backend (KWin content_type + surrounding_text) - TextRules: sentence-start and double-space heuristics, deletion helpers - KeyRepeater: held backspace repeats, then deletes whole words (Ctrl+BS) - Controller keeps a best-guess of the text before the cursor so rules work instantly and in fields that don't report surrounding text - No auto-capitalization or smart punctuation in password/URL/email fields Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -37,14 +37,9 @@ bool KWinInputMethod::isActive() const
|
||||
return m_context != nullptr;
|
||||
}
|
||||
|
||||
QString KWinInputMethod::surroundingText() const
|
||||
TextContext KWinInputMethod::context() const
|
||||
{
|
||||
return m_context ? m_context->surroundingText() : QString();
|
||||
}
|
||||
|
||||
int KWinInputMethod::cursorPosition() const
|
||||
{
|
||||
return m_context ? m_context->cursorPosition() : -1;
|
||||
return m_context ? m_context->context() : TextContext();
|
||||
}
|
||||
|
||||
void KWinInputMethod::commitText(const QString &text)
|
||||
@@ -68,7 +63,7 @@ void KWinInputMethod::sendKeysym(quint32 keysym, Qt::KeyboardModifiers modifiers
|
||||
void KWinInputMethod::activate(::zwp_input_method_context_v1 *context)
|
||||
{
|
||||
m_context = std::make_unique<KWinInputContext>(context);
|
||||
connect(m_context.get(), &KWinInputContext::surroundingChanged, this, &TextBackend::surroundingChanged);
|
||||
connect(m_context.get(), &KWinInputContext::contextChanged, this, &TextBackend::contextChanged);
|
||||
Q_EMIT activeChanged();
|
||||
}
|
||||
|
||||
@@ -76,5 +71,5 @@ void KWinInputMethod::deactivate()
|
||||
{
|
||||
m_context.reset();
|
||||
Q_EMIT activeChanged();
|
||||
Q_EMIT surroundingChanged();
|
||||
Q_EMIT contextChanged();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user