Commit 808198c4 authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer

Removed the "Join Lines Up" action

It was a bit confusing, since it reversed the order of the lines. When
this would be fixed, the added value of this action is very small, since
you can then also simply move your cursor one up before joining the
lines.
parent 46a96c25
......@@ -877,39 +877,24 @@ void BaseTextEditor::copyLineUpDown(bool up)
setTextCursor(move);
}
void BaseTextEditor::joinLineUp()
{
joinLineUpDown(true);
}
void BaseTextEditor::joinLineDown()
{
joinLineUpDown(false);
}
void BaseTextEditor::joinLineUpDown(bool up)
void BaseTextEditor::joinLines()
{
QTextCursor move = textCursor();
move.beginEditBlock();
if(up)
move.movePosition(QTextCursor::Up);
else
move.movePosition(QTextCursor::Down);
move.movePosition(QTextCursor::Down);
move.movePosition(QTextCursor::StartOfBlock);
move.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
QString cutLine = move.selectedText();
// collapse trailing whitespaces to one or insert whitespace
cutLine.replace(QRegExp("^\\s*"), " ");
move.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor);
move.removeSelectedText();
move.clearSelection();
if(!up)
move.movePosition(QTextCursor::Up);
move.movePosition(QTextCursor::Up);
move.movePosition(QTextCursor::EndOfBlock);
move.insertText(cutLine);
move.endEditBlock();
setTextCursor(move);
......
......@@ -412,8 +412,7 @@ public slots:
void copyLineUp();
void copyLineDown();
void joinLineUp();
void joinLineDown();
void joinLines();
void cleanWhitespace();
......@@ -623,7 +622,6 @@ private:
void handleBackspaceKey();
void moveLineUpDown(bool up);
void copyLineUpDown(bool up);
void joinLineUpDown(bool up);
void saveCurrentCursorPositionForNavigation();
void updateCurrentLineHighlight();
......
......@@ -86,8 +86,7 @@ TextEditorActionHandler::TextEditorActionHandler(const QString &context,
m_moveLineDownAction(0),
m_copyLineUpAction(0),
m_copyLineDownAction(0),
m_joinLineUpAction(0),
m_joinLineDownAction(0),
m_joinLinesAction(0),
m_optionalActions(optionalActions),
m_currentEditor(0),
m_initialized(false)
......@@ -285,15 +284,10 @@ void TextEditorActionHandler::createActions()
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+Down")));
connect(m_copyLineDownAction, SIGNAL(triggered()), this, SLOT(copyLineDown()));
m_joinLineUpAction= new QAction(tr("Join Line Up"), this);
command = am->registerAction(m_joinLineUpAction, Constants::JOIN_LINE_UP, m_contextId);
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+J")));
connect(m_joinLineUpAction, SIGNAL(triggered()), this, SLOT(joinLineUp()));
m_joinLineDownAction= new QAction(tr("Join Line Down"), this);
command = am->registerAction(m_joinLineDownAction, Constants::JOIN_LINE_DOWN, m_contextId);
m_joinLinesAction= new QAction(tr("Join Lines"), this);
command = am->registerAction(m_joinLinesAction, Constants::JOIN_LINES, m_contextId);
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+J")));
connect(m_joinLineDownAction, SIGNAL(triggered()), this, SLOT(joinLineDown()));
connect(m_joinLinesAction, SIGNAL(triggered()), this, SLOT(joinLines()));
}
bool TextEditorActionHandler::supportsAction(const QString & /*id */) const
......@@ -455,8 +449,7 @@ FUNCTION(moveLineUp)
FUNCTION(moveLineDown)
FUNCTION(copyLineUp)
FUNCTION(copyLineDown)
FUNCTION(joinLineUp)
FUNCTION(joinLineDown)
FUNCTION(joinLines)
void TextEditorActionHandler::updateCurrentEditor(Core::IEditor *editor)
{
......
......@@ -115,8 +115,7 @@ private slots:
void moveLineDown();
void copyLineUp();
void copyLineDown();
void joinLineUp();
void joinLineDown();
void joinLines();
void updateCurrentEditor(Core::IEditor *editor);
private:
......@@ -153,8 +152,7 @@ private:
QAction *m_moveLineDownAction;
QAction *m_copyLineUpAction;
QAction *m_copyLineDownAction;
QAction *m_joinLineUpAction;
QAction *m_joinLineDownAction;
QAction *m_joinLinesAction;
uint m_optionalActions;
QPointer<BaseTextEditor> m_currentEditor;
......
......@@ -60,8 +60,7 @@ const char * const MOVE_LINE_UP = "TextEditor.MoveLineUp";
const char * const MOVE_LINE_DOWN = "TextEditor.MoveLineDown";
const char * const COPY_LINE_UP = "TextEditor.CopyLineUp";
const char * const COPY_LINE_DOWN = "TextEditor.CopyLineDown";
const char * const JOIN_LINE_UP = "TextEditor.JoinLineUp";
const char * const JOIN_LINE_DOWN = "TextEditor.JoinLineDown";
const char * const JOIN_LINES = "TextEditor.JoinLines";
const char * const CUT_LINE = "TextEditor.CutLine";
const char * const DELETE_LINE = "TextEditor.DeleteLine";
const char * const DELETE_WORD = "TextEditor.DeleteWord";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment