- fix: calculation for code snippets's tab stop positions is not correct

This commit is contained in:
Roy Qu 2022-03-10 15:05:16 +08:00
parent 4cf9c2845a
commit 4c8bed0445
2 changed files with 9 additions and 3 deletions

View File

@ -2606,12 +2606,12 @@ void Editor::insertCodeSnippet(const QString &code)
});
QStringList sl = textToLines(parseMacros(code));
int lastI=0;
int spaceCount = GetLeftSpacing(
leftSpaces(lineText()),true).length();
// int spaceCount = GetLeftSpacing(
// leftSpaces(lineText()),true).length();
QStringList newSl;
for (int i=0;i<sl.count();i++) {
int lastPos = 0;
QString s = sl[i].trimmed();
QString s = sl[i];
if (i>0)
lastPos = countLeadingWhitespaceChars(s);
while (true) {

View File

@ -174,6 +174,12 @@ QList<QByteArray> splitByteArrayToLines(const QByteArray& content);
QString parseMacros(const QString& s);
/**
* @brief readFileToLines
* @param fileName
* @param codec
* @return
*/
QStringList readFileToLines(const QString& fileName, QTextCodec* codec);
QStringList readFileToLines(const QString& fileName);
QByteArray readFileToByteArray(const QString& fileName);