+ fix: "thin selection" restore

This commit is contained in:
Rainer Kottenhoff 2019-05-28 00:49:07 +02:00
parent 71a35e053a
commit 68a74f7db9
3 changed files with 24 additions and 15 deletions

View File

@ -4024,15 +4024,19 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
break;
case CMD_BACKTAB:
{
_BEGIN_UNDO_ACTION_
{
_BEGIN_UNDO_ACTION_
EditIndentBlock(Globals.hwndEdit, SCI_BACKTAB, false, false);
_END_UNDO_ACTION_
}
break;
_END_UNDO_ACTION_
}
break;
case CMD_CTRLTAB:
{
{
if (Sci_IsMultiLineSelection()) {
SciCall_SetSelectionMode(SC_SEL_STREAM);
}
else {
_BEGIN_UNDO_ACTION_
SciCall_SetUseTabs(true);
SciCall_SetTabIndents(false);
@ -4041,7 +4045,8 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
SciCall_SetUseTabs(!Globals.fvCurFile.bTabsAsSpaces);
_END_UNDO_ACTION_
}
break;
}
break;
case CMD_CHECK_INDENTATION:
{
@ -6675,8 +6680,9 @@ inline static LRESULT _MsgNotifyLean(const LPNMHDR pnmh, const SCNotification* c
int const iModType = scn->modificationType;
if ((iModType & SC_MOD_BEFOREINSERT) || ((iModType & SC_MOD_BEFOREDELETE))) {
if (!((iModType & SC_PERFORMED_UNDO) || (iModType & SC_PERFORMED_REDO))) {
if (!SciCall_IsSelectionEmpty() && !_InUndoRedoTransaction())
if (!_InUndoRedoTransaction()) {
_SaveRedoSelection(_SaveUndoSelection());
}
}
bModified = false; // not yet
}
@ -6730,8 +6736,9 @@ static LRESULT _MsgNotifyFromEdit(HWND hwnd, const LPNMHDR pnmh, const SCNotific
bool bModified = true;
if ((iModType & SC_MOD_BEFOREINSERT) || ((iModType & SC_MOD_BEFOREDELETE))) {
if (!((iModType & SC_PERFORMED_UNDO) || (iModType & SC_PERFORMED_REDO))) {
if (!SciCall_IsSelectionEmpty() && !_InUndoRedoTransaction())
if (!_InUndoRedoTransaction()) {
_SaveRedoSelection(_SaveUndoSelection());
}
}
bModified = false; // not yet
}

View File

@ -153,7 +153,6 @@ DeclareSciCallV0(LinesSplit, LINESSPLIT)
DeclareSciCallV1(SetEmptySelection, SETEMPTYSELECTION, DocPos, position)
DeclareSciCallR0(GetCurrentPos, GETCURRENTPOS, DocPos)
DeclareSciCallR0(GetAnchor, GETANCHOR, DocPos)
DeclareSciCallR0(GetSelectionMode, GETSELECTIONMODE, int)
DeclareSciCallR0(GetSelectionStart, GETSELECTIONSTART, DocPos)
DeclareSciCallR0(GetSelectionEnd, GETSELECTIONEND, DocPos)
DeclareSciCallR1(GetLineSelStartPosition, GETLINESELSTARTPOSITION, DocPos, DocLn, line)
@ -180,7 +179,8 @@ DeclareSciCallV1(SetVirtualSpaceOptions, SETVIRTUALSPACEOPTIONS, int, options)
// Multiselections (Lines of Rectangular selection)
DeclareSciCallV0(ClearSelections, CLEARSELECTIONS)
DeclareSciCallV0(SwapMainAnchorCaret, SWAPMAINANCHORCARET)
DeclareSciCallR0(GetSelectionMode, GETSELECTIONMODE, int)
DeclareSciCallV1(SetSelectionMode, SETSELECTIONMODE, int, mode)
DeclareSciCallR0(GetSelections, GETSELECTIONS, DocPosU)
DeclareSciCallR0(GetMainSelection, GETMAINSELECTION, DocPosU)
DeclareSciCallV1(SetMainSelection, SETMAINSELECTION, DocPosU, zoom)
@ -194,6 +194,8 @@ DeclareSciCallV2(SetSelectionNCaretVirtualSpace, SETSELECTIONNCARETVIRTUALSPACE,
DeclareSciCallV2(SetSelectionNAnchorVirtualSpace, SETSELECTIONNANCHORVIRTUALSPACE, DocPosU, selnum, DocPos, position)
DeclareSciCallR1(GetSelectionNStart, GETSELECTIONNSTART, DocPos, DocPosU, selnum)
DeclareSciCallR1(GetSelectionNEnd, GETSELECTIONNEND, DocPos, DocPosU, selnum)
DeclareSciCallV0(SwapMainAnchorCaret, SWAPMAINANCHORCARET)
// Zoom
@ -520,8 +522,8 @@ DeclareSciCallR0(IsIMEModeCJK, ISIMEMODECJK, bool)
//
DeclareSciCallR0(IsSelectionEmpty, GETSELECTIONEMPTY, bool)
DeclareSciCallR0(IsSelectionRectangle, SELECTIONISRECTANGLE, bool)
#define Sci_IsMultiSelection() (SciCall_GetSelections() > 1)
#define Sci_IsMultiOrRectangleSelection() (SciCall_IsSelectionRectangle() || Sci_IsMultiSelection())
#define Sci_IsMultiSelection() ((SciCall_GetSelections() > 1) && !SciCall_IsSelectionRectangle())
#define Sci_IsMultiOrRectangleSelection() ((SciCall_GetSelections() > 1) || SciCall_IsSelectionRectangle())
#define Sci_IsSingleLineSelection() (SciCall_LineFromPosition(SciCall_GetSelectionEnd()) == SciCall_LineFromPosition(SciCall_GetSelectionStart()))
#define Sci_IsMultiLineSelection() ((SciCall_LineFromPosition(SciCall_GetSelectionEnd()) - SciCall_LineFromPosition(SciCall_GetSelectionStart())) > 1)

View File

@ -1125,11 +1125,11 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew)
if (Style_StrGetAlpha(pCurrentStandard->Styles[STY_SEL_TXT].szValue, &iValue, true)) { // selection alpha
SendMessage(hwnd, SCI_SETSELALPHA, iValue, 0);
SendMessage(hwnd, SCI_SETADDITIONALSELALPHA, iValue, 0);
SendMessage(hwnd, SCI_SETADDITIONALSELALPHA, iValue*2/3, 0);
}
else {
SendMessage(hwnd, SCI_SETSELALPHA, SC_ALPHA_NOALPHA, 0);
SendMessage(hwnd, SCI_SETADDITIONALSELALPHA, SC_ALPHA_NOALPHA, 0);
SendMessage(hwnd, SCI_SETADDITIONALSELALPHA, SC_ALPHA_NOALPHA*2/3, 0);
}
if (_IsItemInStyleString(pCurrentStandard->Styles[STY_SEL_TXT].szValue, L"eolfilled")) // selection eolfilled