diff --git a/doc/qtcreator.qdoc b/doc/qtcreator.qdoc index 68dc857c0ae0a0e907163d271006dd205d4ae3eb..70a61d0cae2f929ff8b6c774bfe0dc83b5786024 100644 --- a/doc/qtcreator.qdoc +++ b/doc/qtcreator.qdoc @@ -231,7 +231,7 @@ To deselect, use \key{Ctrl+Shift+U}. \row \i Moving lines up and down - \i + \i \row \i Completion @@ -246,7 +246,17 @@ \row \i Switch between Header and Source - \i + \i Use \key{F4}. + + \row + \i Increasing and Decreasing Font Size + \i Use \key{Ctrl+Scroll Wheel} + + \row + \i Follow Symbols under The Cursor + \i Use \key{F2} and \key{Shift+F2}. This feature works with + namespaces, classes, methods, variables, include statements, + and macros. \endtable @@ -256,12 +266,6 @@ Up/Down/Page Up/Page Down - hold ctrl to prevent the cursor from moving - F2 and Shift F2 - follows symbols under the cursor (works for namespaces, classes, methods, variables, includes, macros). - - F4 - switch header and source - - Ctrl + Scroll wheel -- used to quickly change the font size (handy for presentatiaons) - To switch to an external editor, select \gui{Open in external editor} from diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index 78d2522639b22d572a29c9c915516465bcddc200..79530908c770d8021941a660f865b9a99f0b961b 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -2988,6 +2988,12 @@ void GdbEngine::runCustomDumper(const WatchData & data0, bool dumpChildren) //extraArgs[extraArgCount++] = sizeofTypeExpression(data.type); //extraArgs[extraArgCount++] = "(size_t)&(('" + data.type + "'*)0)->value"; } + } else if (outertype == "std::deque") { + // remove 'std::allocator<...>': + extraArgs[1] = "0"; + } else if (outertype == "std::stack") { + // remove 'std::allocator<...>': + extraArgs[1] = "0"; } else if (outertype == "std::map") { // We don't want the comparator and the allocator confuse gdb. // But we need the offset of the second item in the value pair. diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index 92c38397332c65b08d5cfc74e0ccf5989da35421..7344e1d983cae235b06524bc9d73c8ca2c6b56e6 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -191,7 +191,8 @@ private: void scrollToLineInDocument(int line); // helper functions for indenting - bool isElectricCharacter(QChar c) const { return (c == '{' || c == '}' || c == '#'); } + bool isElectricCharacter(QChar c) const + { return (c == '{' || c == '}' || c == '#'); } int indentDist() const; void indentRegion(QTextBlock first, QTextBlock last, QChar typedChar=0); void indentCurrentLine(QChar typedChar); @@ -201,6 +202,25 @@ private: void moveToNextWord(bool simple); void moveToMatchingParanthesis(); void moveToWordBoundary(bool simple, bool forward); + + // to reduce line noise + typedef QTextCursor::MoveOperation MoveOperation; + typedef QTextCursor::MoveMode MoveMode; + void moveToEndOfDocument(MoveMode m, int n = 1) + { m_tc.movePosition(QTextCursor::End, m, n); } + void moveToStartOfLine(MoveMode m, int n = 1) + { m_tc.movePosition(QTextCursor::StartOfLine, m, n); } + void moveToEndOfLine(MoveMode m, int n = 1) + { m_tc.movePosition(QTextCursor::EndOfLine, m, n); } + void moveUp(MoveMode m, int n = 1) + { m_tc.movePosition(QTextCursor::Up, m, n); } + void moveDown(MoveMode m, int n = 1) + { m_tc.movePosition(QTextCursor::Down, m, n); } + void moveRight(MoveMode m, int n = 1) + { m_tc.movePosition(QTextCursor::Right, m, n); } + void moveLeft(MoveMode m, int n = 1) + { m_tc.movePosition(QTextCursor::Left, m, n); } + void handleFfTt(int key); // helper function for handleCommand. return 1 based line index. @@ -254,11 +274,18 @@ public: void recordRemove(int position, const QString &data); void recordRemove(int position, int length); void recordMove(int position, int nestedCount); - void removeSelectedText(QTextCursor &tc); + + void recordRemoveNextChar(); + void recordInsertText(const QString &data); + void recordRemoveSelectedText(); + void recordBeginGroup(); + void recordEndGroup(); + void undo(); void redo(); QStack<EditOperation> m_undoStack; QStack<EditOperation> m_redoStack; + QStack<int> m_undoGroupStack; // extra data for '.' QString m_dotCount; @@ -336,7 +363,7 @@ bool FakeVimHandler::Private::handleEvent(QKeyEvent *ev) m_tc.setVisualNavigation(true); if (m_fakeEnd) - m_tc.movePosition(Right, MoveAnchor, 1); + moveRight(MoveAnchor); if ((ev->modifiers() & Qt::ControlModifier) != 0) { key += 256; @@ -351,7 +378,7 @@ bool FakeVimHandler::Private::handleEvent(QKeyEvent *ev) m_fakeEnd = (atEol() && m_mode == CommandMode); if (m_fakeEnd) - m_tc.movePosition(Left, MoveAnchor, 1); + moveLeft(MoveAnchor); EDITOR(setTextCursor(m_tc)); EDITOR(ensureCursorVisible()); @@ -378,7 +405,7 @@ void FakeVimHandler::Private::finishMovement(const QString &dotCommand) if (m_submode == FilterSubMode) { int beginLine = lineForPosition(m_tc.anchor()); int endLine = lineForPosition(m_tc.position()); - m_tc.setPosition(qMin(m_tc.anchor(), m_tc.position()), MoveAnchor); + m_tc.setPosition(qMin(m_tc.anchor(), m_tc.position())); m_mode = ExMode; m_commandBuffer = QString(".,+%1!").arg(qAbs(endLine - beginLine)); m_commandHistory.append(QString()); @@ -394,7 +421,7 @@ void FakeVimHandler::Private::finishMovement(const QString &dotCommand) if (!dotCommand.isEmpty()) m_dotCommand = "c" + dotCommand; m_registers[m_register] = m_tc.selectedText(); - removeSelectedText(m_tc); + recordRemoveSelectedText(); m_mode = InsertMode; m_submode = NoSubMode; } else if (m_submode == DeleteSubMode) { @@ -402,10 +429,10 @@ void FakeVimHandler::Private::finishMovement(const QString &dotCommand) m_dotCommand = "d" + dotCommand; recordRemove(qMin(m_tc.position(), m_tc.anchor()), m_tc.selectedText()); m_registers[m_register] = m_tc.selectedText(); - removeSelectedText(m_tc); + recordRemoveSelectedText(); m_submode = NoSubMode; if (atEol()) - m_tc.movePosition(Left, MoveAnchor, 1); + moveLeft(MoveAnchor); } else if (m_submode == YankSubMode) { m_registers[m_register] = m_tc.selectedText(); m_tc.setPosition(m_savedPosition); @@ -567,23 +594,23 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified, m_register = key; m_submode = NoSubMode; } else if (m_submode == ChangeSubMode && key == 'c') { - m_tc.movePosition(StartOfLine, MoveAnchor); - m_tc.movePosition(Down, KeepAnchor, count()); + moveToStartOfLine(MoveAnchor); + moveDown(KeepAnchor, count()); m_registers[m_register] = m_tc.selectedText(); finishMovement("c"); } else if (m_submode == DeleteSubMode && key == 'd') { - m_tc.movePosition(StartOfLine, MoveAnchor); - m_tc.movePosition(Down, KeepAnchor, count()); + moveToStartOfLine(MoveAnchor); + moveDown(KeepAnchor, count()); m_registers[m_register] = m_tc.selectedText(); finishMovement("d"); } else if (m_submode == YankSubMode && key == 'y') { - m_tc.movePosition(StartOfLine, MoveAnchor); - m_tc.movePosition(Down, KeepAnchor, count()); + moveToStartOfLine(MoveAnchor); + moveDown(KeepAnchor, count()); m_registers[m_register] = m_tc.selectedText(); finishMovement(); } else if (m_submode == ReplaceSubMode) { if (atEol()) - m_tc.movePosition(Left, KeepAnchor, 1); + moveLeft(KeepAnchor); else m_tc.deleteChar(); m_tc.insertText(text); @@ -652,8 +679,8 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified, } else if (key == '\'') { m_subsubmode = TickSubSubMode; } else if (key == '|') { - m_tc.movePosition(StartOfLine, KeepAnchor); - m_tc.movePosition(Right, KeepAnchor, qMin(count(), rightDist()) - 1); + moveToStartOfLine(KeepAnchor); + moveRight(KeepAnchor, qMin(count(), rightDist()) - 1); finishMovement(); } else if (key == '!' && m_visualMode == NoVisualMode) { m_submode = FilterSubMode; @@ -666,8 +693,8 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified, } else if (key == '"') { m_submode = RegisterSubMode; } else if (unmodified == Key_Return) { - m_tc.movePosition(StartOfLine); - m_tc.movePosition(Down); + moveToStartOfLine(MoveAnchor); + moveDown(MoveAnchor); moveToFirstNonBlankOnLine(); finishMovement(); } else if (key == Key_Home) { @@ -675,7 +702,7 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified, finishMovement(); } else if (key == '$' || key == Key_End) { int submode = m_submode; - m_tc.movePosition(EndOfLine, KeepAnchor); + moveToEndOfLine(KeepAnchor); finishMovement(); if (submode == NoSubMode) m_desiredColumn = -1; @@ -700,7 +727,7 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified, updateMiniBuffer(); } else if (key == 'A') { m_mode = InsertMode; - m_tc.movePosition(EndOfLine, MoveAnchor); + moveToEndOfLine(MoveAnchor); m_lastInsertion.clear(); } else if (key == 'b') { moveToWordBoundary(false, false); @@ -712,11 +739,11 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified, m_submode = ChangeSubMode; } else if (key == 'C') { m_submode = ChangeSubMode; - m_tc.movePosition(EndOfLine, KeepAnchor); + moveToEndOfLine(KeepAnchor); finishMovement(); } else if (key == 'd' && m_visualMode == NoVisualMode) { if (atEol()) - m_tc.movePosition(Left, MoveAnchor, 1); + moveLeft(MoveAnchor); m_opcount = m_mvcount; m_mvcount.clear(); m_submode = DeleteSubMode; @@ -725,11 +752,11 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified, int beginLine = lineForPosition(m_marks['<']); int endLine = lineForPosition(m_marks['>']); m_tc = selectRange(beginLine, endLine); - removeSelectedText(m_tc); + recordRemoveSelectedText(); } else if (key == 'D') { m_submode = DeleteSubMode; - m_tc.movePosition(Down, KeepAnchor, qMax(count() - 1, 0)); - m_tc.movePosition(Right, KeepAnchor, rightDist()); + moveDown(KeepAnchor, qMax(count() - 1, 0)); + moveRight(KeepAnchor, rightDist()); finishMovement(); } else if (key == 'e') { moveToWordBoundary(false, true); @@ -752,65 +779,67 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified, int n = qMin(count(), leftDist()); if (m_fakeEnd && m_tc.block().length() > 1) ++n; - m_tc.movePosition(Left, KeepAnchor, n); + moveLeft(KeepAnchor, n); finishMovement(); } else if (key == 'H') { m_tc = EDITOR(cursorForPosition(QPoint(0, 0))); - m_tc.movePosition(Down, KeepAnchor, qMax(count() - 1, 0)); + moveDown(KeepAnchor, qMax(count() - 1, 0)); moveToFirstNonBlankOnLine(); finishMovement(); } else if (key == 'i') { enterInsertMode(); updateMiniBuffer(); if (atEol()) - m_tc.movePosition(Left, MoveAnchor, 1); + moveLeft(MoveAnchor); } else if (key == 'I') { enterInsertMode(); if (m_gflag) - m_tc.movePosition(StartOfLine, KeepAnchor); + moveToStartOfLine(KeepAnchor); else moveToFirstNonBlankOnLine(); } else if (key == 'j' || key == Key_Down) { int savedColumn = m_desiredColumn; - if (m_submode == NoSubMode || m_submode == ZSubMode || m_submode == RegisterSubMode) { - m_tc.movePosition(Down, KeepAnchor, count()); + if (m_submode == NoSubMode || m_submode == ZSubMode + || m_submode == RegisterSubMode) { + moveDown(KeepAnchor, count()); moveToDesiredColumn(); } else { - m_tc.movePosition(StartOfLine, MoveAnchor); - m_tc.movePosition(Down, KeepAnchor, count()+1); + moveToStartOfLine(MoveAnchor); + moveDown(KeepAnchor, count() + 1); } finishMovement(); m_desiredColumn = savedColumn; } else if (key == 'J') { - EditOperation op; + recordBeginGroup(); if (m_submode == NoSubMode) { for (int i = qMax(count(), 2) - 1; --i >= 0; ) { - m_tc.movePosition(EndOfLine); - m_tc.deleteChar(); + moveToEndOfLine(MoveAnchor); + recordRemoveNextChar(); if (!m_gflag) - m_tc.insertText(" "); + recordInsertText(" "); } if (!m_gflag) - m_tc.movePosition(Left, MoveAnchor, 1); + moveLeft(MoveAnchor, 1); } + recordEndGroup(); } else if (key == 'k' || key == Key_Up) { int savedColumn = m_desiredColumn; if (m_submode == NoSubMode || m_submode == ZSubMode || m_submode == RegisterSubMode) { - m_tc.movePosition(Up, KeepAnchor, count()); + moveUp(KeepAnchor, count()); moveToDesiredColumn(); } else { - m_tc.movePosition(StartOfLine, MoveAnchor); - m_tc.movePosition(Down, MoveAnchor); - m_tc.movePosition(Up, KeepAnchor, count()+1); + moveToStartOfLine(MoveAnchor); + moveDown(MoveAnchor); + moveUp(KeepAnchor, count() + 1); } finishMovement(); m_desiredColumn = savedColumn; } else if (key == 'l' || key == Key_Right) { - m_tc.movePosition(Right, KeepAnchor, qMin(count(), rightDist())); + moveRight(KeepAnchor, qMin(count(), rightDist())); finishMovement(); } else if (key == 'L') { m_tc = EDITOR(cursorForPosition(QPoint(0, EDITOR(height())))); - m_tc.movePosition(Up, KeepAnchor, qMax(count(), 1)); + moveUp(KeepAnchor, qMax(count(), 1)); moveToFirstNonBlankOnLine(); finishMovement(); } else if (key == 'm') { @@ -827,12 +856,12 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified, enterInsertMode(); moveToFirstNonBlankOnLine(); int numSpaces = leftDist(); - m_tc.movePosition(Up, MoveAnchor, 1); + moveUp(MoveAnchor, 1); if (key == 'o') m_tc.movePosition(Down, MoveAnchor, 1); - m_tc.movePosition(EndOfLine, MoveAnchor); + moveToEndOfLine(MoveAnchor); m_tc.insertText("\n"); - m_tc.movePosition(StartOfLine, MoveAnchor); + moveToStartOfLine(MoveAnchor); if (m_config[ConfigAutoIndent] == ConfigOn) m_tc.insertText(QString(indentDist(), ' ')); else @@ -888,24 +917,24 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified, finishMovement("W"); } else if (key == 'x') { // = "dl" if (atEol()) - m_tc.movePosition(Left, MoveAnchor, 1); + moveLeft(MoveAnchor); m_submode = DeleteSubMode; - m_tc.movePosition(Right, KeepAnchor, qMin(count(), rightDist())); + moveRight(KeepAnchor, qMin(count(), rightDist())); finishMovement("l"); } else if (key == 'X') { if (leftDist() > 0) { - m_tc.movePosition(Left, KeepAnchor, qMin(count(), leftDist())); + moveLeft(KeepAnchor, qMin(count(), leftDist())); m_tc.deleteChar(); } finishMovement(); } else if (key == 'y') { if (atEol()) - m_tc.movePosition(Left, MoveAnchor, 1); + moveLeft(MoveAnchor); m_submode = YankSubMode; } else if (key == 'z') { m_submode = ZSubMode; } else if (key == '~' && !atEol()) { - m_tc.movePosition(Right, KeepAnchor, qMin(count(), rightDist())); + moveRight(KeepAnchor, qMin(count(), rightDist())); QString str = m_tc.selectedText(); for (int i = str.size(); --i >= 0; ) { QChar c = str.at(i); @@ -914,10 +943,10 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified, m_tc.deleteChar(); m_tc.insertText(str); } else if (key == Key_PageDown || key == control('f')) { - m_tc.movePosition(Down, KeepAnchor, count() * (linesOnScreen() - 2)); + moveDown(KeepAnchor, count() * (linesOnScreen() - 2)); finishMovement(); } else if (key == Key_PageUp || key == control('b')) { - m_tc.movePosition(Up, KeepAnchor, count() * (linesOnScreen() - 2)); + moveUp(KeepAnchor, count() * (linesOnScreen() - 2)); finishMovement(); } else if (key == Key_Backspace || key == control('h')) { m_tc.deletePreviousChar(); @@ -946,21 +975,21 @@ bool FakeVimHandler::Private::handleInsertMode(int key, int, const QString &text data += m_lastInsertion; } recordInsert(m_tc.position() - m_lastInsertion.size(), data); - m_tc.movePosition(Left, MoveAnchor, qMin(1, leftDist())); + moveLeft(MoveAnchor, qMin(1, leftDist())); enterCommandMode(); } else if (key == Key_Left) { - m_tc.movePosition(Left, MoveAnchor, 1); + moveLeft(MoveAnchor, count()); m_lastInsertion.clear(); } else if (key == Key_Down) { m_submode = NoSubMode; - m_tc.movePosition(Down, MoveAnchor, 1); + moveDown(MoveAnchor, count()); m_lastInsertion.clear(); } else if (key == Key_Up) { m_submode = NoSubMode; - m_tc.movePosition(Up, MoveAnchor, 1); + moveUp(MoveAnchor, count()); m_lastInsertion.clear(); } else if (key == Key_Right) { - m_tc.movePosition(Right, MoveAnchor, 1); + moveRight(MoveAnchor, count()); m_lastInsertion.clear(); } else if (key == Key_Return) { m_submode = NoSubMode; @@ -974,10 +1003,10 @@ bool FakeVimHandler::Private::handleInsertMode(int key, int, const QString &text m_tc.deleteChar(); m_lastInsertion.clear(); } else if (key == Key_PageDown || key == control('f')) { - m_tc.movePosition(Down, KeepAnchor, count() * (linesOnScreen() - 2)); + moveDown(KeepAnchor, count() * (linesOnScreen() - 2)); m_lastInsertion.clear(); } else if (key == Key_PageUp || key == control('b')) { - m_tc.movePosition(Up, KeepAnchor, count() * (linesOnScreen() - 2)); + moveUp(KeepAnchor, count() * (linesOnScreen() - 2)); m_lastInsertion.clear(); } else if (key == Key_Tab && m_config[ConfigExpandTab] == ConfigOn) { QString str = QString(m_config[ConfigTabStop].toInt(), ' '); @@ -1707,13 +1736,41 @@ void FakeVimHandler::Private::redo() #endif } -void FakeVimHandler::Private::removeSelectedText(QTextCursor &tc) +void FakeVimHandler::Private::recordBeginGroup() +{ + m_undoGroupStack.push(m_undoStack.size()); +} + +void FakeVimHandler::Private::recordEndGroup() +{ + EditOperation op; + op.m_itemCount = m_undoStack.size() - m_undoGroupStack.pop(); + recordOperation(op); +} + +void FakeVimHandler::Private::recordRemoveSelectedText() { EditOperation op; - op.m_position = qMin(tc.position(), tc.anchor()); - op.m_from = tc.selection().toPlainText(); + op.m_position = qMin(m_tc.position(), m_tc.anchor()); + op.m_from = m_tc.selection().toPlainText(); + recordOperation(op); + m_tc.removeSelectedText(); +} + +void FakeVimHandler::Private::recordRemoveNextChar() +{ + m_tc.setPosition(m_tc.position(), MoveAnchor); + m_tc.movePosition(Right, KeepAnchor); + recordRemoveSelectedText(); +} + +void FakeVimHandler::Private::recordInsertText(const QString &data) +{ + EditOperation op; + op.m_position = m_tc.position(); + op.m_to = data; recordOperation(op); - tc.removeSelectedText(); + m_tc.insertText(data); } void FakeVimHandler::Private::recordOperation(const EditOperation &op) diff --git a/tests/manual/gdbdebugger/simple/app.cpp b/tests/manual/gdbdebugger/simple/app.cpp index a20311822f8436336695ccff0186ff7b55ad856c..b719915c4793f79212d906155feecc5fb4bc693c 100644 --- a/tests/manual/gdbdebugger/simple/app.cpp +++ b/tests/manual/gdbdebugger/simple/app.cpp @@ -54,6 +54,7 @@ #include <QtNetwork/QHostAddress> +#include <deque> #include <iostream> #include <map> #include <list> @@ -444,6 +445,29 @@ void stringRefTest(const QString &refstring) Q_UNUSED(refstring); } +void testStdDeque() +{ + std::deque<int *> plist1; + plist1.push_back(new int(1)); + plist1.push_back(0); + plist1.push_back(new int(2)); + plist1.pop_back(); + plist1.pop_front(); + plist1.pop_front(); + + std::deque<int> flist2; + flist2.push_back(1); + flist2.push_back(2); + + std::deque<Foo *> plist; + plist.push_back(new Foo(1)); + plist.push_back(new Foo(2)); + + std::deque<Foo> flist; + flist.push_back(1); + flist.push_front(2); +} + void testStdList() { std::list<int *> plist1; @@ -911,6 +935,7 @@ int main(int argc, char *argv[]) testHidden(); testArray(); + testStdDeque(); testStdList(); testStdMap(); testStdStack();