- enhancement: disable column mode in readonly editors

This commit is contained in:
Roy Qu 2022-07-28 21:19:54 +08:00
parent a3cb17299b
commit 1ce0ec3d32
2 changed files with 7 additions and 8 deletions

View File

@ -6,6 +6,7 @@ Red Panda C++ Version 1.1.6
- enhancement: don't show cpp defines when editing c files - enhancement: don't show cpp defines when editing c files
- enhancement: choose default language when first run - enhancement: choose default language when first run
- fix: Drag&Drop no correctly disabled for readonly editors - fix: Drag&Drop no correctly disabled for readonly editors
- enhancement: disable column mode in readonly editors
Red Panda C++ Version 1.1.5 Red Panda C++ Version 1.1.5

View File

@ -4958,7 +4958,7 @@ void SynEdit::moveCaretHorz(int DX, bool isSelection)
incPaintLock(); incPaintLock();
if (mOptions.testFlag(eoAltSetsColumnMode) && if (mOptions.testFlag(eoAltSetsColumnMode) &&
(mActiveSelectionMode != SynSelectionMode::Line)) { (mActiveSelectionMode != SynSelectionMode::Line)) {
if (qApp->keyboardModifiers().testFlag(Qt::AltModifier)) { if (qApp->keyboardModifiers().testFlag(Qt::AltModifier) && !mReadOnly) {
setActiveSelectionMode(SynSelectionMode::Column); setActiveSelectionMode(SynSelectionMode::Column);
} else } else
setActiveSelectionMode(selectionMode()); setActiveSelectionMode(selectionMode());
@ -5001,7 +5001,7 @@ void SynEdit::moveCaretVert(int DY, bool isSelection)
incPaintLock(); incPaintLock();
if (mOptions.testFlag(eoAltSetsColumnMode) && if (mOptions.testFlag(eoAltSetsColumnMode) &&
(mActiveSelectionMode != SynSelectionMode::Line)) { (mActiveSelectionMode != SynSelectionMode::Line)) {
if (qApp->keyboardModifiers().testFlag(Qt::AltModifier)) if (qApp->keyboardModifiers().testFlag(Qt::AltModifier) && !mReadOnly)
setActiveSelectionMode(SynSelectionMode::Column); setActiveSelectionMode(SynSelectionMode::Column);
else else
setActiveSelectionMode(selectionMode()); setActiveSelectionMode(selectionMode());
@ -6285,9 +6285,8 @@ void SynEdit::mousePressEvent(QMouseEvent *event)
//code from above and SetBlockEnd will take care of proper invalidation //code from above and SetBlockEnd will take care of proper invalidation
setBlockEnd(caretXY()); setBlockEnd(caretXY());
} else if (mOptions.testFlag(eoAltSetsColumnMode) && } else if (mOptions.testFlag(eoAltSetsColumnMode) &&
(mActiveSelectionMode != SynSelectionMode::Line) (mActiveSelectionMode != SynSelectionMode::Line)) {
&& !mReadOnly) { if (event->modifiers() == Qt::AltModifier && !mReadOnly)
if (event->modifiers() == Qt::AltModifier)
setActiveSelectionMode(SynSelectionMode::Column); setActiveSelectionMode(SynSelectionMode::Column);
else else
setActiveSelectionMode(selectionMode()); setActiveSelectionMode(selectionMode());
@ -6348,9 +6347,8 @@ void SynEdit::mouseMoveEvent(QMouseEvent *event)
} }
} else if (buttons == Qt::LeftButton) { } else if (buttons == Qt::LeftButton) {
if (mOptions.testFlag(eoAltSetsColumnMode) && if (mOptions.testFlag(eoAltSetsColumnMode) &&
(mActiveSelectionMode != SynSelectionMode::Line) (mActiveSelectionMode != SynSelectionMode::Line) ) {
&& !mReadOnly) { if (event->modifiers() == Qt::AltModifier && !mReadOnly)
if (event->modifiers() == Qt::AltModifier)
setActiveSelectionMode(SynSelectionMode::Column); setActiveSelectionMode(SynSelectionMode::Column);
else else
setActiveSelectionMode(selectionMode()); setActiveSelectionMode(selectionMode());