- 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: choose default language when first run
- fix: Drag&Drop no correctly disabled for readonly editors
- enhancement: disable column mode in readonly editors
Red Panda C++ Version 1.1.5

View File

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