Wrong indent line position for non-monospace fonts.

This commit is contained in:
Roy Qu 2024-03-01 20:10:18 +08:00
parent cb66c7f340
commit f0f79c2917
2 changed files with 8 additions and 2 deletions

View File

@ -540,7 +540,13 @@ public:
} }
int tabWidth() const { int tabWidth() const {
return mTabSize * mSpaceWidth; return mTabSize * spaceWidth();
}
int spaceWidth() const {
if (mForceMonospace)
return mCharWidth;
return mSpaceWidth;
} }
void setTabSize(int newTabSize); void setTabSize(int newTabSize);

View File

@ -761,7 +761,7 @@ void QSynEditPainter::paintFoldAttributes()
tabSteps = 0; tabSteps = 0;
indentLevel = 0; indentLevel = 0;
while (tabSteps < lineIndent) { while (tabSteps < lineIndent) {
X = tabSteps * mEdit->mCharWidth + mEdit->textOffset() - 1; X = tabSteps * mEdit->mDocument->spaceWidth() + mEdit->textOffset() - 1;
tabSteps+=mEdit->tabSize(); tabSteps+=mEdit->tabSize();
indentLevel++ ; indentLevel++ ;
if (mEdit->mSyntaxer) { if (mEdit->mSyntaxer) {