[GB.QT4.EXT]
* NEW: Change the keyboard shortcuts for moving between lines having the same indentation. Now they are CTRL+ALT+UP and CTRL+ALT+DOWN. git-svn-id: svn://localhost/gambas/trunk@4126 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
6ad8880c78
commit
f7338f544f
2 changed files with 48 additions and 42 deletions
|
@ -1313,7 +1313,9 @@ void GEditor::cursorUp(bool shift, bool ctrl, bool alt)
|
||||||
{
|
{
|
||||||
if (alt)
|
if (alt)
|
||||||
{
|
{
|
||||||
if (!ctrl)
|
if (ctrl)
|
||||||
|
movePreviousSameIndent(shift);
|
||||||
|
else
|
||||||
{
|
{
|
||||||
QString str;
|
QString str;
|
||||||
int x1, y1, x2, y2;
|
int x1, y1, x2, y2;
|
||||||
|
@ -1361,7 +1363,9 @@ void GEditor::cursorDown(bool shift, bool ctrl, bool alt)
|
||||||
{
|
{
|
||||||
if (alt)
|
if (alt)
|
||||||
{
|
{
|
||||||
if (!ctrl)
|
if (ctrl)
|
||||||
|
moveNextSameIndent(shift);
|
||||||
|
else
|
||||||
{
|
{
|
||||||
QString str;
|
QString str;
|
||||||
int x1, y1, x2, y2;
|
int x1, y1, x2, y2;
|
||||||
|
@ -1404,9 +1408,7 @@ void GEditor::cursorDown(bool shift, bool ctrl, bool alt)
|
||||||
cursorGoto(doc->getNextLimit(y), xx, shift);
|
cursorGoto(doc->getNextLimit(y), xx, shift);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GEditor::cursorHome(bool shift, bool ctrl, bool alt)
|
void GEditor::movePreviousSameIndent(bool shift)
|
||||||
{
|
|
||||||
if (alt)
|
|
||||||
{
|
{
|
||||||
int indent = doc->getIndent(y);
|
int indent = doc->getIndent(y);
|
||||||
int i2, y2;
|
int i2, y2;
|
||||||
|
@ -1421,7 +1423,10 @@ void GEditor::cursorHome(bool shift, bool ctrl, bool alt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (ctrl)
|
|
||||||
|
void GEditor::cursorHome(bool shift, bool ctrl, bool alt)
|
||||||
|
{
|
||||||
|
if (ctrl)
|
||||||
cursorGoto(0, 0, shift);
|
cursorGoto(0, 0, shift);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1433,10 +1438,7 @@ void GEditor::cursorHome(bool shift, bool ctrl, bool alt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GEditor::moveNextSameIndent(bool shift)
|
||||||
void GEditor::cursorEnd(bool shift, bool ctrl, bool alt)
|
|
||||||
{
|
|
||||||
if (alt)
|
|
||||||
{
|
{
|
||||||
int indent = doc->getIndent(y);
|
int indent = doc->getIndent(y);
|
||||||
int i2, y2;
|
int i2, y2;
|
||||||
|
@ -1451,22 +1453,25 @@ void GEditor::cursorEnd(bool shift, bool ctrl, bool alt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (ctrl)
|
|
||||||
|
void GEditor::cursorEnd(bool shift, bool ctrl, bool alt)
|
||||||
|
{
|
||||||
|
if (ctrl)
|
||||||
cursorGoto(numLines() - 1, lineLength(numLines() - 1), shift);
|
cursorGoto(numLines() - 1, lineLength(numLines() - 1), shift);
|
||||||
else
|
else
|
||||||
cursorGoto(y, lineLength(y), shift);
|
cursorGoto(y, lineLength(y), shift);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GEditor::cursorPageUp(bool mark)
|
void GEditor::cursorPageUp(bool shift, bool alt)
|
||||||
{
|
{
|
||||||
int page = visibleHeight() / _cellh;
|
int page = visibleHeight() / _cellh;
|
||||||
cursorGoto(viewToReal(realToView(y) - page), 0, mark);
|
cursorGoto(viewToReal(realToView(y) - page), 0, shift);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GEditor::cursorPageDown(bool mark)
|
void GEditor::cursorPageDown(bool shift, bool alt)
|
||||||
{
|
{
|
||||||
int page = visibleHeight() / _cellh;
|
int page = visibleHeight() / _cellh;
|
||||||
cursorGoto(viewToReal(realToView(y) + page), 0, mark);
|
cursorGoto(viewToReal(realToView(y) + page), 0, shift);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GEditor::newLine()
|
void GEditor::newLine()
|
||||||
|
@ -1720,9 +1725,9 @@ void GEditor::keyPressEvent(QKeyEvent *e)
|
||||||
case Qt::Key_End:
|
case Qt::Key_End:
|
||||||
cursorEnd(shift, ctrl, alt); return;
|
cursorEnd(shift, ctrl, alt); return;
|
||||||
case Qt::Key_Prior:
|
case Qt::Key_Prior:
|
||||||
cursorPageUp(shift); return;
|
cursorPageUp(shift, alt); return;
|
||||||
case Qt::Key_Next:
|
case Qt::Key_Next:
|
||||||
cursorPageDown(shift); return;
|
cursorPageDown(shift, alt); return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ctrl)
|
if (!ctrl)
|
||||||
|
@ -1779,9 +1784,9 @@ void GEditor::keyPressEvent(QKeyEvent *e)
|
||||||
case Qt::Key_Delete:
|
case Qt::Key_Delete:
|
||||||
del(ctrl); return;
|
del(ctrl); return;
|
||||||
case Qt::Key_Prior:
|
case Qt::Key_Prior:
|
||||||
cursorPageUp(shift); return;
|
cursorPageUp(shift, alt); return;
|
||||||
case Qt::Key_Next:
|
case Qt::Key_Next:
|
||||||
cursorPageDown(shift); return;
|
cursorPageDown(shift, alt); return;
|
||||||
case Qt::Key_Tab:
|
case Qt::Key_Tab:
|
||||||
tab(false); return;
|
tab(false); return;
|
||||||
case Qt::Key_BackTab:
|
case Qt::Key_BackTab:
|
||||||
|
@ -2461,7 +2466,6 @@ void GEditor::foldLine(int row, bool no_refresh)
|
||||||
int start, end;
|
int start, end;
|
||||||
GFoldedProc *fp;
|
GFoldedProc *fp;
|
||||||
int ny;
|
int ny;
|
||||||
GLine *l;
|
|
||||||
|
|
||||||
if (!doc->hasLimit(row))
|
if (!doc->hasLimit(row))
|
||||||
row = doc->getPreviousLimit(row);
|
row = doc->getPreviousLimit(row);
|
||||||
|
|
|
@ -209,8 +209,8 @@ public:
|
||||||
void cursorRight(bool shift, bool ctrl);
|
void cursorRight(bool shift, bool ctrl);
|
||||||
void cursorUp(bool shift, bool ctrl, bool alt);
|
void cursorUp(bool shift, bool ctrl, bool alt);
|
||||||
void cursorDown(bool shift, bool ctrl, bool alt);
|
void cursorDown(bool shift, bool ctrl, bool alt);
|
||||||
void cursorPageUp(bool mark);
|
void cursorPageUp(bool shift, bool alt);
|
||||||
void cursorPageDown(bool mark);
|
void cursorPageDown(bool shift, bool alt);
|
||||||
void cursorHome(bool shift, bool ctrl, bool alt);
|
void cursorHome(bool shift, bool ctrl, bool alt);
|
||||||
void cursorEnd(bool shift, bool ctrl, bool alt);
|
void cursorEnd(bool shift, bool ctrl, bool alt);
|
||||||
void newLine();
|
void newLine();
|
||||||
|
@ -225,6 +225,8 @@ public:
|
||||||
void redo();
|
void redo();
|
||||||
void tab(bool back);
|
void tab(bool back);
|
||||||
void selectAll();
|
void selectAll();
|
||||||
|
void movePreviousSameIndent(bool shift);
|
||||||
|
void moveNextSameIndent(bool shift);
|
||||||
|
|
||||||
bool getInsertMode() const { return _insertMode; }
|
bool getInsertMode() const { return _insertMode; }
|
||||||
void setInsertMode(bool mode);
|
void setInsertMode(bool mode);
|
||||||
|
|
Loading…
Reference in a new issue