- Double-space replaced the space via a Backspace keysym, which clients apply after the commit: use delete_surrounding_text with the commit - Tests use a shared FakeEngine that applies ops to a simulated field - Double-tap shift locks at a sentence start; typing between taps doesn't - Organization name set: config lives in ~/.config/sloposk/ - Settings (auto-capitalization, double-space period) with a ⚙ panel - Letter rows come from the compositor's XKB keymap; other letters of the layout become long-press alternates; globe switches the system layout over org.kde.keyboard - One JSON template for non-letter layers; stretch keys even out rows Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
35 lines
961 B
C++
35 lines
961 B
C++
#pragma once
|
|
|
|
#include "engine/InputEngine.h"
|
|
|
|
#include <QList>
|
|
#include <QString>
|
|
|
|
// Records what the keyboard sends and applies it to a simulated field, so
|
|
// tests check the text a user would see rather than the calls made.
|
|
class FakeEngine : public InputEngine
|
|
{
|
|
public:
|
|
void commitText(const QString &text) override { output += text; }
|
|
|
|
void replaceBeforeCursor(const QString &before, const QString &text) override
|
|
{
|
|
if (output.endsWith(before))
|
|
output.chop(before.size());
|
|
else
|
|
mismatchedReplacements++;
|
|
output += text;
|
|
}
|
|
|
|
void sendKeysym(quint32 keysym, Qt::KeyboardModifiers modifiers) override
|
|
{
|
|
keysyms.append(keysym);
|
|
lastModifiers = modifiers;
|
|
}
|
|
|
|
QString output; // the field's text
|
|
int mismatchedReplacements = 0; // replaced text that wasn't before the cursor
|
|
QList<quint32> keysyms;
|
|
Qt::KeyboardModifiers lastModifiers;
|
|
};
|