fix: ending glyph not correctly drawed after editing
This commit is contained in:
parent
9672ebd079
commit
fda9a424c4
|
@ -1756,6 +1756,8 @@ int Document::updateGlyphStartPositionList(
|
||||||
glyphStartPositionList[i] = right;
|
glyphStartPositionList[i] = right;
|
||||||
right += gWidth;
|
right += gWidth;
|
||||||
}
|
}
|
||||||
|
if (endGlyph<glyphStartPositionList.length())
|
||||||
|
glyphStartPositionList[endGlyph] = right;
|
||||||
return right-left;
|
return right-left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -435,7 +435,7 @@ void QSynEditPainter::paintToken(
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
i+=1;
|
i+=1;
|
||||||
glyphWidth += calcSegmentInterval(glyphStartPositionList, tokenLeft+tokenWidth, i);
|
glyphWidth += calcSegmentInterval(glyphStartPositionList, tokenRight, i);
|
||||||
textToPaint+=glyph2;
|
textToPaint+=glyph2;
|
||||||
if (tokenWidth + glyphWidth > last )
|
if (tokenWidth + glyphWidth > last )
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1908,7 +1908,7 @@ void QSynEdit::doDeleteLastChar()
|
||||||
Q_ASSERT(glyphIndex>0);
|
Q_ASSERT(glyphIndex>0);
|
||||||
int oldCaretX = mCaretX;
|
int oldCaretX = mCaretX;
|
||||||
int newCaretX = mDocument->glyphStartChar(mCaretY-1, glyphIndex-1)+1;
|
int newCaretX = mDocument->glyphStartChar(mCaretY-1, glyphIndex-1)+1;
|
||||||
qDebug()<<"delete last char:"<<oldCaretX<<newCaretX<<glyphIndex<<mCaretY;
|
//qDebug()<<"delete last char:"<<oldCaretX<<newCaretX<<glyphIndex<<mCaretY;
|
||||||
QString s = tempStr.mid(newCaretX-1, oldCaretX-newCaretX);
|
QString s = tempStr.mid(newCaretX-1, oldCaretX-newCaretX);
|
||||||
internalSetCaretX(newCaretX);
|
internalSetCaretX(newCaretX);
|
||||||
if (s==' ' || s=='\t')
|
if (s==' ' || s=='\t')
|
||||||
|
@ -6096,6 +6096,8 @@ void QSynEdit::paintEvent(QPaintEvent *event)
|
||||||
cacheRC.setWidth(rcClip.width()*dpr);
|
cacheRC.setWidth(rcClip.width()*dpr);
|
||||||
cacheRC.setHeight(rcClip.height()*dpr);
|
cacheRC.setHeight(rcClip.height()*dpr);
|
||||||
painter.drawImage(rcClip,*mContentImage,cacheRC);
|
painter.drawImage(rcClip,*mContentImage,cacheRC);
|
||||||
|
//glyph positions may be updated while painting, so we need to recalc here.
|
||||||
|
rcCaret = calculateCaretRect();
|
||||||
}
|
}
|
||||||
paintCaret(painter, rcCaret);
|
paintCaret(painter, rcCaret);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue