KTextEditor

activemode.cpp
1/*
2 SPDX-FileCopyrightText: 2013-2016 Simon St James <kdedevel@etotheipiplusone.com>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "activemode.h"
8#include "emulatedcommandbar.h"
9#include "matchhighlighter.h"
10
11#include <vimode/inputmodemanager.h>
12#include <vimode/modes/visualvimode.h>
13
14#include "kateview.h"
15
16using namespace KateVi;
17
18CompletionStartParams ActiveMode::completionInvoked(Completer::CompletionInvocation invocationType)
19{
20 Q_UNUSED(invocationType);
21 return CompletionStartParams();
22}
23
24void ActiveMode::setViInputModeManager(InputModeManager *viInputModeManager)
25{
26 m_viInputModeManager = viInputModeManager;
27}
28
29ActiveMode::~ActiveMode() = default;
30
31void ActiveMode::hideAllWidgetsExcept(QWidget *widgetToKeepVisible)
32{
33 m_emulatedCommandBar->hideAllWidgetsExcept(widgetToKeepVisible);
34}
35
36void ActiveMode::updateMatchHighlight(KTextEditor::Range matchRange)
37{
38 m_matchHighligher->updateMatchHighlight(matchRange);
39}
40
41void ActiveMode::close(bool wasAborted)
42{
43 m_emulatedCommandBar->m_wasAborted = wasAborted;
44 m_emulatedCommandBar->hideMe();
45}
46
47void ActiveMode::closeWithStatusMessage(const QString &exitStatusMessage)
48{
49 m_emulatedCommandBar->closeWithStatusMessage(exitStatusMessage);
50}
51
52void ActiveMode::startCompletion(const CompletionStartParams &completionStartParams)
53{
54 m_emulatedCommandBar->m_completer->startCompletion(completionStartParams);
55}
56
57void ActiveMode::moveCursorTo(const KTextEditor::Cursor cursorPos)
58{
59 m_view->setCursorPosition(cursorPos);
60 if (m_viInputModeManager->getCurrentViMode() == ViMode::VisualMode || m_viInputModeManager->getCurrentViMode() == ViMode::VisualLineMode) {
61 m_viInputModeManager->getViVisualMode()->goToPos(cursorPos);
62 }
63}
64
65EmulatedCommandBar *ActiveMode::emulatedCommandBar()
66{
67 return m_emulatedCommandBar;
68}
69
70KTextEditor::ViewPrivate *ActiveMode::view()
71{
72 return m_view;
73}
74
75InputModeManager *ActiveMode::viInputModeManager()
76{
77 return m_viInputModeManager;
78}
The Cursor represents a position in a Document.
Definition cursor.h:75
An object representing a section of text, from one Cursor to another.
A KateViewBarWidget that attempts to emulate some of the features of Vim's own command bar,...
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

KDE's Doxygen guidelines are available online.