VTextDocumentLayout: fix hitTest() in cursor block mode

This commit is contained in:
Le Tan 2017-12-01 23:24:40 +08:00
parent 0d6ed84228
commit 00f3665c1c
2 changed files with 7 additions and 1 deletions

View File

@ -311,7 +311,7 @@ void VMdEditor::mouseReleaseEvent(QMouseEvent *p_event)
return; return;
} }
VTextEdit::mousePressEvent(p_event); VTextEdit::mouseReleaseEvent(p_event);
} }
void VMdEditor::mouseMoveEvent(QMouseEvent *p_event) void VMdEditor::mouseMoveEvent(QMouseEvent *p_event)

View File

@ -353,6 +353,12 @@ int VTextDocumentLayout::hitTest(const QPointF &p_point, Qt::HitTestAccuracy p_a
} }
} }
if (m_cursorBlockMode
&& off == block.length() - 1
&& off != 0) {
--off;
}
return block.position() + off; return block.position() + off;
} }