mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
vim-mode: bug fix in block cursor mode
This commit is contained in:
parent
262c6acfd9
commit
7f230312df
@ -3987,8 +3987,6 @@ void VVim::processPasteAction(QList<Token> &p_tokens, bool p_pasteBefore)
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
setMode(VimMode::Normal);
|
||||
} else {
|
||||
// Normal mode.
|
||||
if (isBlock) {
|
||||
@ -4041,6 +4039,10 @@ void VVim::processPasteAction(QList<Token> &p_tokens, bool p_pasteBefore)
|
||||
|
||||
cursor.endEditBlock();
|
||||
|
||||
if (!checkMode(VimMode::Normal)) {
|
||||
setMode(VimMode::Normal);
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
m_editor->setTextCursorW(cursor);
|
||||
}
|
||||
|
@ -314,6 +314,7 @@ QVector<QTextLayout::FormatRange> VTextDocumentLayout::formatRangeFromSelection(
|
||||
// a position to specify the line. that's more convenience in usage.
|
||||
QTextLayout::FormatRange o;
|
||||
QTextLine l = p_block.layout()->lineForTextPosition(range.cursor.position() - blpos);
|
||||
Q_ASSERT(l.isValid());
|
||||
o.start = l.textStart();
|
||||
o.length = l.textLength();
|
||||
if (o.start + o.length == bllen - 1) {
|
||||
@ -1087,6 +1088,7 @@ int VTextDocumentLayout::getTextWidthWithinTextLine(const QTextLayout *p_layout,
|
||||
int p_length)
|
||||
{
|
||||
QTextLine line = p_layout->lineForTextPosition(p_pos);
|
||||
Q_ASSERT(line.isValid());
|
||||
Q_ASSERT(p_pos + p_length <= line.textStart() + line.textLength());
|
||||
return line.cursorToX(p_pos + p_length) - line.cursorToX(p_pos);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user