- fix: Reformat code when select contents in column mode will mess up the document.
- enhancement: Add "save as" icon to the toolbar. - enhancement: Use key sequences as shortcut to actions in the options dialog's environment->shortcut page. - change: Use ctrl+shift+S as the shortcut for "save as". - change: Use ctrl+K,ctrl+S as the shortcut for "save all".
This commit is contained in:
parent
9cfc892e3f
commit
7a8a239dfc
5
NEWS.md
5
NEWS.md
|
@ -9,6 +9,11 @@ Red Panda C++ Version 2.19
|
||||||
- enhancement: Open Containing folder will auto select the file in windows file explore.
|
- enhancement: Open Containing folder will auto select the file in windows file explore.
|
||||||
- fix: Class constructor & destructor is not correctly handled.
|
- fix: Class constructor & destructor is not correctly handled.
|
||||||
- fix: Remove multiple files in the project panel is not correctly handled.
|
- fix: Remove multiple files in the project panel is not correctly handled.
|
||||||
|
- fix: Reformat code when select contents in column mode will mess up the document.
|
||||||
|
- enhancement: Add "save as" icon to the toolbar.
|
||||||
|
- enhancement: Use key sequences as shortcut to actions in the options dialog's environment->shortcut page.
|
||||||
|
- change: Use ctrl+shift+S as the shortcut for "save as".
|
||||||
|
- change: Use ctrl+K,ctrl+S as the shortcut for "save all".
|
||||||
|
|
||||||
Red Panda C++ Version 2.18
|
Red Panda C++ Version 2.18
|
||||||
|
|
||||||
|
|
|
@ -379,6 +379,7 @@
|
||||||
<addaction name="actionNew"/>
|
<addaction name="actionNew"/>
|
||||||
<addaction name="actionOpen"/>
|
<addaction name="actionOpen"/>
|
||||||
<addaction name="actionSave"/>
|
<addaction name="actionSave"/>
|
||||||
|
<addaction name="actionSaveAs"/>
|
||||||
<addaction name="actionSaveAll"/>
|
<addaction name="actionSaveAll"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QToolBar" name="toolbarCode">
|
<widget class="QToolBar" name="toolbarCode">
|
||||||
|
@ -2114,6 +2115,9 @@
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Save As</string>
|
<string>Save As</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+Shift+S</string>
|
||||||
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionSaveAll">
|
<action name="actionSaveAll">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
|
@ -2125,7 +2129,7 @@
|
||||||
<string>Save All</string>
|
<string>Save All</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcut">
|
<property name="shortcut">
|
||||||
<string>Ctrl+Shift+S</string>
|
<string>Ctrl+K, Ctrl+S</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionOptions">
|
<action name="actionOptions">
|
||||||
|
|
|
@ -46,6 +46,15 @@ void ToolsManager::load()
|
||||||
item->parameters = "<EXENAME>";
|
item->parameters = "<EXENAME>";
|
||||||
item->pauseAfterExit = false;
|
item->pauseAfterExit = false;
|
||||||
mTools.append(item);
|
mTools.append(item);
|
||||||
|
//#ifdef Q_OS_WIN
|
||||||
|
// item = std::make_shared<ToolItem>();
|
||||||
|
// item->title = tr("Open compiled in explorer");
|
||||||
|
// item->program = "explorer.exe";
|
||||||
|
// item->workingDirectory = "<SOURCEPATH>";
|
||||||
|
// item->parameters = " /n, /select, <EXENAME>";
|
||||||
|
// item->pauseAfterExit = false;
|
||||||
|
// mTools.append(item);
|
||||||
|
//#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//read config file
|
//read config file
|
||||||
|
|
|
@ -5199,6 +5199,10 @@
|
||||||
<source>It will be closed.</source>
|
<source>It will be closed.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Ctrl+K, Ctrl+S</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>MemoryModel</name>
|
<name>MemoryModel</name>
|
||||||
|
@ -7818,6 +7822,10 @@
|
||||||
<source>Write to tools config file '%1' failed.</source>
|
<source>Write to tools config file '%1' failed.</source>
|
||||||
<translation>Falha ao gravar o arquivo de configurações '%1'.</translation>
|
<translation>Falha ao gravar o arquivo de configurações '%1'.</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Open compiled in explorer</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>WatchModel</name>
|
<name>WatchModel</name>
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -4932,6 +4932,10 @@
|
||||||
<source>It will be closed.</source>
|
<source>It will be closed.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Ctrl+K, Ctrl+S</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>MemoryModel</name>
|
<name>MemoryModel</name>
|
||||||
|
@ -7154,6 +7158,10 @@
|
||||||
<source>Write to tools config file '%1' failed.</source>
|
<source>Write to tools config file '%1' failed.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Open compiled in explorer</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>WatchModel</name>
|
<name>WatchModel</name>
|
||||||
|
|
|
@ -31,6 +31,7 @@ ShortcutInputEdit::ShortcutInputEdit(QWidget* parent):QLineEdit(parent)
|
||||||
|
|
||||||
void ShortcutInputEdit::keyPressEvent(QKeyEvent *event)
|
void ShortcutInputEdit::keyPressEvent(QKeyEvent *event)
|
||||||
{
|
{
|
||||||
|
QString lastKeys=text();
|
||||||
if (event->key()==Qt::Key_Delete && event->modifiers()==Qt::NoModifier) {
|
if (event->key()==Qt::Key_Delete && event->modifiers()==Qt::NoModifier) {
|
||||||
setText("");
|
setText("");
|
||||||
} else if (event->key()==Qt::Key_Backspace && event->modifiers()==Qt::NoModifier) {
|
} else if (event->key()==Qt::Key_Backspace && event->modifiers()==Qt::NoModifier) {
|
||||||
|
@ -66,11 +67,13 @@ void ShortcutInputEdit::keyPressEvent(QKeyEvent *event)
|
||||||
&& event->text().at(0).unicode()<127) {
|
&& event->text().at(0).unicode()<127) {
|
||||||
s = s.mid(0,s.lastIndexOf('+')+1) + event->text().at(0);
|
s = s.mid(0,s.lastIndexOf('+')+1) + event->text().at(0);
|
||||||
}
|
}
|
||||||
|
if (!lastKeys.isEmpty())
|
||||||
|
s=lastKeys+","+s;
|
||||||
setText(s);
|
setText(s);
|
||||||
if (key!=Qt::Key_Tab
|
// if (key!=Qt::Key_Tab
|
||||||
&& key!=Qt::Key_Enter
|
// && key!=Qt::Key_Enter
|
||||||
&& key!=Qt::Key_Return)
|
// && key!=Qt::Key_Return)
|
||||||
emit inputFinished(this);
|
// emit inputFinished(this);
|
||||||
}
|
}
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
@ -78,7 +81,10 @@ void ShortcutInputEdit::keyPressEvent(QKeyEvent *event)
|
||||||
bool ShortcutInputEdit::event(QEvent *event)
|
bool ShortcutInputEdit::event(QEvent *event)
|
||||||
{
|
{
|
||||||
if (event->type()==QEvent::ShortcutOverride) {
|
if (event->type()==QEvent::ShortcutOverride) {
|
||||||
keyPressEvent((QKeyEvent*)event);
|
QKeyEvent* keyEvent = static_cast<QKeyEvent *>(event);
|
||||||
|
if (keyEvent->key()==Qt::Key_Tab)
|
||||||
|
keyPressEvent((QKeyEvent*)event);
|
||||||
|
|
||||||
event->accept();
|
event->accept();
|
||||||
return true;
|
return true;
|
||||||
} else if (event->type()==QEvent::KeyPress) {
|
} else if (event->type()==QEvent::KeyPress) {
|
||||||
|
|
|
@ -33,6 +33,7 @@ protected:
|
||||||
// QObject interface
|
// QObject interface
|
||||||
public:
|
public:
|
||||||
bool event(QEvent *event) override;
|
bool event(QEvent *event) override;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SHORTCUTINPUTEDIT_H
|
#endif // SHORTCUTINPUTEDIT_H
|
||||||
|
|
|
@ -1194,6 +1194,7 @@ void QSynEdit::setCaretAndSelection(const BufferCoord &ptCaret, const BufferCoor
|
||||||
{
|
{
|
||||||
incPaintLock();
|
incPaintLock();
|
||||||
internalSetCaretXY(ptCaret);
|
internalSetCaretXY(ptCaret);
|
||||||
|
setActiveSelectionMode(SelectionMode::Normal);
|
||||||
setBlockBegin(ptSelBegin);
|
setBlockBegin(ptSelBegin);
|
||||||
setBlockEnd(ptSelEnd);
|
setBlockEnd(ptSelEnd);
|
||||||
decPaintLock();
|
decPaintLock();
|
||||||
|
@ -2730,11 +2731,11 @@ void QSynEdit::doBlockUnindent()
|
||||||
endEditing();
|
endEditing();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QSynEdit::doAddChar(QChar AChar)
|
void QSynEdit::doAddChar(const QChar& ch)
|
||||||
{
|
{
|
||||||
if (mReadOnly)
|
if (mReadOnly)
|
||||||
return;
|
return;
|
||||||
if (!AChar.isPrint() && AChar!='\t')
|
if (!ch.isPrint() && ch!='\t')
|
||||||
return;
|
return;
|
||||||
//DoOnPaintTransient(ttBefore);
|
//DoOnPaintTransient(ttBefore);
|
||||||
//mCaretX will change after setSelLength;
|
//mCaretX will change after setSelLength;
|
||||||
|
@ -2759,12 +2760,31 @@ void QSynEdit::doAddChar(QChar AChar)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isIdentChar(AChar)) {
|
QChar lastCh{0};
|
||||||
doSetSelText(AChar);
|
if (!selAvail()) {
|
||||||
} else if (AChar.isSpace()) {
|
PUndoItem undoItem = mUndoList->peekItem();
|
||||||
|
if (undoItem && undoItem->changeReason()==ChangeReason::Insert
|
||||||
|
&& undoItem->changeEndPos().line == mCaretY
|
||||||
|
&& undoItem->changeEndPos().ch == mCaretX
|
||||||
|
&& undoItem->changeStartPos().line == mCaretY
|
||||||
|
&& undoItem->changeStartPos().ch == mCaretX-1) {
|
||||||
|
QString s = mDocument->getLine(mCaretY-1);
|
||||||
|
int i=mCaretX-2;
|
||||||
|
if (i>=0 && i<s.length())
|
||||||
|
lastCh=s[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isIdentChar(ch)) {
|
||||||
|
if (!isIdentChar(lastCh)) {
|
||||||
|
mUndoList->addGroupBreak();
|
||||||
|
}
|
||||||
|
doSetSelText(ch);
|
||||||
|
} else if (ch.isSpace()) {
|
||||||
// break group undo chain
|
// break group undo chain
|
||||||
mUndoList->addGroupBreak();
|
if (!lastCh.isSpace()) {
|
||||||
doSetSelText(AChar);
|
mUndoList->addGroupBreak();
|
||||||
|
}
|
||||||
|
doSetSelText(ch);
|
||||||
// break group undo chain
|
// break group undo chain
|
||||||
// if (mActiveSelectionMode!=SynSelectionMode::smColumn)
|
// if (mActiveSelectionMode!=SynSelectionMode::smColumn)
|
||||||
// mUndoList->AddChange(SynChangeReason::crNothing,
|
// mUndoList->AddChange(SynChangeReason::crNothing,
|
||||||
|
@ -2772,8 +2792,11 @@ void QSynEdit::doAddChar(QChar AChar)
|
||||||
// BufferCoord{0, 0},
|
// BufferCoord{0, 0},
|
||||||
// "", SynSelectionMode::smNormal);
|
// "", SynSelectionMode::smNormal);
|
||||||
} else {
|
} else {
|
||||||
|
if (lastCh.isSpace() || isIdentChar(lastCh)) {
|
||||||
|
mUndoList->addGroupBreak();
|
||||||
|
}
|
||||||
beginEditing();
|
beginEditing();
|
||||||
doSetSelText(AChar);
|
doSetSelText(ch);
|
||||||
int oldCaretX=mCaretX-1;
|
int oldCaretX=mCaretX-1;
|
||||||
int oldCaretY=mCaretY;
|
int oldCaretY=mCaretY;
|
||||||
// auto
|
// auto
|
||||||
|
@ -2784,7 +2807,7 @@ void QSynEdit::doAddChar(QChar AChar)
|
||||||
&& (oldCaretY<=mDocument->count()) ) {
|
&& (oldCaretY<=mDocument->count()) ) {
|
||||||
|
|
||||||
//unindent if ':' at end of the line
|
//unindent if ':' at end of the line
|
||||||
if (AChar == ':') {
|
if (ch == ':') {
|
||||||
QString line = mDocument->getLine(oldCaretY-1);
|
QString line = mDocument->getLine(oldCaretY-1);
|
||||||
if (line.length() <= oldCaretX) {
|
if (line.length() <= oldCaretX) {
|
||||||
int indentSpaces = calcIndentSpaces(oldCaretY,line+":", true);
|
int indentSpaces = calcIndentSpaces(oldCaretY,line+":", true);
|
||||||
|
@ -2810,7 +2833,7 @@ void QSynEdit::doAddChar(QChar AChar)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (AChar == '*') {
|
} else if (ch == '*') {
|
||||||
QString line = mDocument->getLine(oldCaretY-1);
|
QString line = mDocument->getLine(oldCaretY-1);
|
||||||
if (line.length() <= oldCaretX) {
|
if (line.length() <= oldCaretX) {
|
||||||
int indentSpaces = calcIndentSpaces(oldCaretY,line+"*", true);
|
int indentSpaces = calcIndentSpaces(oldCaretY,line+"*", true);
|
||||||
|
@ -2836,12 +2859,12 @@ void QSynEdit::doAddChar(QChar AChar)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (AChar == '{' || AChar == '}' || AChar == '#') {
|
} else if (ch == '{' || ch == '}' || ch == '#') {
|
||||||
//Reindent line when add '{' '}' and '#' at the beginning
|
//Reindent line when add '{' '}' and '#' at the beginning
|
||||||
QString left = mDocument->getLine(oldCaretY-1).mid(0,oldCaretX-1);
|
QString left = mDocument->getLine(oldCaretY-1).mid(0,oldCaretX-1);
|
||||||
// and the first nonblank char is this new {
|
// and the first nonblank char is this new {
|
||||||
if (left.trimmed().isEmpty()) {
|
if (left.trimmed().isEmpty()) {
|
||||||
int indentSpaces = calcIndentSpaces(oldCaretY,AChar, true);
|
int indentSpaces = calcIndentSpaces(oldCaretY,ch, true);
|
||||||
if (indentSpaces != leftSpaces(left)) {
|
if (indentSpaces != leftSpaces(left)) {
|
||||||
QString right = mDocument->getLine(oldCaretY-1).mid(oldCaretX-1);
|
QString right = mDocument->getLine(oldCaretY-1).mid(oldCaretX-1);
|
||||||
QString newLeft = GetLeftSpacing(indentSpaces,true);
|
QString newLeft = GetLeftSpacing(indentSpaces,true);
|
||||||
|
@ -6674,7 +6697,6 @@ void QSynEdit::clearSelection()
|
||||||
|
|
||||||
void QSynEdit::setBlockEnd(BufferCoord value)
|
void QSynEdit::setBlockEnd(BufferCoord value)
|
||||||
{
|
{
|
||||||
//setActiveSelectionMode(mSelectionMode);
|
|
||||||
value.line = minMax(value.line, 1, mDocument->count());
|
value.line = minMax(value.line, 1, mDocument->count());
|
||||||
if (mActiveSelectionMode == SelectionMode::Normal) {
|
if (mActiveSelectionMode == SelectionMode::Normal) {
|
||||||
if (value.line >= 1 && value.line <= mDocument->count())
|
if (value.line >= 1 && value.line <= mDocument->count())
|
||||||
|
@ -6782,7 +6804,6 @@ void QSynEdit::setBlockBegin(BufferCoord value)
|
||||||
{
|
{
|
||||||
int nInval1, nInval2;
|
int nInval1, nInval2;
|
||||||
bool SelChanged;
|
bool SelChanged;
|
||||||
//setActiveSelectionMode(mSelectionMode);
|
|
||||||
value.line = minMax(value.line, 1, mDocument->count());
|
value.line = minMax(value.line, 1, mDocument->count());
|
||||||
if (mActiveSelectionMode == SelectionMode::Normal) {
|
if (mActiveSelectionMode == SelectionMode::Normal) {
|
||||||
if (value.line >= 1 && value.line <= mDocument->count())
|
if (value.line >= 1 && value.line <= mDocument->count())
|
||||||
|
|
|
@ -600,7 +600,7 @@ private:
|
||||||
void doShiftTabKey();
|
void doShiftTabKey();
|
||||||
void doBlockIndent();
|
void doBlockIndent();
|
||||||
void doBlockUnindent();
|
void doBlockUnindent();
|
||||||
void doAddChar(QChar AChar);
|
void doAddChar(const QChar& ch);
|
||||||
void doCutToClipboard();
|
void doCutToClipboard();
|
||||||
void doCopyToClipboard();
|
void doCopyToClipboard();
|
||||||
void internalDoCopyToClipboard(const QString& s);
|
void internalDoCopyToClipboard(const QString& s);
|
||||||
|
|
Loading…
Reference in New Issue