forked from qt-creator/qt-creator
fakevim: add some debugging code to track down unexpected mark changes
This commit is contained in:
@@ -102,6 +102,8 @@
|
|||||||
# define UNDO_DEBUG(s)
|
# define UNDO_DEBUG(s)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//#define DEBUG_MARKS 1
|
||||||
|
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
namespace FakeVim {
|
namespace FakeVim {
|
||||||
@@ -712,7 +714,6 @@ public:
|
|||||||
|
|
||||||
int m_targetColumn; // -1 if past end of line
|
int m_targetColumn; // -1 if past end of line
|
||||||
int m_visualTargetColumn; // 'l' can move past eol in visual mode only
|
int m_visualTargetColumn; // 'l' can move past eol in visual mode only
|
||||||
|
|
||||||
int m_cursorWidth;
|
int m_cursorWidth;
|
||||||
|
|
||||||
// auto-indent
|
// auto-indent
|
||||||
@@ -725,7 +726,6 @@ public:
|
|||||||
void handleStartOfLine();
|
void handleStartOfLine();
|
||||||
|
|
||||||
void recordJump();
|
void recordJump();
|
||||||
void recordNewUndo();
|
|
||||||
QVector<CursorPosition> m_jumpListUndo;
|
QVector<CursorPosition> m_jumpListUndo;
|
||||||
QVector<CursorPosition> m_jumpListRedo;
|
QVector<CursorPosition> m_jumpListRedo;
|
||||||
|
|
||||||
@@ -934,6 +934,9 @@ EventResult FakeVimHandler::Private::handleEvent(QKeyEvent *ev)
|
|||||||
EDITOR(setTextCursor(m_tc));
|
EDITOR(setTextCursor(m_tc));
|
||||||
m_oldPosition = m_tc.position();
|
m_oldPosition = m_tc.position();
|
||||||
}
|
}
|
||||||
|
#ifdef DEBUG_MARKS
|
||||||
|
updateSelection();
|
||||||
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1358,6 +1361,19 @@ void FakeVimHandler::Private::updateSelection()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//qDebug() << "SELECTION: " << selections;
|
//qDebug() << "SELECTION: " << selections;
|
||||||
|
#ifdef DEBUG_MARKS
|
||||||
|
for (QHashIterator<int, int> it(m_marks); it.hasNext(); ) {
|
||||||
|
it.next();
|
||||||
|
QTextEdit::ExtraSelection sel;
|
||||||
|
sel.cursor = m_tc;
|
||||||
|
sel.cursor.setPosition(it.value(), MoveAnchor);
|
||||||
|
sel.cursor.setPosition(it.value() + 1, KeepAnchor);
|
||||||
|
sel.format = m_tc.blockCharFormat();
|
||||||
|
sel.format.setForeground(Qt::blue);
|
||||||
|
sel.format.setBackground(Qt::green);
|
||||||
|
selections.append(sel);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
emit q->selectionChanged(selections);
|
emit q->selectionChanged(selections);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2368,7 +2384,6 @@ EventResult FakeVimHandler::Private::handleInsertMode(const Input &input)
|
|||||||
moveLeft(qMin(1, leftDist()));
|
moveLeft(qMin(1, leftDist()));
|
||||||
setTargetColumn();
|
setTargetColumn();
|
||||||
leaveVisualMode();
|
leaveVisualMode();
|
||||||
recordNewUndo();
|
|
||||||
}
|
}
|
||||||
g.dotCommand += m_lastInsertion;
|
g.dotCommand += m_lastInsertion;
|
||||||
g.dotCommand += QChar(27);
|
g.dotCommand += QChar(27);
|
||||||
@@ -4194,13 +4209,6 @@ void FakeVimHandler::Private::recordJump()
|
|||||||
UNDO_DEBUG("jumps: " << m_jumpListUndo);
|
UNDO_DEBUG("jumps: " << m_jumpListUndo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FakeVimHandler::Private::recordNewUndo()
|
|
||||||
{
|
|
||||||
//endEditBlock();
|
|
||||||
UNDO_DEBUG("---- BREAK ----");
|
|
||||||
//beginEditBlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
Column FakeVimHandler::Private::indentation(const QString &line) const
|
Column FakeVimHandler::Private::indentation(const QString &line) const
|
||||||
{
|
{
|
||||||
int ts = config(ConfigTabStop).toInt();
|
int ts = config(ConfigTabStop).toInt();
|
||||||
|
|||||||
Reference in New Issue
Block a user