- fix: tab/shift+tab not correctly handled in options dialog's code template page

This commit is contained in:
Roy Qu 2022-04-16 20:14:47 +08:00
parent 9d401cce42
commit 076a92fb77
7 changed files with 36 additions and 4 deletions

View File

@ -8,6 +8,7 @@ Red Panda C++ Version 1.0.4
- fix: files will be saved to default encoding inspite of its original encoding
- fix: parenthesis skip doesn't work when editing non-c/c++ files
- enhancement: prefer local headers over system headers when complete #include header path
- fix: tab/shift+tab not correctly handled in options dialog's code template page
Red Panda C++ Version 1.0.3
- fix: when oj problem grabbed by competitive companion received,

View File

@ -176,6 +176,9 @@ Editor::Editor(QWidget *parent, const QString& filename,
mParentPageControl->addTab(this,"");
updateCaption();
}
if (mParentPageControl==nullptr) {
setExtraKeystrokes();
}
connect(&mFunctionTipTimer, &QTimer::timeout,
this, &Editor::onFunctionTipsTimer);
@ -668,8 +671,13 @@ void Editor::keyPressEvent(QKeyEvent *event)
pMainWindow->functionTip()->hide();
return;
case Qt::Key_Tab:
handled = true;
tab();
return;
case Qt::Key_Backtab:
handled = true;
shifttab();
return;
case Qt::Key_Up:
if (pMainWindow->functionTip()->isVisible()) {
handled = true;

View File

@ -2843,7 +2843,7 @@
<string>Delete Line</string>
</property>
<property name="shortcut">
<string>Ctrl+D</string>
<string>Ctrl+E</string>
</property>
</action>
<action name="actionDuplicate_Line">
@ -2851,7 +2851,7 @@
<string>Duplicate Line</string>
</property>
<property name="shortcut">
<string>Ctrl+E</string>
<string>Ctrl+D</string>
</property>
</action>
<action name="actionDelete_Word">

View File

@ -274,5 +274,22 @@ 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);
}
void SynEditKeyStrokes::setExtraKeyStrokes()
{
add(SynEditorCommand::ecDeleteWordStart, Qt::Key_Backspace, Qt::ControlModifier);
add(SynEditorCommand::ecDeleteWordEnd, Qt::Key_Delete, Qt::ControlModifier);
add(SynEditorCommand::ecDuplicateLine, Qt::Key_D, Qt::ControlModifier);
add(SynEditorCommand::ecDeleteLine, Qt::Key_E, Qt::ControlModifier);
add(SynEditorCommand::ecSelectAll, Qt::Key_A, Qt::ControlModifier);
add(SynEditorCommand::ecCopy, Qt::Key_C, Qt::ControlModifier);
add(SynEditorCommand::ecPaste, Qt::Key_V, Qt::ControlModifier);
add(SynEditorCommand::ecCut, Qt::Key_X, Qt::ControlModifier);
add(SynEditorCommand::ecUndo, Qt::Key_Z, Qt::ControlModifier);
add(SynEditorCommand::ecRedo, Qt::Key_Y, Qt::ControlModifier);
}

View File

@ -244,6 +244,7 @@ public:
PSynEditKeyStroke findKeySequence(const QKeySequence& keySeq);
void clear();
void resetDefaults();
void setExtraKeyStrokes();
private:
SynEditKeyStrokeList mList;
};

View File

@ -933,6 +933,11 @@ void SynEdit::setDefaultKeystrokes()
mKeyStrokes.resetDefaults();
}
void SynEdit::setExtraKeystrokes()
{
mKeyStrokes.setExtraKeyStrokes();
}
void SynEdit::invalidateLine(int Line)
{
QRect rcInval;
@ -2425,7 +2430,6 @@ void SynEdit::doTabKey()
Spaces = '\t';
NewCaretX = mCaretX + 1;
}
setSelTextPrimitive(Spaces);
// Undo is already handled in SetSelText when SelectionMode is Column
if (mActiveSelectionMode != SynSelectionMode::smColumn) {

View File

@ -201,6 +201,7 @@ public:
int foldRowToLine(int Row) const;
int foldLineToRow(int Line) const;
void setDefaultKeystrokes();
void setExtraKeystrokes();
void invalidateLine(int Line);
void invalidateLines(int FirstLine, int LastLine);
void invalidateSelection();