forked from qt-creator/qt-creator
Editor: Rename format -> autoIndent
Renaming the auto indent function triggered by Ctrl+I to make room for a real format action. Change-Id: If5731353311030d66a20f1093a7fdd300703ebbc Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -697,7 +697,7 @@ bool ClangFormatBaseIndenter::isElectricCharacter(const QChar &ch) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClangFormatBaseIndenter::formatOrIndent(const QTextCursor &cursor,
|
void ClangFormatBaseIndenter::autoIndent(const QTextCursor &cursor,
|
||||||
const TextEditor::TabSettings & /*tabSettings*/,
|
const TextEditor::TabSettings & /*tabSettings*/,
|
||||||
int cursorPositionInEditor)
|
int cursorPositionInEditor)
|
||||||
{
|
{
|
||||||
|
@@ -50,11 +50,10 @@ public:
|
|||||||
const TextEditor::TabSettings &tabSettings,
|
const TextEditor::TabSettings &tabSettings,
|
||||||
int cursorPositionInEditor = -1) override;
|
int cursorPositionInEditor = -1) override;
|
||||||
|
|
||||||
void formatOrIndent(const QTextCursor &cursor,
|
void autoIndent(const QTextCursor &cursor,
|
||||||
const TextEditor::TabSettings &tabSettings,
|
const TextEditor::TabSettings &tabSettings,
|
||||||
int cursorPositionInEditor = -1) override;
|
int cursorPositionInEditor = -1) override;
|
||||||
TextEditor::Replacements format(
|
TextEditor::Replacements format(const TextEditor::RangesInLines &rangesInLines) override;
|
||||||
const TextEditor::RangesInLines &rangesInLines = TextEditor::RangesInLines()) override;
|
|
||||||
|
|
||||||
void indentBlock(const QTextBlock &block,
|
void indentBlock(const QTextBlock &block,
|
||||||
const QChar &typedChar,
|
const QChar &typedChar,
|
||||||
|
@@ -92,7 +92,7 @@ public:
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void formatOrIndent(const QTextCursor &cursor,
|
virtual void autoIndent(const QTextCursor &cursor,
|
||||||
const TabSettings &tabSettings,
|
const TabSettings &tabSettings,
|
||||||
int cursorPositionInEditor = -1)
|
int cursorPositionInEditor = -1)
|
||||||
{
|
{
|
||||||
@@ -100,7 +100,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// By default just calls indent with default settings.
|
// By default just calls indent with default settings.
|
||||||
virtual Replacements format(const RangesInLines & /*rangesInLines*/ = RangesInLines())
|
virtual Replacements format(const RangesInLines & /*rangesInLines*/)
|
||||||
{
|
{
|
||||||
return Replacements();
|
return Replacements();
|
||||||
}
|
}
|
||||||
|
@@ -493,7 +493,7 @@ void TextDocument::autoReindent(const QTextCursor &cursor, int currentCursorPosi
|
|||||||
|
|
||||||
void TextDocument::autoFormatOrIndent(const QTextCursor &cursor)
|
void TextDocument::autoFormatOrIndent(const QTextCursor &cursor)
|
||||||
{
|
{
|
||||||
d->m_indenter->formatOrIndent(cursor, tabSettings());
|
d->m_indenter->autoIndent(cursor, tabSettings());
|
||||||
}
|
}
|
||||||
|
|
||||||
QTextCursor TextDocument::indent(const QTextCursor &cursor, bool blockSelection, int column,
|
QTextCursor TextDocument::indent(const QTextCursor &cursor, bool blockSelection, int column,
|
||||||
|
@@ -7058,7 +7058,7 @@ void TextEditorWidget::setIfdefedOutBlocks(const QList<BlockRange> &blocks)
|
|||||||
documentLayout->requestUpdate();
|
documentLayout->requestUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextEditorWidget::format()
|
void TextEditorWidget::autoIndent()
|
||||||
{
|
{
|
||||||
QTextCursor cursor = textCursor();
|
QTextCursor cursor = textCursor();
|
||||||
cursor.beginEditBlock();
|
cursor.beginEditBlock();
|
||||||
|
@@ -345,7 +345,7 @@ public:
|
|||||||
virtual void cut();
|
virtual void cut();
|
||||||
virtual void selectAll();
|
virtual void selectAll();
|
||||||
|
|
||||||
virtual void format();
|
virtual void autoIndent();
|
||||||
virtual void rewrapParagraph();
|
virtual void rewrapParagraph();
|
||||||
virtual void unCommentSelection();
|
virtual void unCommentSelection();
|
||||||
|
|
||||||
|
@@ -324,7 +324,7 @@ void TextEditorActionHandlerPrivate::createActions()
|
|||||||
// register "Edit -> Advanced" Menu Actions
|
// register "Edit -> Advanced" Menu Actions
|
||||||
Core::ActionContainer *advancedEditMenu = Core::ActionManager::actionContainer(M_EDIT_ADVANCED);
|
Core::ActionContainer *advancedEditMenu = Core::ActionManager::actionContainer(M_EDIT_ADVANCED);
|
||||||
m_formatAction = registerAction(AUTO_INDENT_SELECTION,
|
m_formatAction = registerAction(AUTO_INDENT_SELECTION,
|
||||||
[] (TextEditorWidget *w) { w->format(); }, true, tr("Auto-&indent Selection"),
|
[] (TextEditorWidget *w) { w->autoIndent(); }, true, tr("Auto-&indent Selection"),
|
||||||
QKeySequence(tr("Ctrl+I")),
|
QKeySequence(tr("Ctrl+I")),
|
||||||
G_EDIT_FORMAT, advancedEditMenu);
|
G_EDIT_FORMAT, advancedEditMenu);
|
||||||
m_rewrapParagraphAction = registerAction(REWRAP_PARAGRAPH,
|
m_rewrapParagraphAction = registerAction(REWRAP_PARAGRAPH,
|
||||||
|
Reference in New Issue
Block a user