- 功能增强:输入'('时,如果下一个非空白字符是'('或者标识符/数字,则不自动补全
- 功能增强:如果项目文件和项目的编码相同,则不保存它的编码信息 - 修正:在保存文件时,会错误的使用缺省编码而不是文件原有的编码进行保存
This commit is contained in:
parent
d3c780a3a5
commit
ca0ad3249f
3
NEWS.md
3
NEWS.md
|
@ -3,6 +3,9 @@ Red Panda C++ Version 1.0.4
|
||||||
- enhancement: add help link for regular expression in search dialog
|
- enhancement: add help link for regular expression in search dialog
|
||||||
- enhancement: remember current problem set's filename
|
- enhancement: remember current problem set's filename
|
||||||
- enhancement: F1 shorcut opens offcial website
|
- enhancement: F1 shorcut opens offcial website
|
||||||
|
- enhancement: don't auto complete '(', if the next non-space char is neither '(' nor ident char
|
||||||
|
- enhancement: if a project's unit encoding is the same with project's encoding, don't save its encoding
|
||||||
|
- fix: files will be saved to default encoding inspite of its original encoding
|
||||||
|
|
||||||
Red Panda C++ Version 1.0.3
|
Red Panda C++ Version 1.0.3
|
||||||
- fix: when oj problem grabbed by competitive companion received,
|
- fix: when oj problem grabbed by competitive companion received,
|
||||||
|
|
|
@ -228,7 +228,10 @@ void Editor::loadFile(QString filename) {
|
||||||
|
|
||||||
void Editor::saveFile(QString filename) {
|
void Editor::saveFile(QString filename) {
|
||||||
QFile file(filename);
|
QFile file(filename);
|
||||||
this->lines()->saveToFile(file,mEncodingOption,
|
QByteArray encoding = mFileEncoding;
|
||||||
|
if (mFileEncoding==ENCODING_ASCII)
|
||||||
|
encoding = mEncodingOption;
|
||||||
|
this->lines()->saveToFile(file,encoding,
|
||||||
pSettings->editor().defaultEncoding(),
|
pSettings->editor().defaultEncoding(),
|
||||||
mFileEncoding);
|
mFileEncoding);
|
||||||
emit fileSaved(filename, mInProject);
|
emit fileSaved(filename, mInProject);
|
||||||
|
@ -797,13 +800,14 @@ void Editor::keyPressEvent(QKeyEvent *event)
|
||||||
case '*':
|
case '*':
|
||||||
handled = handleSymbolCompletion(ch);
|
handled = handleSymbolCompletion(ch);
|
||||||
return;
|
return;
|
||||||
case '(':
|
case '(': {
|
||||||
if (caretX()-1>=lineText().length()
|
QChar nextCh = nextNotspaceChar(caretY()-1,caretX()-1);
|
||||||
|| caretX()<=0
|
qDebug()<<nextCh;
|
||||||
|| isSpaceOrRightParenthesis(lineText().at(caretX()-1))) {
|
if (!isIdentChar(nextCh) && nextCh!='(' ){
|
||||||
handled = handleSymbolCompletion(ch);
|
handled = handleSymbolCompletion(ch);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
case '>':
|
case '>':
|
||||||
if ((caretX() <= 1) || lineText().isEmpty()
|
if ((caretX() <= 1) || lineText().isEmpty()
|
||||||
|| lineText()[caretX() - 2] != '-') {
|
|| lineText()[caretX() - 2] != '-') {
|
||||||
|
|
|
@ -608,6 +608,7 @@ bool Project::saveUnits()
|
||||||
ini.SetLongValue(groupName,"OverrideBuildCmd", unit->overrideBuildCmd());
|
ini.SetLongValue(groupName,"OverrideBuildCmd", unit->overrideBuildCmd());
|
||||||
ini.SetValue(groupName,"BuildCmd", toByteArray(unit->buildCmd()));
|
ini.SetValue(groupName,"BuildCmd", toByteArray(unit->buildCmd()));
|
||||||
ini.SetLongValue(groupName,"DetectEncoding", unit->encoding()==ENCODING_AUTO_DETECT);
|
ini.SetLongValue(groupName,"DetectEncoding", unit->encoding()==ENCODING_AUTO_DETECT);
|
||||||
|
if (unit->encoding() != options().encoding)
|
||||||
ini.SetValue(groupName,"FileEncoding", toByteArray(unit->encoding()));
|
ini.SetValue(groupName,"FileEncoding", toByteArray(unit->encoding()));
|
||||||
}
|
}
|
||||||
ini.SetLongValue("Project","UnitCount",count);
|
ini.SetLongValue("Project","UnitCount",count);
|
||||||
|
@ -927,7 +928,7 @@ PProjectUnit Project::addUnit(const QString &inFileName, PProjectModelNode paren
|
||||||
newUnit->setEncoding(e->fileEncoding());
|
newUnit->setEncoding(e->fileEncoding());
|
||||||
e->setInProject(true);
|
e->setInProject(true);
|
||||||
} else {
|
} else {
|
||||||
newUnit->setEncoding(pSettings->editor().defaultEncoding());
|
newUnit->setEncoding(options().encoding.toUtf8());
|
||||||
}
|
}
|
||||||
newUnit->setFolder(getFolderPath(parentNode));
|
newUnit->setFolder(getFolderPath(parentNode));
|
||||||
newUnit->setNode(makeNewFileNode(extractFileName(newUnit->fileName()), false, parentNode));
|
newUnit->setNode(makeNewFileNode(extractFileName(newUnit->fileName()), false, parentNode));
|
||||||
|
|
|
@ -1100,6 +1100,23 @@ QChar SynEdit::charAt(const BufferCoord &pos)
|
||||||
return QChar(0);
|
return QChar(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QChar SynEdit::nextNotspaceChar(int line, int ch)
|
||||||
|
{
|
||||||
|
if (ch<0)
|
||||||
|
return QChar();
|
||||||
|
QString s = mLines->getString(line);
|
||||||
|
if (s.isEmpty())
|
||||||
|
return QChar();
|
||||||
|
int x=ch;
|
||||||
|
while (x<s.length()) {
|
||||||
|
QChar ch = s[x];
|
||||||
|
if (!ch.isSpace())
|
||||||
|
return ch;
|
||||||
|
x++;
|
||||||
|
}
|
||||||
|
return QChar();
|
||||||
|
}
|
||||||
|
|
||||||
void SynEdit::setCaretAndSelection(const BufferCoord &ptCaret, const BufferCoord &ptBefore, const BufferCoord &ptAfter)
|
void SynEdit::setCaretAndSelection(const BufferCoord &ptCaret, const BufferCoord &ptBefore, const BufferCoord &ptAfter)
|
||||||
{
|
{
|
||||||
SynSelectionMode vOldMode = mActiveSelectionMode;
|
SynSelectionMode vOldMode = mActiveSelectionMode;
|
||||||
|
|
|
@ -214,6 +214,7 @@ public:
|
||||||
QString wordAtRowCol(const BufferCoord& XY);
|
QString wordAtRowCol(const BufferCoord& XY);
|
||||||
|
|
||||||
QChar charAt(const BufferCoord& pos);
|
QChar charAt(const BufferCoord& pos);
|
||||||
|
QChar nextNotspaceChar(int line, int ch);
|
||||||
int charColumns(QChar ch) const;
|
int charColumns(QChar ch) const;
|
||||||
|
|
||||||
bool isPointInSelection(const BufferCoord& Value) const;
|
bool isPointInSelection(const BufferCoord& Value) const;
|
||||||
|
|
Loading…
Reference in New Issue