- enhancement: ctrl+enter insert a new line at the end of current line

This commit is contained in:
Roy Qu 2022-03-16 21:13:59 +08:00
parent 14d99711f8
commit 8e00d50d1e
4 changed files with 22 additions and 4 deletions

View File

@ -32,6 +32,7 @@ Red Panda C++ Version 1.0.0
- fix: parse error in avxintrin.h
- fix: switch disassembly mode doesn't update contents
- fix: if there is a Red Panda C++ process running program, other Red Panda C++ processes can't run program correctly.
- enhancement: ctrl+enter insert a new line at the end of current line
Red Panda C++ Version 0.14.5
- fix: the "gnu c++ 20" option in compiler set options is wrong

View File

@ -223,8 +223,10 @@ void SynEditKeyStrokes::resetDefaults()
add(SynEditorCommand::ecRedo, Qt::Key_Backspace, Qt::AltModifier|Qt::ShiftModifier);
add(SynEditorCommand::ecLineBreak, Qt::Key_Return, Qt::NoModifier);
add(SynEditorCommand::ecLineBreak, Qt::Key_Return, Qt::ShiftModifier);
add(SynEditorCommand::ecLineBreakAtEnd, Qt::Key_Return, Qt::ControlModifier);
add(SynEditorCommand::ecLineBreak, Qt::Key_Enter, Qt::NoModifier);
add(SynEditorCommand::ecLineBreak, Qt::Key_Enter, Qt::ShiftModifier);
add(SynEditorCommand::ecLineBreakAtEnd, Qt::Key_Enter, Qt::ControlModifier);
add(SynEditorCommand::ecTab, Qt::Key_Tab, Qt::NoModifier);
add(SynEditorCommand::ecShiftTab, Qt::Key_Backtab, Qt::ShiftModifier);
add(SynEditorCommand::ecShiftTab, Qt::Key_Tab, Qt::ShiftModifier);

View File

@ -178,8 +178,11 @@ enum class SynEditorCommand {
ecUserFirst = 1001, // Start of user-defined commands
ecAutoCompletion = 650,
ecAutoCompletion = 650,
ecLineBreakAtBegin = 651, //add a line break at the begin of the line
ecLineBreakAtEnd = 652,
ecInsertLineAtBegin = 653,
ecInsertLineAtEnd = 654,
//### Code Folding ###
ecCollapse = ecUserFirst + 100,

View File

@ -5628,10 +5628,22 @@ void SynEdit::ExecuteCommand(SynEditorCommand Command, QChar AChar, void *pData)
clearAll();
break;
case SynEditorCommand::ecInsertLine:
insertLine(Command == SynEditorCommand::ecInsertLine);
insertLine(false);
break;
case SynEditorCommand::ecLineBreak:
insertLine(Command == SynEditorCommand::ecLineBreak);
insertLine(true);
break;
case SynEditorCommand::ecLineBreakAtEnd:
mUndoList->BeginBlock();
mUndoList->AddChange(
SynChangeReason::crCaret,
caretXY(),
caretXY(),
"",
activeSelectionMode());
moveCaretToLineEnd(false);
insertLine(true);
mUndoList->EndBlock();
break;
case SynEditorCommand::ecTab:
doTabKey();