when updating the highlight also update cursor position
This commit is contained in:
@ -96,7 +96,18 @@ void CodeEditor::setFont(const QFont &newfont)
|
|||||||
|
|
||||||
void CodeEditor::setHighlight(int block)
|
void CodeEditor::setHighlight(int block)
|
||||||
{
|
{
|
||||||
highlight = block;
|
highlight = block;
|
||||||
|
|
||||||
|
// also move cursor to current position
|
||||||
|
auto cursor = textCursor();
|
||||||
|
int moves = block - cursor.blockNumber();
|
||||||
|
if (moves < 0)
|
||||||
|
cursor.movePosition(QTextCursor::Up, QTextCursor::MoveAnchor, -moves);
|
||||||
|
else
|
||||||
|
cursor.movePosition(QTextCursor::Down, QTextCursor::MoveAnchor, moves);
|
||||||
|
setTextCursor(cursor);
|
||||||
|
|
||||||
|
// update graphics
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -922,7 +922,7 @@ void LammpsGui::do_run(bool use_buffer)
|
|||||||
|
|
||||||
logupdater = new QTimer(this);
|
logupdater = new QTimer(this);
|
||||||
connect(logupdater, &QTimer::timeout, this, &LammpsGui::logupdate);
|
connect(logupdater, &QTimer::timeout, this, &LammpsGui::logupdate);
|
||||||
logupdater->start(50);
|
logupdater->start(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LammpsGui::render_image()
|
void LammpsGui::render_image()
|
||||||
|
|||||||
Reference in New Issue
Block a user