diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 32183afc2f7..d0d6087fb6a 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -1477,6 +1477,16 @@ void TextEditorWidget::gotoBlockEndWithSelection() } } +void TextEditorWidget::gotoDocumentStart() +{ + moveCursor(QTextCursor::Start); +} + +void TextEditorWidget::gotoDocumentEnd() +{ + moveCursor(QTextCursor::End); +} + void TextEditorWidget::gotoLineStart() { d->handleHomeKey(false); diff --git a/src/plugins/texteditor/texteditor.h b/src/plugins/texteditor/texteditor.h index ff7193b0257..03f765a3f72 100644 --- a/src/plugins/texteditor/texteditor.h +++ b/src/plugins/texteditor/texteditor.h @@ -381,6 +381,8 @@ public: void gotoBlockStartWithSelection(); void gotoBlockEndWithSelection(); + void gotoDocumentStart(); + void gotoDocumentEnd(); void gotoLineStart(); void gotoLineStartWithSelection(); void gotoLineEnd(); diff --git a/src/plugins/texteditor/texteditoractionhandler.cpp b/src/plugins/texteditor/texteditoractionhandler.cpp index be12984f67a..2d65b348de8 100644 --- a/src/plugins/texteditor/texteditoractionhandler.cpp +++ b/src/plugins/texteditor/texteditoractionhandler.cpp @@ -432,6 +432,10 @@ void TextEditorActionHandlerPrivate::createActions() tr("Select Word Under Cursor")); // register GOTO Actions + registerAction(GOTO_DOCUMENT_START, + [] (TextEditorWidget *w) { w->gotoDocumentStart(); }, true, tr("Go to Document Start")); + registerAction(GOTO_DOCUMENT_END, + [] (TextEditorWidget *w) { w->gotoDocumentEnd(); }, true, tr("Go to Document End")); registerAction(GOTO_LINE_START, [] (TextEditorWidget *w) { w->gotoLineStart(); }, true, tr("Go to Line Start")); registerAction(GOTO_LINE_END, diff --git a/src/plugins/texteditor/texteditorconstants.h b/src/plugins/texteditor/texteditorconstants.h index 0fd1c706c93..e7024614e58 100644 --- a/src/plugins/texteditor/texteditorconstants.h +++ b/src/plugins/texteditor/texteditorconstants.h @@ -158,6 +158,8 @@ const char DELETE_START_OF_LINE[] = "TextEditor.DeleteStartOfLine"; const char DELETE_START_OF_WORD_CAMEL_CASE[] = "TextEditor.DeleteStartOfWordCamelCase"; const char SELECT_ENCODING[] = "TextEditor.SelectEncoding"; const char REWRAP_PARAGRAPH[] = "TextEditor.RewrapParagraph"; +const char GOTO_DOCUMENT_START[] = "TextEditor.GotoDocumentStart"; +const char GOTO_DOCUMENT_END[] = "TextEditor.GotoDocumentEnd"; const char GOTO_LINE_START[] = "TextEditor.GotoLineStart"; const char GOTO_LINE_END[] = "TextEditor.GotoLineEnd"; const char GOTO_NEXT_LINE[] = "TextEditor.GotoNextLine";