2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2008-12-02 16:19:05 +01:00
|
|
|
|
2024-01-26 18:05:26 +01:00
|
|
|
#include "behaviorsettings.h"
|
2023-09-22 18:05:03 +02:00
|
|
|
#include "bookmarkfilter.h"
|
|
|
|
|
#include "bookmarkmanager.h"
|
2024-01-26 18:05:26 +01:00
|
|
|
#include "extraencodingsettings.h"
|
2009-05-29 14:14:08 +02:00
|
|
|
#include "findincurrentfile.h"
|
2014-09-02 12:54:28 +02:00
|
|
|
#include "findinfiles.h"
|
2012-01-23 11:49:14 +01:00
|
|
|
#include "findinopenfiles.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "fontsettings.h"
|
2023-11-01 10:08:31 +01:00
|
|
|
#include "highlighterhelper.h"
|
2023-01-17 18:02:43 +01:00
|
|
|
#include "icodestylepreferences.h"
|
2023-08-23 15:38:01 +02:00
|
|
|
#include "jsoneditor.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "linenumberfilter.h"
|
2023-02-20 08:56:33 +01:00
|
|
|
#include "markdowneditor.h"
|
2010-07-08 11:15:26 +02:00
|
|
|
#include "outlinefactory.h"
|
2014-09-02 12:54:28 +02:00
|
|
|
#include "plaintexteditorfactory.h"
|
2017-04-24 15:52:04 +02:00
|
|
|
#include "snippets/snippetprovider.h"
|
2024-01-26 18:05:26 +01:00
|
|
|
#include "storagesettings.h"
|
2023-01-17 18:02:43 +01:00
|
|
|
#include "tabsettings.h"
|
2021-10-21 15:39:28 +02:00
|
|
|
#include "textdocument.h"
|
2018-11-08 11:39:48 +01:00
|
|
|
#include "texteditor.h"
|
2024-01-17 08:45:47 +01:00
|
|
|
#include "texteditor_test.h"
|
2023-09-22 18:05:03 +02:00
|
|
|
#include "texteditorconstants.h"
|
2014-09-02 12:54:28 +02:00
|
|
|
#include "texteditorsettings.h"
|
2023-01-17 18:02:43 +01:00
|
|
|
#include "texteditortr.h"
|
2024-01-17 10:08:06 +01:00
|
|
|
#include "textmark.h"
|
2024-03-05 10:33:50 +01:00
|
|
|
#include "typehierarchy.h"
|
2024-01-26 18:05:26 +01:00
|
|
|
#include "typingsettings.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2022-11-14 12:54:05 +01:00
|
|
|
#ifdef WITH_TESTS
|
|
|
|
|
#include "codeassist/codeassist_test.h"
|
2023-05-25 11:00:13 +02:00
|
|
|
#include "highlighter_test.h"
|
2022-11-14 12:54:05 +01:00
|
|
|
#endif
|
|
|
|
|
|
2018-03-22 09:52:49 +01:00
|
|
|
#include <coreplugin/actionmanager/actioncontainer.h>
|
2021-10-21 15:39:28 +02:00
|
|
|
#include <coreplugin/actionmanager/actionmanager.h>
|
2015-02-26 13:38:54 +01:00
|
|
|
#include <coreplugin/actionmanager/command.h>
|
2023-09-22 18:05:03 +02:00
|
|
|
#include <coreplugin/coreconstants.h>
|
2021-10-21 15:39:28 +02:00
|
|
|
#include <coreplugin/diffservice.h>
|
2023-09-22 18:05:03 +02:00
|
|
|
#include <coreplugin/editormanager/editormanager.h>
|
|
|
|
|
#include <coreplugin/editormanager/ieditor.h>
|
2011-08-17 12:54:58 +02:00
|
|
|
#include <coreplugin/externaltoolmanager.h>
|
2021-10-21 15:39:28 +02:00
|
|
|
#include <coreplugin/foldernavigationwidget.h>
|
|
|
|
|
#include <coreplugin/icore.h>
|
2013-07-03 18:23:03 +02:00
|
|
|
|
2023-01-17 18:02:43 +01:00
|
|
|
#include <extensionsystem/pluginmanager.h>
|
2024-01-17 09:56:06 +01:00
|
|
|
#include <extensionsystem/iplugin.h>
|
2013-07-03 18:23:03 +02:00
|
|
|
|
2019-08-27 14:16:24 +02:00
|
|
|
#include <utils/fancylineedit.h>
|
2008-12-09 15:25:01 +01:00
|
|
|
#include <utils/qtcassert.h>
|
2014-10-13 18:49:44 +02:00
|
|
|
#include <utils/macroexpander.h>
|
2023-09-22 18:05:03 +02:00
|
|
|
#include <utils/utilsicons.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2023-09-01 17:19:37 +02:00
|
|
|
#include <QMenu>
|
|
|
|
|
|
2014-09-02 12:54:28 +02:00
|
|
|
using namespace Core;
|
2020-06-26 13:59:38 +02:00
|
|
|
using namespace Utils;
|
2023-09-22 18:05:03 +02:00
|
|
|
using namespace TextEditor::Constants;
|
2014-09-02 12:54:28 +02:00
|
|
|
|
2023-09-22 18:05:03 +02:00
|
|
|
namespace TextEditor::Internal {
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2023-01-17 18:02:43 +01:00
|
|
|
const char kCurrentDocumentSelection[] = "CurrentDocument:Selection";
|
|
|
|
|
const char kCurrentDocumentRow[] = "CurrentDocument:Row";
|
|
|
|
|
const char kCurrentDocumentColumn[] = "CurrentDocument:Column";
|
|
|
|
|
const char kCurrentDocumentRowCount[] = "CurrentDocument:RowCount";
|
|
|
|
|
const char kCurrentDocumentColumnCount[] = "CurrentDocument:ColumnCount";
|
|
|
|
|
const char kCurrentDocumentFontSize[] = "CurrentDocument:FontSize";
|
|
|
|
|
const char kCurrentDocumentWordUnderCursor[] = "CurrentDocument:WordUnderCursor";
|
2011-02-10 20:58:17 +01:00
|
|
|
|
2024-01-17 09:56:06 +01:00
|
|
|
class TextEditorPlugin final : public ExtensionSystem::IPlugin
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2024-01-17 09:56:06 +01:00
|
|
|
Q_OBJECT
|
|
|
|
|
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "TextEditor.json")
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2024-01-17 09:56:06 +01:00
|
|
|
public:
|
|
|
|
|
ShutdownFlag aboutToShutdown() final;
|
|
|
|
|
|
|
|
|
|
void initialize() final;
|
|
|
|
|
void extensionsInitialized() final;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2024-01-26 14:03:07 +01:00
|
|
|
void updateSearchResultsFont(const FontSettings &);
|
|
|
|
|
void updateSearchResultsTabWidth(const TabSettings &tabSettings);
|
|
|
|
|
void updateCurrentSelection(const QString &text);
|
|
|
|
|
|
|
|
|
|
void createStandardContextMenu();
|
2024-03-27 14:00:21 +01:00
|
|
|
void createEditorCommands();
|
2024-01-17 09:56:06 +01:00
|
|
|
};
|
|
|
|
|
|
2023-01-20 12:28:36 +01:00
|
|
|
void TextEditorPlugin::initialize()
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2024-01-17 08:45:47 +01:00
|
|
|
#ifdef WITH_TESTS
|
|
|
|
|
addTestCreator(createFormatTextTest);
|
|
|
|
|
addTestCreator(createTextDocumentTest);
|
|
|
|
|
addTestCreator(createTextEditorTest);
|
|
|
|
|
addTestCreator(createSnippetParserTest);
|
|
|
|
|
#endif
|
|
|
|
|
|
2024-01-26 18:05:26 +01:00
|
|
|
setupBehaviorSettings();
|
|
|
|
|
setupExtraEncodingSettings();
|
|
|
|
|
setupStorageSettings();
|
|
|
|
|
setupTypingSettings();
|
2024-02-15 09:25:18 +01:00
|
|
|
// Currently needed after the previous four lines.
|
|
|
|
|
// FIXME: This kind of dependency should not exist.
|
|
|
|
|
setupTextEditorSettings();
|
2024-01-26 14:18:05 +01:00
|
|
|
|
2024-01-17 10:08:06 +01:00
|
|
|
setupTextMarkRegistry(this);
|
2024-01-09 17:11:25 +01:00
|
|
|
setupOutlineFactory();
|
2024-03-05 10:33:50 +01:00
|
|
|
setupTypeHierarchyFactory();
|
2024-01-17 10:27:33 +01:00
|
|
|
setupLineNumberFilter(); // Goto line functionality for quick open
|
2024-01-09 17:11:25 +01:00
|
|
|
|
2024-01-26 14:40:38 +01:00
|
|
|
setupPlainTextEditor();
|
|
|
|
|
|
2024-01-17 15:14:37 +01:00
|
|
|
setupBookmarkManager(this);
|
2024-01-17 15:21:25 +01:00
|
|
|
setupBookmarkView();
|
2024-01-26 14:09:54 +01:00
|
|
|
setupBookmarkFilter();
|
2024-01-17 15:14:37 +01:00
|
|
|
|
2024-01-26 15:43:08 +01:00
|
|
|
setupFindInFiles(this);
|
|
|
|
|
setupFindInCurrentFile();
|
|
|
|
|
setupFindInOpenFiles();
|
|
|
|
|
|
2024-01-26 16:01:31 +01:00
|
|
|
setupMarkdownEditor();
|
|
|
|
|
setupJsonEditor();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-12-02 17:02:23 +01:00
|
|
|
// Add text snippet provider.
|
2017-04-24 15:52:04 +02:00
|
|
|
SnippetProvider::registerGroup(Constants::TEXT_SNIPPET_GROUP_ID,
|
2023-01-17 18:02:43 +01:00
|
|
|
Tr::tr("Text", "SnippetProvider"));
|
2010-12-02 17:02:23 +01:00
|
|
|
|
2024-01-26 14:03:07 +01:00
|
|
|
createStandardContextMenu();
|
2024-03-27 14:00:21 +01:00
|
|
|
createEditorCommands();
|
2022-11-14 12:54:05 +01:00
|
|
|
|
|
|
|
|
#ifdef WITH_TESTS
|
2024-01-19 17:48:18 +01:00
|
|
|
addTestCreator(createCodeAssistTests);
|
|
|
|
|
addTestCreator(createGenericHighlighterTests);
|
2022-11-14 12:54:05 +01:00
|
|
|
#endif
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2024-01-26 14:03:07 +01:00
|
|
|
void TextEditorPlugin::extensionsInitialized()
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2021-10-21 15:39:28 +02:00
|
|
|
connect(FolderNavigationWidgetFactory::instance(),
|
|
|
|
|
&FolderNavigationWidgetFactory::aboutToShowContextMenu,
|
2022-12-08 00:29:41 +01:00
|
|
|
this, [](QMenu *menu, const FilePath &filePath, bool isDir) {
|
2021-10-21 15:39:28 +02:00
|
|
|
if (!isDir && Core::DiffService::instance()) {
|
2023-09-22 18:05:03 +02:00
|
|
|
menu->addAction(TextDocument::createDiffAgainstCurrentFileAction(
|
2022-12-08 00:29:41 +01:00
|
|
|
menu, [filePath] { return filePath; }));
|
2021-10-21 15:39:28 +02:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2024-01-26 14:18:05 +01:00
|
|
|
connect(&textEditorSettings(), &TextEditorSettings::fontSettingsChanged,
|
2024-01-26 14:03:07 +01:00
|
|
|
this, &TextEditorPlugin::updateSearchResultsFont);
|
2009-04-08 14:32:31 +02:00
|
|
|
|
2020-11-18 22:42:51 +01:00
|
|
|
updateSearchResultsFont(TextEditorSettings::fontSettings());
|
2009-05-28 16:42:29 +02:00
|
|
|
|
2020-11-18 22:42:51 +01:00
|
|
|
connect(TextEditorSettings::codeStyle(), &ICodeStylePreferences::currentTabSettingsChanged,
|
2024-01-26 14:03:07 +01:00
|
|
|
this, &TextEditorPlugin::updateSearchResultsTabWidth);
|
2013-07-03 18:23:03 +02:00
|
|
|
|
2020-11-18 22:42:51 +01:00
|
|
|
updateSearchResultsTabWidth(TextEditorSettings::codeStyle()->currentTabSettings());
|
2018-02-06 14:00:12 +01:00
|
|
|
|
|
|
|
|
connect(ExternalToolManager::instance(), &ExternalToolManager::replaceSelectionRequested,
|
2024-01-26 14:03:07 +01:00
|
|
|
this, &TextEditorPlugin::updateCurrentSelection);
|
2013-07-03 18:23:03 +02:00
|
|
|
|
2023-09-22 18:05:03 +02:00
|
|
|
MacroExpander *expander = Utils::globalMacroExpander();
|
2014-10-13 12:49:05 +02:00
|
|
|
|
|
|
|
|
expander->registerVariable(kCurrentDocumentSelection,
|
2023-01-17 18:02:43 +01:00
|
|
|
Tr::tr("Selected text within the current document."),
|
2014-06-23 16:57:56 +02:00
|
|
|
[]() -> QString {
|
|
|
|
|
QString value;
|
2014-07-23 19:10:38 +02:00
|
|
|
if (BaseTextEditor *editor = BaseTextEditor::currentTextEditor()) {
|
2014-06-23 16:57:56 +02:00
|
|
|
value = editor->selectedText();
|
|
|
|
|
value.replace(QChar::ParagraphSeparator, QLatin1String("\n"));
|
|
|
|
|
}
|
|
|
|
|
return value;
|
|
|
|
|
});
|
|
|
|
|
|
2014-10-13 12:49:05 +02:00
|
|
|
expander->registerIntVariable(kCurrentDocumentRow,
|
2023-01-17 18:02:43 +01:00
|
|
|
Tr::tr("Line number of the text cursor position in current document (starts with 1)."),
|
2014-06-23 16:57:56 +02:00
|
|
|
[]() -> int {
|
2014-07-23 19:10:38 +02:00
|
|
|
BaseTextEditor *editor = BaseTextEditor::currentTextEditor();
|
2014-06-23 16:57:56 +02:00
|
|
|
return editor ? editor->currentLine() : 0;
|
|
|
|
|
});
|
|
|
|
|
|
2014-10-13 12:49:05 +02:00
|
|
|
expander->registerIntVariable(kCurrentDocumentColumn,
|
2023-01-17 18:02:43 +01:00
|
|
|
Tr::tr("Column number of the text cursor position in current document (starts with 0)."),
|
2014-06-23 16:57:56 +02:00
|
|
|
[]() -> int {
|
2014-07-23 19:10:38 +02:00
|
|
|
BaseTextEditor *editor = BaseTextEditor::currentTextEditor();
|
2014-06-23 16:57:56 +02:00
|
|
|
return editor ? editor->currentColumn() : 0;
|
|
|
|
|
});
|
|
|
|
|
|
2014-10-13 12:49:05 +02:00
|
|
|
expander->registerIntVariable(kCurrentDocumentRowCount,
|
2023-01-17 18:02:43 +01:00
|
|
|
Tr::tr("Number of lines visible in current document."),
|
2014-06-23 16:57:56 +02:00
|
|
|
[]() -> int {
|
2014-07-23 19:10:38 +02:00
|
|
|
BaseTextEditor *editor = BaseTextEditor::currentTextEditor();
|
2014-06-23 16:57:56 +02:00
|
|
|
return editor ? editor->rowCount() : 0;
|
|
|
|
|
});
|
|
|
|
|
|
2014-10-13 12:49:05 +02:00
|
|
|
expander->registerIntVariable(kCurrentDocumentColumnCount,
|
2023-01-17 18:02:43 +01:00
|
|
|
Tr::tr("Number of columns visible in current document."),
|
2014-06-23 16:57:56 +02:00
|
|
|
[]() -> int {
|
2014-07-23 19:10:38 +02:00
|
|
|
BaseTextEditor *editor = BaseTextEditor::currentTextEditor();
|
2014-06-23 16:57:56 +02:00
|
|
|
return editor ? editor->columnCount() : 0;
|
|
|
|
|
});
|
|
|
|
|
|
2014-10-13 12:49:05 +02:00
|
|
|
expander->registerIntVariable(kCurrentDocumentFontSize,
|
2023-01-17 18:02:43 +01:00
|
|
|
Tr::tr("Current document's font size in points."),
|
2014-06-23 16:57:56 +02:00
|
|
|
[]() -> int {
|
2014-07-23 19:10:38 +02:00
|
|
|
BaseTextEditor *editor = BaseTextEditor::currentTextEditor();
|
2014-06-23 16:57:56 +02:00
|
|
|
return editor ? editor->widget()->font().pointSize() : 0;
|
|
|
|
|
});
|
2020-10-26 12:06:59 +01:00
|
|
|
|
|
|
|
|
expander->registerVariable(kCurrentDocumentWordUnderCursor,
|
2023-01-17 18:02:43 +01:00
|
|
|
Tr::tr("Word under the current document's text cursor."), [] {
|
2020-10-26 12:06:59 +01:00
|
|
|
BaseTextEditor *editor = BaseTextEditor::currentTextEditor();
|
|
|
|
|
if (!editor)
|
|
|
|
|
return QString();
|
|
|
|
|
return Text::wordUnderCursor(editor->editorWidget()->textCursor());
|
|
|
|
|
});
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2018-11-08 11:39:48 +01:00
|
|
|
ExtensionSystem::IPlugin::ShutdownFlag TextEditorPlugin::aboutToShutdown()
|
|
|
|
|
{
|
2023-11-01 10:08:31 +01:00
|
|
|
HighlighterHelper::handleShutdown();
|
2018-11-08 11:39:48 +01:00
|
|
|
return SynchronousShutdown;
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-26 14:03:07 +01:00
|
|
|
void TextEditorPlugin::updateSearchResultsFont(const FontSettings &settings)
|
2009-04-08 14:32:31 +02:00
|
|
|
{
|
2014-09-02 12:54:28 +02:00
|
|
|
if (auto window = SearchResultWindow::instance()) {
|
2020-09-10 14:33:14 +02:00
|
|
|
const Format textFormat = settings.formatFor(C_TEXT);
|
|
|
|
|
const Format defaultResultFormat = settings.formatFor(C_SEARCH_RESULT);
|
|
|
|
|
const Format alt1ResultFormat = settings.formatFor(C_SEARCH_RESULT_ALT1);
|
|
|
|
|
const Format alt2ResultFormat = settings.formatFor(C_SEARCH_RESULT_ALT2);
|
2022-05-07 00:44:03 +03:00
|
|
|
const Format containingFunctionResultFormat =
|
|
|
|
|
settings.formatFor(C_SEARCH_RESULT_CONTAINING_FUNCTION);
|
2014-09-02 12:54:28 +02:00
|
|
|
window->setTextEditorFont(QFont(settings.family(), settings.fontSize() * settings.fontZoom() / 100),
|
2022-09-30 10:35:15 +02:00
|
|
|
{{SearchResultColor::Style::Default,
|
|
|
|
|
{textFormat.background(), textFormat.foreground(),
|
|
|
|
|
defaultResultFormat.background(), defaultResultFormat.foreground(),
|
|
|
|
|
containingFunctionResultFormat.background(),
|
|
|
|
|
containingFunctionResultFormat.foreground()}},
|
|
|
|
|
{SearchResultColor::Style::Alt1,
|
|
|
|
|
{textFormat.background(), textFormat.foreground(),
|
|
|
|
|
alt1ResultFormat.background(), alt1ResultFormat.foreground(),
|
|
|
|
|
containingFunctionResultFormat.background(),
|
|
|
|
|
containingFunctionResultFormat.foreground()}},
|
|
|
|
|
{SearchResultColor::Style::Alt2,
|
|
|
|
|
{textFormat.background(), textFormat.foreground(),
|
|
|
|
|
alt2ResultFormat.background(), alt2ResultFormat.foreground(),
|
|
|
|
|
containingFunctionResultFormat.background(),
|
|
|
|
|
containingFunctionResultFormat.foreground()}}});
|
2012-10-18 08:02:25 +02:00
|
|
|
}
|
2009-04-08 14:32:31 +02:00
|
|
|
}
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2024-01-26 14:03:07 +01:00
|
|
|
void TextEditorPlugin::updateSearchResultsTabWidth(const TabSettings &tabSettings)
|
2013-07-03 18:23:03 +02:00
|
|
|
{
|
|
|
|
|
if (auto window = SearchResultWindow::instance())
|
|
|
|
|
window->setTabWidth(tabSettings.m_tabSize);
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-26 14:03:07 +01:00
|
|
|
void TextEditorPlugin::updateCurrentSelection(const QString &text)
|
2010-12-09 15:53:43 +01:00
|
|
|
{
|
2014-09-30 17:45:48 +02:00
|
|
|
if (BaseTextEditor *editor = BaseTextEditor::currentTextEditor()) {
|
2013-08-08 08:43:04 +02:00
|
|
|
const int pos = editor->position();
|
2014-09-30 17:45:48 +02:00
|
|
|
int anchor = editor->position(AnchorPosition);
|
2011-02-28 14:48:42 +01:00
|
|
|
if (anchor < 0) // no selection
|
|
|
|
|
anchor = pos;
|
2013-08-08 08:43:04 +02:00
|
|
|
int selectionLength = pos - anchor;
|
|
|
|
|
const bool selectionInTextDirection = selectionLength >= 0;
|
|
|
|
|
if (!selectionInTextDirection)
|
2010-12-09 15:53:43 +01:00
|
|
|
selectionLength = -selectionLength;
|
2013-08-08 08:43:04 +02:00
|
|
|
const int start = qMin(pos, anchor);
|
2011-02-21 16:02:26 +01:00
|
|
|
editor->setCursorPosition(start);
|
2010-12-09 15:53:43 +01:00
|
|
|
editor->replace(selectionLength, text);
|
2013-08-08 08:43:04 +02:00
|
|
|
const int replacementEnd = editor->position();
|
|
|
|
|
editor->setCursorPosition(selectionInTextDirection ? start : replacementEnd);
|
|
|
|
|
editor->select(selectionInTextDirection ? replacementEnd : start);
|
2010-12-09 15:53:43 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-26 14:03:07 +01:00
|
|
|
void TextEditorPlugin::createStandardContextMenu()
|
2018-03-22 09:52:49 +01:00
|
|
|
{
|
|
|
|
|
ActionContainer *contextMenu = ActionManager::createMenu(Constants::M_STANDARDCONTEXTMENU);
|
|
|
|
|
contextMenu->appendGroup(Constants::G_UNDOREDO);
|
|
|
|
|
contextMenu->appendGroup(Constants::G_COPYPASTE);
|
|
|
|
|
contextMenu->appendGroup(Constants::G_SELECT);
|
|
|
|
|
contextMenu->appendGroup(Constants::G_BOM);
|
|
|
|
|
|
|
|
|
|
const auto add = [contextMenu](const Id &id, const Id &group) {
|
|
|
|
|
Command *cmd = ActionManager::command(id);
|
|
|
|
|
if (cmd)
|
|
|
|
|
contextMenu->addAction(cmd, group);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
add(Core::Constants::UNDO, Constants::G_UNDOREDO);
|
|
|
|
|
add(Core::Constants::REDO, Constants::G_UNDOREDO);
|
|
|
|
|
contextMenu->addSeparator(Constants::G_COPYPASTE);
|
|
|
|
|
add(Core::Constants::CUT, Constants::G_COPYPASTE);
|
|
|
|
|
add(Core::Constants::COPY, Constants::G_COPYPASTE);
|
|
|
|
|
add(Core::Constants::PASTE, Constants::G_COPYPASTE);
|
|
|
|
|
add(Constants::CIRCULAR_PASTE, Constants::G_COPYPASTE);
|
|
|
|
|
contextMenu->addSeparator(Constants::G_SELECT);
|
|
|
|
|
add(Core::Constants::SELECTALL, Constants::G_SELECT);
|
|
|
|
|
contextMenu->addSeparator(Constants::G_BOM);
|
|
|
|
|
add(Constants::SWITCH_UTF8BOM, Constants::G_BOM);
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-23 10:23:06 +03:00
|
|
|
class TextActionBuilder : public ActionBuilder
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
TextActionBuilder(QObject *contextActionParent, const Utils::Id actionId)
|
|
|
|
|
: ActionBuilder(contextActionParent, actionId)
|
|
|
|
|
{
|
|
|
|
|
setContext(Context(Constants::C_TEXTEDITOR));
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2024-03-27 14:00:21 +01:00
|
|
|
void TextEditorPlugin::createEditorCommands()
|
|
|
|
|
{
|
|
|
|
|
using namespace Core::Constants;
|
2024-04-11 15:04:36 +02:00
|
|
|
// Add shortcut for invoking automatic completion
|
|
|
|
|
Command *command = nullptr;
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, Constants::COMPLETE_THIS)
|
2024-04-11 15:04:36 +02:00
|
|
|
.setText(Tr::tr("Trigger Completion"))
|
|
|
|
|
.bindCommand(&command)
|
|
|
|
|
.setDefaultKeySequence(Tr::tr("Meta+Space"), Tr::tr("Ctrl+Space"));
|
|
|
|
|
|
|
|
|
|
connect(command, &Command::keySequenceChanged, [command] {
|
|
|
|
|
FancyLineEdit::setCompletionShortcut(command->keySequence());
|
|
|
|
|
});
|
|
|
|
|
FancyLineEdit::setCompletionShortcut(command->keySequence());
|
|
|
|
|
|
|
|
|
|
// Add shortcut for invoking function hint completion
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, Constants::FUNCTION_HINT)
|
2024-04-11 15:04:36 +02:00
|
|
|
.setText(Tr::tr("Display Function Hint"))
|
|
|
|
|
.setDefaultKeySequence(Tr::tr("Meta+Shift+D"), Tr::tr("Ctrl+Shift+D"));
|
|
|
|
|
|
|
|
|
|
// Add shortcut for invoking quick fix options
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, Constants::QUICKFIX_THIS)
|
2024-04-11 15:04:36 +02:00
|
|
|
.setText(Tr::tr("Trigger Refactoring Action"))
|
|
|
|
|
.setDefaultKeySequence(Tr::tr("Alt+Return"));
|
|
|
|
|
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, Constants::SHOWCONTEXTMENU)
|
2024-04-11 15:04:36 +02:00
|
|
|
.setText(Tr::tr("Show Context Menu"));
|
|
|
|
|
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, DELETE_LINE).setText(Tr::tr("Delete &Line"));
|
|
|
|
|
TextActionBuilder(this, DELETE_END_OF_LINE).setText(Tr::tr("Delete Line from Cursor On"));
|
|
|
|
|
TextActionBuilder(this, DELETE_END_OF_WORD).setText(Tr::tr("Delete Word from Cursor On"));
|
|
|
|
|
TextActionBuilder(this, DELETE_END_OF_WORD_CAMEL_CASE)
|
2024-04-10 11:24:32 +02:00
|
|
|
.setText(Tr::tr("Delete Word Camel Case from Cursor On"));
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, DELETE_START_OF_LINE)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Delete Line up to Cursor"))
|
|
|
|
|
.setDefaultKeySequence(Tr::tr("Ctrl+Backspace"), {});
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, DELETE_START_OF_WORD).setText(Tr::tr("Delete Word up to Cursor"));
|
|
|
|
|
TextActionBuilder(this, DELETE_START_OF_WORD_CAMEL_CASE)
|
2024-04-10 11:24:32 +02:00
|
|
|
.setText(Tr::tr("Delete Word Camel Case up to Cursor"));
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, GOTO_BLOCK_START_WITH_SELECTION)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Go to Block Start with Selection"))
|
|
|
|
|
.setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+{")));
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, GOTO_BLOCK_END_WITH_SELECTION)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Go to Block End with Selection"))
|
|
|
|
|
.setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+}")));
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, MOVE_LINE_UP)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Move Line Up"))
|
|
|
|
|
.setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+Shift+Up")));
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, MOVE_LINE_DOWN)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Move Line Down"))
|
|
|
|
|
.setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+Shift+Down")));
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, COPY_LINE_UP)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Copy Line Up"))
|
|
|
|
|
.setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+Alt+Up")));
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, COPY_LINE_DOWN)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Copy Line Down"))
|
|
|
|
|
.setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+Alt+Down")));
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, JOIN_LINES)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Join Lines"))
|
|
|
|
|
.setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+J")));
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, INSERT_LINE_ABOVE)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Insert Line Above Current Line"))
|
|
|
|
|
.setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+Shift+Return")));
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, INSERT_LINE_BELOW)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Insert Line Below Current Line"))
|
|
|
|
|
.setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+Return")));
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, SWITCH_UTF8BOM).setText(Tr::tr("Toggle UTF-8 BOM"));
|
|
|
|
|
TextActionBuilder(this, INDENT).setText(Tr::tr("Indent"));
|
|
|
|
|
TextActionBuilder(this, UNINDENT).setText(Tr::tr("Unindent"));
|
|
|
|
|
TextActionBuilder(this, FOLLOW_SYMBOL_UNDER_CURSOR)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Follow Symbol Under Cursor"))
|
|
|
|
|
.setDefaultKeySequence(QKeySequence(Qt::Key_F2));
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, FOLLOW_SYMBOL_UNDER_CURSOR_IN_NEXT_SPLIT)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Follow Symbol Under Cursor in Next Split"))
|
|
|
|
|
.setDefaultKeySequence(Tr::tr("Meta+E, F2"), Tr::tr("Ctrl+E, F2"));
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, FOLLOW_SYMBOL_TO_TYPE)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Follow Type Under Cursor"))
|
|
|
|
|
.setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+Shift+F2")));
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, FOLLOW_SYMBOL_TO_TYPE_IN_NEXT_SPLIT)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Follow Type Under Cursor in Next Split"))
|
|
|
|
|
.setDefaultKeySequence(Tr::tr("Meta+E, Shift+F2"), Tr::tr("Ctrl+E, Ctrl+Shift+F2"));
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, FIND_USAGES)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Find References to Symbol Under Cursor"))
|
|
|
|
|
.setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+Shift+U")));
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, RENAME_SYMBOL)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Rename Symbol Under Cursor"))
|
|
|
|
|
.setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+Shift+R")));
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, JUMP_TO_FILE_UNDER_CURSOR)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Jump to File Under Cursor"))
|
|
|
|
|
.setDefaultKeySequence(QKeySequence(Qt::Key_F2));
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, JUMP_TO_FILE_UNDER_CURSOR_IN_NEXT_SPLIT)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Jump to File Under Cursor in Next Split"))
|
|
|
|
|
.setDefaultKeySequence(Tr::tr("Meta+E, F2"), Tr::tr("Ctrl+E, F2"));
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, OPEN_CALL_HIERARCHY).setText(Tr::tr("Open Call Hierarchy"));
|
|
|
|
|
TextActionBuilder(this, OPEN_TYPE_HIERARCHY)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Open Type Hierarchy"))
|
|
|
|
|
.setDefaultKeySequence(Tr::tr("Meta+Shift+T"), Tr::tr("Ctrl+Shift+T"));
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, VIEW_PAGE_UP)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Move the View a Page Up and Keep the Cursor Position"))
|
|
|
|
|
.setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+PgUp")));
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, VIEW_PAGE_DOWN)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Move the View a Page Down and Keep the Cursor Position"))
|
|
|
|
|
.setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+PgDown")));
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, VIEW_LINE_UP)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Move the View a Line Up and Keep the Cursor Position"))
|
|
|
|
|
.setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+Up")));
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, VIEW_LINE_DOWN)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Move the View a Line Down and Keep the Cursor Position"))
|
|
|
|
|
.setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+Down")));
|
|
|
|
|
|
|
|
|
|
ActionManager::actionContainer(M_EDIT);
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, SELECT_ENCODING)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Select Encoding..."))
|
|
|
|
|
.addToContainer(M_EDIT, G_EDIT_OTHER);
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, CIRCULAR_PASTE)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Paste from Clipboard History"))
|
|
|
|
|
.setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+Shift+V")))
|
|
|
|
|
.addToContainer(M_EDIT, G_EDIT_COPYPASTE);
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, NO_FORMAT_PASTE)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Paste Without Formatting"))
|
|
|
|
|
.setDefaultKeySequence(Tr::tr("Ctrl+Alt+Shift+V"), QString())
|
|
|
|
|
.addToContainer(M_EDIT, G_EDIT_COPYPASTE);
|
|
|
|
|
|
|
|
|
|
ActionManager::actionContainer(M_EDIT_ADVANCED);
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, AUTO_INDENT_SELECTION)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Auto-&indent Selection"))
|
|
|
|
|
.setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+I")))
|
|
|
|
|
.addToContainer(M_EDIT_ADVANCED, G_EDIT_FORMAT);
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, AUTO_FORMAT_SELECTION)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Auto-&format Selection"))
|
|
|
|
|
.setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+;")))
|
|
|
|
|
.addToContainer(M_EDIT_ADVANCED, G_EDIT_FORMAT);
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, REWRAP_PARAGRAPH)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("&Rewrap Paragraph"))
|
|
|
|
|
.setDefaultKeySequence(Tr::tr("Meta+E, R"), Tr::tr("Ctrl+E, R"))
|
|
|
|
|
.addToContainer(M_EDIT_ADVANCED, G_EDIT_FORMAT);
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, VISUALIZE_WHITESPACE)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("&Visualize Whitespace"))
|
|
|
|
|
.setDefaultKeySequence(Tr::tr("Meta+E, Meta+V"), Tr::tr("Ctrl+E, Ctrl+V"))
|
2024-07-05 13:25:21 +02:00
|
|
|
.addToContainer(M_EDIT_ADVANCED, G_EDIT_FORMAT)
|
|
|
|
|
.setCheckable(true);
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, CLEAN_WHITESPACE)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Clean Whitespace"))
|
|
|
|
|
.addToContainer(M_EDIT_ADVANCED, G_EDIT_FORMAT);
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, TEXT_WRAPPING)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Enable Text &Wrapping"))
|
|
|
|
|
.setDefaultKeySequence(Tr::tr("Meta+E, Meta+W"), Tr::tr("Ctrl+E, Ctrl+W"))
|
|
|
|
|
.addToContainer(M_EDIT_ADVANCED, G_EDIT_FORMAT)
|
|
|
|
|
.setCheckable(true);
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, UN_COMMENT_SELECTION)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Toggle Comment &Selection"))
|
|
|
|
|
.setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+/")))
|
|
|
|
|
.addToContainer(M_EDIT_ADVANCED, G_EDIT_FORMAT);
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, CUT_LINE)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Cut &Line"))
|
|
|
|
|
.setDefaultKeySequence(QKeySequence(Tr::tr("Shift+Del")))
|
|
|
|
|
.addToContainer(M_EDIT_ADVANCED, G_EDIT_TEXT);
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, COPY_LINE)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Copy &Line"))
|
|
|
|
|
.setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+Ins")))
|
|
|
|
|
.addToContainer(M_EDIT_ADVANCED, G_EDIT_TEXT);
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, COPY_WITH_HTML)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Copy With Highlighting"))
|
|
|
|
|
.addToContainer(M_EDIT_ADVANCED, G_EDIT_TEXT);
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, ADD_CURSORS_TO_LINE_ENDS)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Create Cursors at Selected Line Ends"))
|
|
|
|
|
.setDefaultKeySequence(QKeySequence(Tr::tr("Alt+Shift+I")))
|
|
|
|
|
.addToContainer(M_EDIT_ADVANCED, G_EDIT_TEXT);
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, ADD_SELECT_NEXT_FIND_MATCH)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Add Next Occurrence to Selection"))
|
|
|
|
|
.setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+D")))
|
|
|
|
|
.addToContainer(M_EDIT_ADVANCED, G_EDIT_TEXT);
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, DUPLICATE_SELECTION)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("&Duplicate Selection"))
|
|
|
|
|
.addToContainer(M_EDIT_ADVANCED, G_EDIT_TEXT);
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, DUPLICATE_SELECTION_AND_COMMENT)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("&Duplicate Selection and Comment"))
|
|
|
|
|
.addToContainer(M_EDIT_ADVANCED, G_EDIT_TEXT);
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, UPPERCASE_SELECTION)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Uppercase Selection"))
|
|
|
|
|
.setDefaultKeySequence(Tr::tr("Meta+Shift+U"), Tr::tr("Alt+Shift+U"))
|
|
|
|
|
.addToContainer(M_EDIT_ADVANCED, G_EDIT_TEXT);
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, LOWERCASE_SELECTION)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Lowercase Selection"))
|
|
|
|
|
.setDefaultKeySequence(Tr::tr("Meta+U"), Tr::tr("Alt+U"))
|
|
|
|
|
.addToContainer(M_EDIT_ADVANCED, G_EDIT_TEXT);
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, SORT_LINES)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Sort Lines"))
|
|
|
|
|
.setDefaultKeySequence(Tr::tr("Meta+Shift+S"), Tr::tr("Alt+Shift+S"))
|
|
|
|
|
.addToContainer(M_EDIT_ADVANCED, G_EDIT_TEXT);
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, FOLD)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Fold"))
|
|
|
|
|
.setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+<")))
|
|
|
|
|
.addToContainer(M_EDIT_ADVANCED, G_EDIT_COLLAPSING);
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, UNFOLD)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Unfold"))
|
|
|
|
|
.setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+>")))
|
|
|
|
|
.addToContainer(M_EDIT_ADVANCED, G_EDIT_COLLAPSING);
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, UNFOLD_ALL)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Toggle &Fold All"))
|
|
|
|
|
.addToContainer(M_EDIT_ADVANCED, G_EDIT_COLLAPSING);
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, INCREASE_FONT_SIZE)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Increase Font Size"))
|
|
|
|
|
.setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl++")))
|
|
|
|
|
.addToContainer(M_EDIT_ADVANCED, G_EDIT_FONT);
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, DECREASE_FONT_SIZE)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Decrease Font Size"))
|
|
|
|
|
.setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+-")))
|
|
|
|
|
.addToContainer(M_EDIT_ADVANCED, G_EDIT_FONT);
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, RESET_FONT_SIZE)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Reset Font Size"))
|
|
|
|
|
.setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+0")))
|
|
|
|
|
.addToContainer(M_EDIT_ADVANCED, G_EDIT_FONT);
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, GOTO_BLOCK_START)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Go to Block Start"))
|
|
|
|
|
.setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+[")))
|
|
|
|
|
.addToContainer(M_EDIT_ADVANCED, G_EDIT_BLOCKS);
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, GOTO_BLOCK_END)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Go to Block End"))
|
|
|
|
|
.setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+]")))
|
|
|
|
|
.addToContainer(M_EDIT_ADVANCED, G_EDIT_BLOCKS);
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, SELECT_BLOCK_UP)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Select Block Up"))
|
|
|
|
|
.setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+U")))
|
|
|
|
|
.addToContainer(M_EDIT_ADVANCED, G_EDIT_BLOCKS);
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, SELECT_BLOCK_DOWN)
|
2024-03-27 14:00:21 +01:00
|
|
|
.setText(Tr::tr("Select Block Down"))
|
|
|
|
|
.setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+Shift+Alt+U")))
|
|
|
|
|
.addToContainer(M_EDIT_ADVANCED, G_EDIT_BLOCKS);
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, SELECT_WORD_UNDER_CURSOR).setText(Tr::tr("Select Word Under Cursor"));
|
|
|
|
|
|
|
|
|
|
TextActionBuilder(this, GOTO_DOCUMENT_START).setText(Tr::tr("Go to Document Start"));
|
|
|
|
|
TextActionBuilder(this, GOTO_DOCUMENT_END).setText(Tr::tr("Go to Document End"));
|
|
|
|
|
TextActionBuilder(this, GOTO_LINE_START).setText(Tr::tr("Go to Line Start"));
|
|
|
|
|
TextActionBuilder(this, GOTO_LINE_END).setText(Tr::tr("Go to Line End"));
|
|
|
|
|
TextActionBuilder(this, GOTO_NEXT_LINE).setText(Tr::tr("Go to Next Line"));
|
|
|
|
|
TextActionBuilder(this, GOTO_PREVIOUS_LINE).setText(Tr::tr("Go to Previous Line"));
|
|
|
|
|
TextActionBuilder(this, GOTO_PREVIOUS_CHARACTER).setText(Tr::tr("Go to Previous Character"));
|
|
|
|
|
TextActionBuilder(this, GOTO_NEXT_CHARACTER).setText(Tr::tr("Go to Next Character"));
|
|
|
|
|
TextActionBuilder(this, GOTO_PREVIOUS_WORD).setText(Tr::tr("Go to Previous Word"));
|
|
|
|
|
TextActionBuilder(this, GOTO_NEXT_WORD).setText(Tr::tr("Go to Next Word"));
|
|
|
|
|
TextActionBuilder(this, GOTO_PREVIOUS_WORD_CAMEL_CASE)
|
2024-04-10 11:24:32 +02:00
|
|
|
.setText(Tr::tr("Go to Previous Word (Camel Case)"));
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, GOTO_NEXT_WORD_CAMEL_CASE).setText(Tr::tr("Go to Next Word (Camel Case)"));
|
2024-03-27 14:00:21 +01:00
|
|
|
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, GOTO_LINE_START_WITH_SELECTION)
|
2024-04-10 11:24:32 +02:00
|
|
|
.setText(Tr::tr("Go to Line Start with Selection"));
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, GOTO_LINE_END_WITH_SELECTION)
|
2024-04-10 11:24:32 +02:00
|
|
|
.setText(Tr::tr("Go to Line End with Selection"));
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, GOTO_NEXT_LINE_WITH_SELECTION)
|
2024-04-10 11:24:32 +02:00
|
|
|
.setText(Tr::tr("Go to Next Line with Selection"));
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, GOTO_PREVIOUS_LINE_WITH_SELECTION)
|
2024-04-10 11:24:32 +02:00
|
|
|
.setText(Tr::tr("Go to Previous Line with Selection"));
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, GOTO_PREVIOUS_CHARACTER_WITH_SELECTION)
|
2024-04-10 11:24:32 +02:00
|
|
|
.setText(Tr::tr("Go to Previous Character with Selection"));
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, GOTO_NEXT_CHARACTER_WITH_SELECTION)
|
2024-04-10 11:24:32 +02:00
|
|
|
.setText(Tr::tr("Go to Next Character with Selection"));
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, GOTO_PREVIOUS_WORD_WITH_SELECTION)
|
2024-04-10 11:24:32 +02:00
|
|
|
.setText(Tr::tr("Go to Previous Word with Selection"));
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, GOTO_NEXT_WORD_WITH_SELECTION)
|
2024-04-10 11:24:32 +02:00
|
|
|
.setText(Tr::tr("Go to Next Word with Selection"));
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, GOTO_PREVIOUS_WORD_CAMEL_CASE_WITH_SELECTION)
|
2024-04-10 11:24:32 +02:00
|
|
|
.setText(Tr::tr("Go to Previous Word (Camel Case) with Selection"));
|
2024-06-23 10:23:06 +03:00
|
|
|
TextActionBuilder(this, GOTO_NEXT_WORD_CAMEL_CASE_WITH_SELECTION)
|
2024-04-10 11:24:32 +02:00
|
|
|
.setText(Tr::tr("Go to Next Word (Camel Case) with Selection"));
|
2024-03-27 14:00:21 +01:00
|
|
|
}
|
|
|
|
|
|
2023-09-22 18:05:03 +02:00
|
|
|
} // namespace TextEditor::Internal
|
2024-01-17 09:56:06 +01:00
|
|
|
|
|
|
|
|
#include "texteditorplugin.moc"
|