Merge branch 'master' of github.com:royqh1979/RedPanda-CPP
# Conflicts: # NEWS.md
This commit is contained in:
commit
65beccdbd1
3
NEWS.md
3
NEWS.md
|
@ -13,6 +13,9 @@ Red Panda C++ Version 1.0.0
|
|||
- fix: wrong selection when drag & dropped in editor
|
||||
- enhancement: toggle block comment
|
||||
- fix: syntax color of #include header filenames not correct
|
||||
- enhancement: disable "code completion" will disable enhanced syntax highlight
|
||||
- enhancement: match bracket
|
||||
- enhancement: **Linux** convert to "gbk"/"gb18030" encodings when run under "zh_CN" locale
|
||||
- fix: when no selection, copy/cut should auto select whole line with the line break
|
||||
- fix: redo cut with no selection while make whole line selected
|
||||
- fix: correctly reset caret when redo cut with no selection
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -886,7 +886,7 @@ void Editor::onPreparePaintHighlightToken(int line, int aChar, const QString &to
|
|||
if (token.isEmpty())
|
||||
return;
|
||||
|
||||
if (mParser && highlighter() && (attr == highlighter()->identifierAttribute())
|
||||
if (mParser && mParser->enabled() && highlighter() && (attr == highlighter()->identifierAttribute())
|
||||
&& !mParser->isIncludeLine(lines()->getString(line-1)) ) {
|
||||
|
||||
BufferCoord p{aChar,line};
|
||||
|
@ -2439,7 +2439,9 @@ void Editor::initParser()
|
|||
&EditorList::getContentFromOpenedEditor,pMainWindow->editorList(),
|
||||
std::placeholders::_1, std::placeholders::_2));
|
||||
resetCppParser(mParser);
|
||||
mParser->setEnabled((highlighter() && highlighter()->getClass() == SynHighlighterClass::CppHighlighter));
|
||||
mParser->setEnabled(
|
||||
pSettings->codeCompletion().enabled() &&
|
||||
(highlighter() && highlighter()->getClass() == SynHighlighterClass::CppHighlighter));
|
||||
}
|
||||
|
||||
Editor::QuoteStatus Editor::getQuoteStatus()
|
||||
|
@ -2570,6 +2572,8 @@ void Editor::reparse()
|
|||
if (highlighter()->language() != SynHighlighterLanguage::Cpp
|
||||
&& highlighter()->language() != SynHighlighterLanguage::GLSL)
|
||||
return;
|
||||
if (mParser)
|
||||
mParser->setEnabled(pSettings->codeCompletion().enabled());
|
||||
parseFile(mParser,mFilename,mInProject);
|
||||
}
|
||||
|
||||
|
|
|
@ -2897,6 +2897,26 @@ void MainWindow::buildEncodingMenu()
|
|||
mMenuEncoding->addAction(ui->actionConvert_to_ANSI);
|
||||
mMenuEncoding->addAction(ui->actionConvert_to_UTF_8);
|
||||
|
||||
QList<PCharsetInfo> charsetsForLocale = pCharsetInfoManager->findCharsetByLocale(pCharsetInfoManager->localeName());
|
||||
|
||||
foreach(const PCharsetInfo& charset, charsetsForLocale) {
|
||||
QAction * action = new QAction(
|
||||
tr("Convert to %1").arg(QString(charset->name)));
|
||||
connect(action, &QAction::triggered,
|
||||
[charset,this](){
|
||||
Editor * editor = mEditorList->getEditor();
|
||||
if (editor == nullptr)
|
||||
return;
|
||||
if (QMessageBox::warning(this,tr("Confirm Convertion"),
|
||||
tr("The editing file will be saved using %1 encoding. <br />This operation can't be reverted. <br />Are you sure to continue?")
|
||||
.arg(QString(charset->name)),
|
||||
QMessageBox::Yes, QMessageBox::No)!=QMessageBox::Yes)
|
||||
return;
|
||||
editor->convertToEncoding(charset->name);
|
||||
});
|
||||
mMenuEncoding->addAction(action);
|
||||
}
|
||||
|
||||
ui->menuEdit->insertMenu(ui->actionFoldAll,mMenuEncoding);
|
||||
ui->menuEdit->insertSeparator(ui->actionFoldAll);
|
||||
ui->actionAuto_Detect->setCheckable(true);
|
||||
|
@ -7130,3 +7150,12 @@ void MainWindow::on_actionToggle_Block_Comment_triggered()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_actionMatch_Bracket_triggered()
|
||||
{
|
||||
Editor * editor = mEditorList->getEditor();
|
||||
if (editor != NULL ) {
|
||||
editor->matchBracket();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -609,6 +609,8 @@ private slots:
|
|||
|
||||
void on_actionToggle_Block_Comment_triggered();
|
||||
|
||||
void on_actionMatch_Bracket_triggered();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
EditorList *mEditorList;
|
||||
|
|
|
@ -1422,7 +1422,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1114</width>
|
||||
<height>26</height>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
|
@ -1521,6 +1521,8 @@
|
|||
<addaction name="actionBack"/>
|
||||
<addaction name="actionForward"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionMatch_Bracket"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionAdd_bookmark"/>
|
||||
<addaction name="actionRemove_Bookmark"/>
|
||||
<addaction name="actionModify_Bookmark_Description"/>
|
||||
|
@ -2860,6 +2862,14 @@
|
|||
<string>Alt+Shift+A</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionMatch_Bracket">
|
||||
<property name="text">
|
||||
<string>Match Bracket</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+]</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
|
|
@ -268,5 +268,5 @@ void SynEditKeyStrokes::resetDefaults()
|
|||
add(SynEditorCommand::ecNormalSelect, Qt::Key_N, Qt::ControlModifier | Qt::ShiftModifier);
|
||||
add(SynEditorCommand::ecColumnSelect, Qt::Key_C, Qt::ControlModifier | Qt::ShiftModifier);
|
||||
add(SynEditorCommand::ecLineSelect, Qt::Key_L, Qt::ControlModifier | Qt::ShiftModifier);
|
||||
add(SynEditorCommand::ecMatchBracket, Qt::Key_B, Qt::ControlModifier | Qt::ShiftModifier);
|
||||
// add(SynEditorCommand::ecMatchBracket, Qt::Key_B, Qt::ControlModifier | Qt::ShiftModifier);
|
||||
}
|
||||
|
|
|
@ -5720,6 +5720,13 @@ void SynEdit::ExecuteCommand(SynEditorCommand Command, QChar AChar, void *pData)
|
|||
case SynEditorCommand::ecScrollDown:
|
||||
verticalScrollBar()->setValue(verticalScrollBar()->value()+mMouseWheelScrollSpeed);
|
||||
break;
|
||||
case SynEditorCommand::ecMatchBracket:
|
||||
{
|
||||
BufferCoord coord = getMatchingBracket();
|
||||
if (coord.Char!=0 && coord.Line!=0)
|
||||
internalSetCaretXY(coord);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -277,6 +277,7 @@ public:
|
|||
virtual void shifttab() { commandProcessor(SynEditorCommand::ecShiftTab);}
|
||||
virtual void toggleComment() { commandProcessor(SynEditorCommand::ecToggleComment);}
|
||||
virtual void toggleBlockComment() { commandProcessor(SynEditorCommand::ecToggleBlockComment);}
|
||||
virtual void matchBracket() { commandProcessor(SynEditorCommand::ecMatchBracket);}
|
||||
|
||||
virtual void beginUpdate();
|
||||
virtual void endUpdate();
|
||||
|
|
Loading…
Reference in New Issue