- fix: calculation for code snippets's tab stop positions is not correct
This commit is contained in:
parent
226ed6f406
commit
6a05496b6f
3
NEWS.md
3
NEWS.md
|
@ -1,3 +1,6 @@
|
||||||
|
Red Panda C++ Version 1.0.0
|
||||||
|
- fix: calculation for code snippets's tab stop positions is not correct
|
||||||
|
|
||||||
Red Panda C++ Version 0.14.5
|
Red Panda C++ Version 0.14.5
|
||||||
- fix: the "gnu c++ 20" option in compiler set options is wrong
|
- fix: the "gnu c++ 20" option in compiler set options is wrong
|
||||||
- enhancement: option "open files in the same red panda C++ instance", in options->environment->file associations
|
- enhancement: option "open files in the same red panda C++ instance", in options->environment->file associations
|
||||||
|
|
|
@ -2611,9 +2611,9 @@ void Editor::insertCodeSnippet(const QString &code)
|
||||||
QStringList newSl;
|
QStringList newSl;
|
||||||
for (int i=0;i<sl.count();i++) {
|
for (int i=0;i<sl.count();i++) {
|
||||||
int lastPos = 0;
|
int lastPos = 0;
|
||||||
QString s = sl[i];
|
QString s = sl[i].trimmed();
|
||||||
if (i>0)
|
// if (i>0)
|
||||||
lastPos = -spaceCount;
|
// lastPos = -spaceCount;
|
||||||
while (true) {
|
while (true) {
|
||||||
int insertPos = s.indexOf(USER_CODE_IN_INSERT_POS);
|
int insertPos = s.indexOf(USER_CODE_IN_INSERT_POS);
|
||||||
if (insertPos < 0) // no %INSERT% macro in this line now
|
if (insertPos < 0) // no %INSERT% macro in this line now
|
||||||
|
@ -2629,8 +2629,8 @@ void Editor::insertCodeSnippet(const QString &code)
|
||||||
mUserCodeInTabStops.append(p);
|
mUserCodeInTabStops.append(p);
|
||||||
}
|
}
|
||||||
lastPos = 0;
|
lastPos = 0;
|
||||||
if (i>0)
|
// if (i>0)
|
||||||
lastPos = -spaceCount;
|
// lastPos = -spaceCount;
|
||||||
while (true) {
|
while (true) {
|
||||||
int insertPos = s.indexOf(USER_CODE_IN_REPL_POS_BEGIN);
|
int insertPos = s.indexOf(USER_CODE_IN_REPL_POS_BEGIN);
|
||||||
if (insertPos < 0) // no %INSERT% macro in this line now
|
if (insertPos < 0) // no %INSERT% macro in this line now
|
||||||
|
@ -3611,8 +3611,16 @@ void Editor::popUserCodeInTabStops()
|
||||||
tabStopBegin = mTabStopEnd + p->x;
|
tabStopBegin = mTabStopEnd + p->x;
|
||||||
tabStopEnd = mTabStopEnd + p->endX;
|
tabStopEnd = mTabStopEnd + p->endX;
|
||||||
} else {
|
} else {
|
||||||
tabStopBegin = p->x+1;
|
QString line = lines()->getString(caretY()-1+p->y);
|
||||||
tabStopEnd = p->endX+1;
|
int n=0;
|
||||||
|
while (n<line.length()) {
|
||||||
|
if (line[n].unicode()>32)
|
||||||
|
break;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
// qDebug()<<line<<n<<p->x;
|
||||||
|
tabStopBegin = n+p->x+1;
|
||||||
|
tabStopEnd = n+p->endX+1;
|
||||||
}
|
}
|
||||||
mTabStopY = caretY() + p->y;
|
mTabStopY = caretY() + p->y;
|
||||||
newCursorPos.Line = mTabStopY;
|
newCursorPos.Line = mTabStopY;
|
||||||
|
|
Loading…
Reference in New Issue