- fix: alt+shift+left/right can't select
- fix: Input any content will exit column mode.
This commit is contained in:
parent
d75ffef9bb
commit
7324475277
2
NEWS.md
2
NEWS.md
|
@ -20,6 +20,8 @@ Red Panda C++ Version 2.8
|
||||||
- change: Disable undo limit by default.
|
- change: Disable undo limit by default.
|
||||||
- fix: "Goto declaration" / "Goto definition" / "Find occurences" not correctly disabled for non-c/c++ files.
|
- fix: "Goto declaration" / "Goto definition" / "Find occurences" not correctly disabled for non-c/c++ files.
|
||||||
- fix: Can't save new file using filename with custom suffix.
|
- fix: Can't save new file using filename with custom suffix.
|
||||||
|
- fix: alt+shift+left/right can't select
|
||||||
|
- fix: Input any content will exit column mode.
|
||||||
|
|
||||||
Red Panda C++ Version 2.7
|
Red Panda C++ Version 2.7
|
||||||
|
|
||||||
|
|
|
@ -57,13 +57,16 @@ SaveException::SaveException(const QString& reason) {
|
||||||
mReason = reason;
|
mReason = reason;
|
||||||
mReasonBuffer = mReason.toLocal8Bit();
|
mReasonBuffer = mReason.toLocal8Bit();
|
||||||
}
|
}
|
||||||
|
|
||||||
SaveException::SaveException(const QString&& reason) {
|
SaveException::SaveException(const QString&& reason) {
|
||||||
mReason = reason;
|
mReason = reason;
|
||||||
mReasonBuffer = mReason.toLocal8Bit();
|
mReasonBuffer = mReason.toLocal8Bit();
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString& SaveException::reason() const noexcept{
|
const QString& SaveException::reason() const noexcept{
|
||||||
return mReason;
|
return mReason;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* SaveException::what() const noexcept {
|
const char* SaveException::what() const noexcept {
|
||||||
return mReasonBuffer;
|
return mReasonBuffer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,10 +191,12 @@ void EditKeyStrokes::resetDefaults()
|
||||||
add(EditCommand::ScrollDown, Qt::Key_Down, Qt::ControlModifier);
|
add(EditCommand::ScrollDown, Qt::Key_Down, Qt::ControlModifier);
|
||||||
add(EditCommand::Left, Qt::Key_Left, Qt::NoModifier);
|
add(EditCommand::Left, Qt::Key_Left, Qt::NoModifier);
|
||||||
add(EditCommand::SelLeft, Qt::Key_Left, Qt::ShiftModifier);
|
add(EditCommand::SelLeft, Qt::Key_Left, Qt::ShiftModifier);
|
||||||
|
add(EditCommand::SelLeft, Qt::Key_Left, Qt::KeyboardModifiers(Qt::ShiftModifier | Qt::AltModifier));
|
||||||
add(EditCommand::WordLeft, Qt::Key_Left, Qt::ControlModifier);
|
add(EditCommand::WordLeft, Qt::Key_Left, Qt::ControlModifier);
|
||||||
add(EditCommand::SelWordLeft, Qt::Key_Left, Qt::KeyboardModifiers(Qt::ShiftModifier|Qt::ControlModifier));
|
add(EditCommand::SelWordLeft, Qt::Key_Left, Qt::KeyboardModifiers(Qt::ShiftModifier|Qt::ControlModifier));
|
||||||
add(EditCommand::Right, Qt::Key_Right, Qt::NoModifier);
|
add(EditCommand::Right, Qt::Key_Right, Qt::NoModifier);
|
||||||
add(EditCommand::SelRight, Qt::Key_Right, Qt::ShiftModifier);
|
add(EditCommand::SelRight, Qt::Key_Right, Qt::ShiftModifier);
|
||||||
|
add(EditCommand::SelRight, Qt::Key_Right, Qt::KeyboardModifiers(Qt::ShiftModifier | Qt::AltModifier));
|
||||||
add(EditCommand::WordRight, Qt::Key_Right, Qt::ControlModifier);
|
add(EditCommand::WordRight, Qt::Key_Right, Qt::ControlModifier);
|
||||||
add(EditCommand::SelWordRight, Qt::Key_Right, Qt::KeyboardModifiers(Qt::ShiftModifier|Qt::ControlModifier));
|
add(EditCommand::SelWordRight, Qt::Key_Right, Qt::KeyboardModifiers(Qt::ShiftModifier|Qt::ControlModifier));
|
||||||
|
|
||||||
|
|
|
@ -4364,6 +4364,8 @@ void SynEdit::doUndoItem()
|
||||||
item->changeSelMode(),
|
item->changeSelMode(),
|
||||||
item->changeNumber());
|
item->changeNumber());
|
||||||
internalSetCaretXY(item->changeStartPos());
|
internalSetCaretXY(item->changeStartPos());
|
||||||
|
setBlockBegin(caretXY());
|
||||||
|
ensureCursorPosVisible();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ChangeReason::MoveSelectionUp:
|
case ChangeReason::MoveSelectionUp:
|
||||||
|
@ -4407,6 +4409,7 @@ void SynEdit::doUndoItem()
|
||||||
item->changeText(),
|
item->changeText(),
|
||||||
item->changeSelMode(),
|
item->changeSelMode(),
|
||||||
item->changeNumber());
|
item->changeNumber());
|
||||||
|
setBlockBegin(caretXY());
|
||||||
ensureCursorPosVisible();
|
ensureCursorPosVisible();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -5487,19 +5490,34 @@ void SynEdit::doInsertText(const BufferCoord& pos,
|
||||||
case SelectionMode::Normal:
|
case SelectionMode::Normal:
|
||||||
insertedLines = doInsertTextByNormalMode(pos,text, newPos);
|
insertedLines = doInsertTextByNormalMode(pos,text, newPos);
|
||||||
doLinesInserted(pos.line+1, insertedLines);
|
doLinesInserted(pos.line+1, insertedLines);
|
||||||
|
internalSetCaretXY(newPos);
|
||||||
|
setBlockBegin(newPos);
|
||||||
|
ensureCursorPosVisible();
|
||||||
break;
|
break;
|
||||||
case SelectionMode::Column:
|
case SelectionMode::Column:
|
||||||
insertedLines = doInsertTextByColumnMode(pos,text, newPos, startLine,endLine);
|
insertedLines = doInsertTextByColumnMode(pos,text, startLine,endLine);
|
||||||
doLinesInserted(endLine-insertedLines+1,insertedLines);
|
doLinesInserted(endLine-insertedLines+1,insertedLines);
|
||||||
|
if (!text.isEmpty()) {
|
||||||
|
int textLen = text.back().length();
|
||||||
|
BufferCoord bb=blockBegin();
|
||||||
|
BufferCoord be=blockEnd();
|
||||||
|
bb.ch+=textLen;
|
||||||
|
be.ch+=textLen;
|
||||||
|
internalSetCaretXY(bb);
|
||||||
|
setBlockBegin(bb);
|
||||||
|
setBlockEnd(be);
|
||||||
|
ensureCursorPosVisible();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case SelectionMode::Line:
|
case SelectionMode::Line:
|
||||||
insertedLines = doInsertTextByLineMode(pos,text, newPos);
|
insertedLines = doInsertTextByLineMode(pos,text, newPos);
|
||||||
doLinesInserted(pos.line, insertedLines);
|
doLinesInserted(pos.line, insertedLines);
|
||||||
break;
|
|
||||||
}
|
|
||||||
internalSetCaretXY(newPos);
|
internalSetCaretXY(newPos);
|
||||||
setBlockBegin(newPos);
|
setBlockBegin(newPos);
|
||||||
ensureCursorPosVisible();
|
ensureCursorPosVisible();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynEdit::doInsertTextByNormalMode(const BufferCoord& pos, const QStringList& text, BufferCoord &newPos)
|
int SynEdit::doInsertTextByNormalMode(const BufferCoord& pos, const QStringList& text, BufferCoord &newPos)
|
||||||
|
@ -5594,7 +5612,7 @@ int SynEdit::doInsertTextByNormalMode(const BufferCoord& pos, const QStringList&
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynEdit::doInsertTextByColumnMode(const BufferCoord& pos, const QStringList& text, BufferCoord &newPos, int startLine, int endLine)
|
int SynEdit::doInsertTextByColumnMode(const BufferCoord& pos, const QStringList& text, int startLine, int endLine)
|
||||||
{
|
{
|
||||||
QString str;
|
QString str;
|
||||||
QString tempString;
|
QString tempString;
|
||||||
|
@ -5651,12 +5669,6 @@ int SynEdit::doInsertTextByColumnMode(const BufferCoord& pos, const QStringList&
|
||||||
}
|
}
|
||||||
line++;
|
line++;
|
||||||
}
|
}
|
||||||
newPos=pos;
|
|
||||||
if (!text[0].isEmpty()) {
|
|
||||||
newPos.ch+=text[0].length();
|
|
||||||
// mCaretX+=firstLineLen;
|
|
||||||
// mStatusChanges.setFlag(SynStatusChange::scCaretX);
|
|
||||||
}
|
|
||||||
if (!mUndoing) {
|
if (!mUndoing) {
|
||||||
mUndoList->endBlock();
|
mUndoList->endBlock();
|
||||||
}
|
}
|
||||||
|
@ -6761,30 +6773,30 @@ BufferCoord SynEdit::blockEnd() const
|
||||||
return mBlockEnd;
|
return mBlockEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEdit::setBlockEnd(BufferCoord Value)
|
void SynEdit::setBlockEnd(BufferCoord value)
|
||||||
{
|
{
|
||||||
//setActiveSelectionMode(mSelectionMode);
|
//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())
|
||||||
Value.ch = std::min(Value.ch, getDisplayStringAtLine(Value.line).length() + 1);
|
value.ch = std::min(value.ch, getDisplayStringAtLine(value.line).length() + 1);
|
||||||
else
|
else
|
||||||
Value.ch = 1;
|
value.ch = 1;
|
||||||
} else {
|
} else {
|
||||||
int maxLen = mDocument->lengthOfLongestLine();
|
int maxLen = mDocument->lengthOfLongestLine();
|
||||||
if (syntaxer())
|
if (syntaxer())
|
||||||
maxLen = maxLen+stringColumns(syntaxer()->foldString(),maxLen);
|
maxLen = maxLen+stringColumns(syntaxer()->foldString(),maxLen);
|
||||||
Value.ch = minMax(Value.ch, 1, maxLen+1);
|
value.ch = minMax(value.ch, 1, maxLen+1);
|
||||||
}
|
}
|
||||||
if (Value.ch != mBlockEnd.ch || Value.line != mBlockEnd.line) {
|
if (value.ch != mBlockEnd.ch || value.line != mBlockEnd.line) {
|
||||||
if (mActiveSelectionMode == SelectionMode::Column && Value.ch != mBlockEnd.ch) {
|
if (mActiveSelectionMode == SelectionMode::Column && value.ch != mBlockEnd.ch) {
|
||||||
invalidateLines(
|
invalidateLines(
|
||||||
std::min(mBlockBegin.line, std::min(mBlockEnd.line, Value.line)),
|
std::min(mBlockBegin.line, std::min(mBlockEnd.line, value.line)),
|
||||||
std::max(mBlockBegin.line, std::max(mBlockEnd.line, Value.line)));
|
std::max(mBlockBegin.line, std::max(mBlockEnd.line, value.line)));
|
||||||
mBlockEnd = Value;
|
mBlockEnd = value;
|
||||||
} else {
|
} else {
|
||||||
int nLine = mBlockEnd.line;
|
int nLine = mBlockEnd.line;
|
||||||
mBlockEnd = Value;
|
mBlockEnd = value;
|
||||||
if (mActiveSelectionMode != SelectionMode::Column || mBlockBegin.ch != mBlockEnd.ch)
|
if (mActiveSelectionMode != SelectionMode::Column || mBlockBegin.ch != mBlockEnd.ch)
|
||||||
invalidateLines(nLine, mBlockEnd.line);
|
invalidateLines(nLine, mBlockEnd.line);
|
||||||
}
|
}
|
||||||
|
|
|
@ -550,7 +550,7 @@ private:
|
||||||
void doDeleteText(BufferCoord startPos, BufferCoord endPos, SelectionMode mode);
|
void doDeleteText(BufferCoord startPos, BufferCoord endPos, SelectionMode mode);
|
||||||
void doInsertText(const BufferCoord& pos, const QStringList& text, SelectionMode mode, int startLine, int endLine);
|
void doInsertText(const BufferCoord& pos, const QStringList& text, SelectionMode mode, int startLine, int endLine);
|
||||||
int doInsertTextByNormalMode(const BufferCoord& pos, const QStringList& text, BufferCoord &newPos);
|
int doInsertTextByNormalMode(const BufferCoord& pos, const QStringList& text, BufferCoord &newPos);
|
||||||
int doInsertTextByColumnMode(const BufferCoord& pos, const QStringList& text, BufferCoord &newPos, int startLine, int endLine);
|
int doInsertTextByColumnMode(const BufferCoord& pos, const QStringList& text, int startLine, int endLine);
|
||||||
int doInsertTextByLineMode(const BufferCoord& pos, const QStringList& text, BufferCoord &newPos);
|
int doInsertTextByLineMode(const BufferCoord& pos, const QStringList& text, BufferCoord &newPos);
|
||||||
|
|
||||||
void doTrimTrailingSpaces();
|
void doTrimTrailingSpaces();
|
||||||
|
|
Loading…
Reference in New Issue