KTextEditor

lastchangerecorder.h
1/*
2 SPDX-FileCopyrightText: KDE Developers
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef KATEVI_LASTCHANGERECORDER_H
8#define KATEVI_LASTCHANGERECORDER_H
9
10#include "completion.h"
11#include "keyevent.h"
12
13#include <QKeyEvent>
14#include <QList>
15#include <QString>
16
17namespace KateVi
18{
19class InputModeManager;
20
21/**
22 * In e.g. Insert mode, Qt seems to feed each keypress through twice; once as a ShortcutOverride (even if the key
23 * doesn't actually appear to be a ShortcutOverride) and then, whether the "ShortcutOverride" was accepted or not,
24 * again as a KeyPress. We don't want to store both, so this helper helps to decide what to do.
25 */
26bool isRepeatOfLastShortcutOverrideAsKeyPress(const QKeyEvent &currentKeyPress, const QList<KeyEvent> &keyEventLog);
27
28class LastChangeRecorder
29{
30public:
31 explicit LastChangeRecorder(InputModeManager *viInputModeManager);
32
33 void record(const QKeyEvent &event);
34 void dropLast();
35 void clear();
36
37 QString encodedChanges() const;
38
39 void replay(const QString &commands, const CompletionList &completions);
40 bool isReplaying() const;
41
42private:
43 InputModeManager *m_viInputModeManager;
44
45 QList<KeyEvent> m_changeLog;
46
47 bool m_isReplaying;
48};
49}
50
51#endif // KATEVI_LASTCHANGERECORDER_H
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:15:44 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.