- enhancement: match bracket

This commit is contained in:
Roy Qu 2022-03-13 18:45:48 +08:00
parent dd5ce57608
commit 79b8478af3
8 changed files with 257 additions and 219 deletions

View File

@ -14,6 +14,7 @@ Red Panda C++ Version 1.0.0
- enhancement: toggle block comment - enhancement: toggle block comment
- fix: syntax color of #include header filenames not correct - fix: syntax color of #include header filenames not correct
- enhancement: disable "code completion" will disable enhanced syntax highlight - enhancement: disable "code completion" will disable enhanced syntax highlight
- enhancement: match bracket
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

File diff suppressed because it is too large Load Diff

View File

@ -7130,3 +7130,12 @@ void MainWindow::on_actionToggle_Block_Comment_triggered()
} }
} }
void MainWindow::on_actionMatch_Bracket_triggered()
{
Editor * editor = mEditorList->getEditor();
if (editor != NULL ) {
editor->matchBracket();
}
}

View File

@ -609,6 +609,8 @@ private slots:
void on_actionToggle_Block_Comment_triggered(); void on_actionToggle_Block_Comment_triggered();
void on_actionMatch_Bracket_triggered();
private: private:
Ui::MainWindow *ui; Ui::MainWindow *ui;
EditorList *mEditorList; EditorList *mEditorList;

View File

@ -1422,7 +1422,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1114</width> <width>1114</width>
<height>26</height> <height>25</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuFile"> <widget class="QMenu" name="menuFile">
@ -1521,6 +1521,8 @@
<addaction name="actionBack"/> <addaction name="actionBack"/>
<addaction name="actionForward"/> <addaction name="actionForward"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionMatch_Bracket"/>
<addaction name="separator"/>
<addaction name="actionAdd_bookmark"/> <addaction name="actionAdd_bookmark"/>
<addaction name="actionRemove_Bookmark"/> <addaction name="actionRemove_Bookmark"/>
<addaction name="actionModify_Bookmark_Description"/> <addaction name="actionModify_Bookmark_Description"/>
@ -2860,6 +2862,14 @@
<string>Alt+Shift+A</string> <string>Alt+Shift+A</string>
</property> </property>
</action> </action>
<action name="actionMatch_Bracket">
<property name="text">
<string>Match Bracket</string>
</property>
<property name="shortcut">
<string>Ctrl+]</string>
</property>
</action>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>

View File

@ -268,5 +268,5 @@ void SynEditKeyStrokes::resetDefaults()
add(SynEditorCommand::ecNormalSelect, Qt::Key_N, Qt::ControlModifier | Qt::ShiftModifier); add(SynEditorCommand::ecNormalSelect, Qt::Key_N, Qt::ControlModifier | Qt::ShiftModifier);
add(SynEditorCommand::ecColumnSelect, Qt::Key_C, 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::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);
} }

View File

@ -5699,6 +5699,11 @@ void SynEdit::ExecuteCommand(SynEditorCommand Command, QChar AChar, void *pData)
verticalScrollBar()->setValue(verticalScrollBar()->value()+mMouseWheelScrollSpeed); verticalScrollBar()->setValue(verticalScrollBar()->value()+mMouseWheelScrollSpeed);
break; break;
case SynEditorCommand::ecMatchBracket: case SynEditorCommand::ecMatchBracket:
{
BufferCoord coord = getMatchingBracket();
if (coord.Char!=0 && coord.Line!=0)
internalSetCaretXY(coord);
}
break; break;
default: default:
break; break;

View File

@ -277,6 +277,7 @@ public:
virtual void shifttab() { commandProcessor(SynEditorCommand::ecShiftTab);} virtual void shifttab() { commandProcessor(SynEditorCommand::ecShiftTab);}
virtual void toggleComment() { commandProcessor(SynEditorCommand::ecToggleComment);} virtual void toggleComment() { commandProcessor(SynEditorCommand::ecToggleComment);}
virtual void toggleBlockComment() { commandProcessor(SynEditorCommand::ecToggleBlockComment);} virtual void toggleBlockComment() { commandProcessor(SynEditorCommand::ecToggleBlockComment);}
virtual void matchBracket() { commandProcessor(SynEditorCommand::ecMatchBracket);}
virtual void beginUpdate(); virtual void beginUpdate();
virtual void endUpdate(); virtual void endUpdate();