Merge branch 'Experimental_ThinSel' into Bugfixes_RC2_II

This commit is contained in:
Rainer Kottenhoff 2018-05-04 23:20:56 +02:00
commit ae03e94e69
4 changed files with 162 additions and 278 deletions

View File

@ -570,8 +570,8 @@ bool EditIsRecodingNeeded(WCHAR* pszText, int cchLen)
//
// EditGetClipboardText()
//
char* EditGetClipboardText(HWND hwnd,bool bCheckEncoding,int* pLineCount,int* pLenLastLn) {
char* EditGetClipboardText(HWND hwnd, bool bCheckEncoding, int* pLineCount, int* pLenLastLn)
{
if (!IsClipboardFormatAvailable(CF_UNICODETEXT) || !OpenClipboard(GetParent(hwnd))) {
char* pEmpty = StrDupA("");
return (pEmpty);
@ -613,7 +613,9 @@ char* EditGetClipboardText(HWND hwnd,bool bCheckEncoding,int* pLineCount,int* pL
int lineCount = 0;
int lenLastLine = 0;
if ((bool)SendMessage(hwnd,SCI_GETPASTECONVERTENDINGS,0,0)) {
if ((bool)SendMessage(hwnd,SCI_GETPASTECONVERTENDINGS,0,0))
{
char* ptmp = LocalAlloc(LPTR,mlen * 2 + 2);
if (ptmp) {
char *s = pmch;
@ -731,177 +733,47 @@ bool EditClearClipboard(HWND hwnd)
//=============================================================================
//
// EditPaste2RectSel()
// EditSwapClipboard()
//
void EditPaste2RectSel(HWND hwnd, char* pText)
{
if (!SciCall_IsSelectionRectangle()) { return; }
const DocPos length = lstrlenA(pText); // '\0' terminated
_IGNORE_NOTIFY_CHANGE_;
_ENTER_TARGET_TRANSACTION_;
const DocPosU selCount = (DocPosU)SendMessage(hwnd, SCI_GETSELECTIONS, 0, 0);
char* pTextLine = pText;
// remove line-break from last line
if (*pTextLine != '\0') { StrTrimA(pTextLine, "\r\n"); }
for (DocPosU s = 0; s < selCount; ++s) {
// get lines from clip
char *ln = pTextLine;
int lnLen = 0;
while (*ln != '\0') {
if (s < (selCount - 1)) {
if (*ln == '\n' || *ln == '\r') {
if ((*ln == '\r') && (*(ln + 1) == '\n')) { ++ln; }
++ln; // next line
break;
}
else { ++ln; ++lnLen; }
}
else { ++ln; ++lnLen; } // last line
}
const DocPos selCaretPos = SciCall_GetSelectionNCaret(s);
const DocPos selAnchorPos = SciCall_GetSelectionNAnchor(s);
const DocPos selCaretVspc = SciCall_GetSelectionNCaretVirtualSpace(s);
const DocPos selAnchorVspc = SciCall_GetSelectionNAnchorVirtualSpace(s);
DocPos virtualSpaceLen = 0;
DocPos selTargetStart = 0;
DocPos selTargetEnd = 0;
if (selCaretPos < selAnchorPos) {
selTargetStart = selCaretPos;
selTargetEnd = selAnchorPos;
virtualSpaceLen = selCaretVspc;
}
else {
selTargetStart = selAnchorPos;
selTargetEnd = selCaretPos;
virtualSpaceLen = selAnchorVspc;
}
if (virtualSpaceLen > 0) {
char* pPadStr = LocalAlloc(LPTR, (virtualSpaceLen + length + 1) * sizeof(char));
if (pPadStr) {
SIZE_T size = LocalSize(pPadStr) - sizeof(char);
FillMemory(pPadStr, virtualSpaceLen, ' ');
pPadStr[virtualSpaceLen] = '\0';
StringCchCatNA(pPadStr, size, pTextLine, lnLen);
SciCall_SetTargetRange(selTargetStart, selTargetEnd);
SciCall_ReplaceTarget(lstrlenA(pPadStr), pPadStr);
LocalFree(pPadStr);
}
else {
SciCall_SetTargetRange(selTargetStart, selTargetEnd);
SciCall_ReplaceTarget(lnLen, pTextLine);
}
}
else // no virtual space to pad
{
SciCall_SetTargetRange(selTargetStart, selTargetEnd);
SciCall_ReplaceTarget(lnLen, pTextLine);
}
//SciCall_SetSelectionNAnchor(s, selTargetStart);
//SciCall_SetSelectionNCaret(s, selTargetStart);
//if (virtualSpaceLen > 0) {
// SciCall_SetSelectionNCaretVirtualSpace(s, virtualSpaceLen);
// SciCall_SetSelectionNAnchorVirtualSpace(s, virtualSpaceLen);
//}
if (*ln != '\0') {
pTextLine = ln; // next clip line
}
//else: rest of rect single selections are filled with last line
} // for()
_LEAVE_TARGET_TRANSACTION_;
_OBSERVE_NOTIFY_CHANGE_;
}
//=============================================================================
//
// EditPasteClipboard()
//
bool EditPasteClipboard(HWND hwnd, bool bSwapClipBoard, bool bSkipUnicodeCheck)
bool EditSwapClipboard(HWND hwnd, bool bSkipUnicodeCheck)
{
int lineCount = 0;
int lenLastLine = 0;
char* pClip = EditGetClipboardText(hwnd, !bSkipUnicodeCheck, &lineCount, &lenLastLine);
char* const pClip = EditGetClipboardText(hwnd, !bSkipUnicodeCheck, &lineCount, &lenLastLine);
if (!pClip) {
return false; // recoding canceled
}
const DocPos clipLen = lstrlenA(pClip);
DocPos const clipLen = lstrlenA(pClip);
const DocPos iCurPos = SciCall_GetCurrentPos();
const DocPos iAnchorPos = SciCall_GetAnchor();
DocPos const iCurPos = SciCall_GetCurrentPos();
DocPos const iAnchorPos = SciCall_GetAnchor();
bool const bIsRectSel = SciCall_IsSelectionRectangle();
if (SciCall_IsSelectionEmpty() || (lineCount <= 1))
{
_IGNORE_NOTIFY_CHANGE_;
if (SciCall_IsSelectionEmpty()) // SC_SEL_THIN
{
SciCall_Paste();
if (bSwapClipBoard) {
EditClearClipboard(hwnd);
EditSelectEx(hwnd, iAnchorPos, SciCall_GetCurrentPos(), -1, -1);
}
//else {
// EditSelectEx(hwnd, SciCall_GetCurrentPos(), SciCall_GetCurrentPos(), -1, -1);
//}
}
else {
char* pszText = LocalAlloc(LPTR, SciCall_GetSelText(NULL));
SciCall_GetSelText(pszText);
if (clipLen == 0) { SciCall_Clear(); } else { SciCall_Paste(); }
if (bSwapClipBoard) {
EditSetClipboardText(hwnd, pszText);
if (iCurPos < iAnchorPos)
EditSelectEx(hwnd, SciCall_GetCurrentPos(), iCurPos, -1, -1);
else
EditSelectEx(hwnd, iAnchorPos, SciCall_GetCurrentPos(), -1, -1);
}
else {
if (iCurPos < iAnchorPos)
EditSelectEx(hwnd, iCurPos, iCurPos, -1, -1);
}
LocalFree(pszText);
}
_OBSERVE_NOTIFY_CHANGE_;
char* pszText = NULL;
SIZE_T const size = SciCall_GetSelText(NULL);
if (size > 0) {
pszText = LocalAlloc(LPTR, size);
SciCall_GetSelText(pszText);
SciCall_Paste(); //~SciCall_ReplaceSel(pClip);
EditSetClipboardText(hwnd, pszText);
}
else {
if (SciCall_IsSelectionRectangle())
{
if (bSwapClipBoard) { SciCall_Copy(); }
EditPaste2RectSel(hwnd, pClip);
//TODO: restore selection in case of swap clipboard
}
else // Selection: SC_SEL_STREAM, SC_SEL_LINES
{
_IGNORE_NOTIFY_CHANGE_;
if (bSwapClipBoard) {
SciCall_Copy();
SciCall_ReplaceSel(pClip);
if (iCurPos < iAnchorPos)
EditSelectEx(hwnd, iCurPos + clipLen, iCurPos, -1, -1);
else
EditSelectEx(hwnd, iAnchorPos, iAnchorPos + clipLen, -1, -1);
}
else {
SciCall_ReplaceSel(pClip);
if (iCurPos < iAnchorPos)
EditSelectEx(hwnd, iCurPos, iCurPos, -1, -1);
}
_OBSERVE_NOTIFY_CHANGE_;
}
SciCall_Paste(); //~SciCall_ReplaceSel(pClip);
SciCall_Clear();
}
if (pszText) { LocalFree(pszText); }
if (!bIsRectSel) {
//TODO: check for Rectangular Clipboard and skip selection restore
if (iCurPos < iAnchorPos)
EditSelectEx(hwnd, iCurPos + clipLen, iCurPos, -1, -1);
else
EditSelectEx(hwnd, iAnchorPos, iAnchorPos + clipLen, -1, -1);
}
else {
//TODO: restore selection in case of swap clipboard
}
LocalFree(pClip);
return true;
}
@ -2697,23 +2569,8 @@ void EditIndentBlock(HWND hwnd, int cmd, bool bFormatIndentation)
if (SciCall_IsSelectionRectangle())
{
//if (cmd == SCI_TAB) {
// if (g_bTabsAsSpaces) {
// int size = (bFormatIndentation ? g_iIndentWidth : g_iTabWidth);
// char* pPadStr = LocalAlloc(LPTR, size + 1);
// FillMemory(pPadStr, size, ' ');
// EditPaste2RectSel(hwnd, pPadStr);
// LocalFree(pPadStr);
// }
// else {
// EditPaste2RectSel(hwnd, "\t");
// }
// return;
//}
// better idea: EditPaste2RectSel(hwnd, pPadStr, pText); pText==NULL => copy single sel
//TODO: workaround for rectangular selection: make stream selection
EditSelectEx(hwnd, SciCall_GetAnchor(), SciCall_GetCurrentPos(), -1, -1);
SendMessage(hwnd, cmd, 0, 0);
return;
}
const DocPos iCurPos = SciCall_GetCurrentPos();
@ -3242,7 +3099,7 @@ void EditPadWithSpaces(HWND hwnd, bool bSkipEmpty, bool bNoUndoGroup)
{
if (SciCall_IsSelectionEmpty() || Sci_IsThinRectangleSelected()) { return; }
const int token = (!bNoUndoGroup ? BeginUndoAction() : -1);
int const token = (!bNoUndoGroup ? BeginUndoAction() : -1);
if (SciCall_IsSelectionRectangle())
{
@ -5613,7 +5470,7 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
case IDC_REPLACE:
{
bReplaceInitialized = true;
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditReplace(sg_pefrData->hwnd, sg_pefrData);
EndUndoAction(token);
}
@ -6238,7 +6095,7 @@ bool EditReplaceAll(HWND hwnd, LPCEDITFINDREPLACE lpefr, bool bShowInfo)
BeginWaitCursor(NULL);
int token = BeginUndoAction();
int const token = BeginUndoAction();
iReplacedOccurrences = EditReplaceAllInRange(hwnd, lpefr, start, end, &enlargement);
@ -6274,7 +6131,7 @@ bool EditReplaceAllInSelection(HWND hwnd, LPCEDITFINDREPLACE lpefr, bool bShowIn
const DocPos anchorPos = SciCall_GetAnchor();
DocPos enlargement = 0;
int token = BeginUndoAction();
int const token = BeginUndoAction();
bool const bWaitCursor = ((end - start) > (512 * 512)) ? true : false;
if (bWaitCursor) { BeginWaitCursor(NULL); }

View File

@ -30,8 +30,7 @@ bool EditIsRecodingNeeded(WCHAR*,int);
char* EditGetClipboardText(HWND,bool,int*,int*);
bool EditSetClipboardText(HWND, const char*);
bool EditClearClipboard(HWND);
void EditPaste2RectSel(HWND,char*);
bool EditPasteClipboard(HWND,bool,bool);
bool EditSwapClipboard(HWND,bool);
bool EditCopyAppend(HWND,bool);
int EditDetectEOLMode(HWND,char*,DWORD);
bool EditLoadFile(HWND,LPCWSTR,bool,bool,int*,int*,bool*,bool*,bool*);

View File

@ -1063,7 +1063,7 @@ HWND InitInstance(HINSTANCE hInstance,LPSTR pszCmdLine,int nCmdShow)
bool bAutoIndent2 = bAutoIndent;
bAutoIndent = 0;
EditJumpTo(g_hwndEdit, -1, 0);
int token = BeginUndoAction();
int const token = BeginUndoAction();
if (SendMessage(g_hwndEdit, SCI_GETLENGTH, 0, 0) > 0) {
SendMessage(g_hwndEdit, SCI_NEWLINE, 0, 0);
}
@ -1239,6 +1239,12 @@ LRESULT CALLBACK MainWndProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam)
}
return DefWindowProc(hwnd, umsg, wParam, lParam);
case WM_KILLFOCUS:
if (bAltKeyIsDown) {
bAltKeyIsDown = false;
SciCall_SetVirtualSpaceOptions(bDenyVirtualSpaceAccess ? SCVS_NONE : SCVS_RECTANGULARSELECTION);
}
return DefWindowProc(hwnd, umsg, wParam, lParam);
case WM_CREATE:
return MsgCreate(hwnd,wParam,lParam);
@ -1417,17 +1423,21 @@ static void __fastcall _InitializeSciEditCtrl(HWND hwndEditCtrl)
Encoding_Current(g_iDefaultNewFileEncoding);
// general setup
//int const evtMask = SC_MODEVENTMASKALL;
int const evtMask1 = SC_MOD_CONTAINER | SC_PERFORMED_USER | SC_PERFORMED_UNDO | SC_PERFORMED_REDO;
int const evtMask2 = SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT | SC_MOD_BEFOREINSERT | SC_MOD_BEFOREDELETE | SC_STARTACTION;
SendMessage(hwndEditCtrl, SCI_SETMODEVENTMASK, (WPARAM)(evtMask1 | evtMask2), 0);
SendMessage(hwndEditCtrl, SCI_SETCODEPAGE, (WPARAM)SC_CP_UTF8, 0); // fixed internal UTF-8
SendMessage(hwndEditCtrl, SCI_SETEOLMODE, SC_EOL_CRLF, 0);
SendMessage(hwndEditCtrl, SCI_SETPASTECONVERTENDINGS, true, 0);
SendMessage(hwndEditCtrl, SCI_SETMODEVENTMASK,/*SC_MODEVENTMASKALL*/SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT | SC_MOD_CONTAINER, 0);
SendMessage(hwndEditCtrl, SCI_USEPOPUP, false, 0);
SendMessage(hwndEditCtrl, SCI_SETSCROLLWIDTH, 1, 0);
SendMessage(hwndEditCtrl, SCI_SETSCROLLWIDTHTRACKING, true, 0);
SendMessage(hwndEditCtrl, SCI_SETENDATLASTLINE, true, 0);
SendMessage(hwndEditCtrl, SCI_SETMOUSESELECTIONRECTANGULARSWITCH, true, 0);
SendMessage(hwndEditCtrl, SCI_SETMULTIPLESELECTION, false, 0);
SendMessage(hwndEditCtrl, SCI_SETADDITIONALSELECTIONTYPING, false, 0);
SendMessage(hwndEditCtrl, SCI_SETADDITIONALSELECTIONTYPING, true, 0);
SendMessage(hwndEditCtrl, SCI_SETADDITIONALCARETSBLINK, true, 0);
SendMessage(hwndEditCtrl, SCI_SETADDITIONALCARETSVISIBLE, true, 0);
SendMessage(hwndEditCtrl, SCI_SETVIRTUALSPACEOPTIONS, SCVS_NONE, 0);
@ -2767,6 +2777,8 @@ LRESULT MsgSysCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
//
LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
{
UNUSED(lParam);
switch(LOWORD(wParam))
{
case SCEN_CHANGE:
@ -3139,7 +3151,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
if (g_flagPasteBoard)
bLastCopyFromMe = true;
int token = BeginUndoAction();
int const token = BeginUndoAction();
if (!SciCall_IsSelectionEmpty())
{
SciCall_Cut();
@ -3186,13 +3198,14 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
{
if (g_flagPasteBoard)
bLastCopyFromMe = true;
int token = BeginUndoAction();
EditPasteClipboard(g_hwndEdit, false, bSkipUnicodeDetection);
int const token = BeginUndoAction();
_IGNORE_NOTIFY_CHANGE_;
SciCall_Paste();
_OBSERVE_NOTIFY_CHANGE_;
EndUndoAction(token);
// Updates done by EditPasteClipboard():
//~UpdateToolbar();
//~UpdateStatusbar(false);
//~UpdateLineNumberWidth();
UpdateToolbar();
UpdateStatusbar(false);
UpdateLineNumberWidth();
}
break;
@ -3200,11 +3213,14 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
{
if (g_flagPasteBoard)
bLastCopyFromMe = true;
int token = BeginUndoAction();
EditPasteClipboard(g_hwndEdit, true, bSkipUnicodeDetection);
int const token = BeginUndoAction();
_IGNORE_NOTIFY_CHANGE_;
EditSwapClipboard(g_hwndEdit, bSkipUnicodeDetection);
_OBSERVE_NOTIFY_CHANGE_;
EndUndoAction(token);
UpdateToolbar();
UpdateStatusbar(false);
UpdateLineNumberWidth();
}
break;
@ -3216,6 +3232,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_SELECTALL:
SendMessage(g_hwndEdit,SCI_SELECTALL,0,0);
UpdateToolbar();
UpdateStatusbar(false);
break;
@ -3274,7 +3291,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_MOVELINEUP:
{
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditMoveUp(g_hwndEdit);
EndUndoAction(token);
}
@ -3283,7 +3300,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_MOVELINEDOWN:
{
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditMoveDown(g_hwndEdit);
EndUndoAction(token);
}
@ -3299,7 +3316,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
{
if (g_flagPasteBoard)
bLastCopyFromMe = true;
int token = BeginUndoAction();
int const token = BeginUndoAction();
SendMessage(g_hwndEdit,SCI_LINECUT,0,0);
UpdateToolbar();
EndUndoAction(token);
@ -3309,7 +3326,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_DELETELINE:
{
int token = BeginUndoAction();
int const token = BeginUndoAction();
SendMessage(g_hwndEdit, SCI_LINEDELETE, 0, 0);
EndUndoAction(token);
}
@ -3318,7 +3335,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_DELETELINELEFT:
{
int token = BeginUndoAction();
int const token = BeginUndoAction();
SendMessage(g_hwndEdit, SCI_DELLINELEFT, 0, 0);
EndUndoAction(token);
}
@ -3327,7 +3344,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_DELETELINERIGHT:
{
int token = BeginUndoAction();
int const token = BeginUndoAction();
SendMessage(g_hwndEdit, SCI_DELLINERIGHT, 0, 0);
EndUndoAction(token);
}
@ -3336,7 +3353,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_INDENT:
{
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditIndentBlock(g_hwndEdit, SCI_TAB, true);
EndUndoAction(token);
}
@ -3344,7 +3361,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_UNINDENT:
{
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditIndentBlock(g_hwndEdit, SCI_BACKTAB, true);
EndUndoAction(token);
}
@ -3352,7 +3369,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case CMD_TAB:
{
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditIndentBlock(g_hwndEdit, SCI_TAB, false);
EndUndoAction(token);
}
@ -3360,7 +3377,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case CMD_BACKTAB:
{
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditIndentBlock(g_hwndEdit, SCI_BACKTAB, false);
EndUndoAction(token);
}
@ -3368,7 +3385,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case CMD_CTRLTAB:
{
int token = BeginUndoAction();
int const token = BeginUndoAction();
SendMessage(g_hwndEdit, SCI_SETUSETABS, true, 0);
SendMessage(g_hwndEdit, SCI_SETTABINDENTS, false, 0);
EditIndentBlock(g_hwndEdit, SCI_TAB, false);
@ -3380,7 +3397,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case CMD_DELETEBACK:
{
int token = BeginUndoAction();
int const token = BeginUndoAction();
SendMessage(g_hwndEdit, SCI_DELETEBACK, 0, 0);
EndUndoAction(token);
}
@ -3394,7 +3411,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_ENCLOSESELECTION:
if (EditEncloseSelectionDlg(hwnd,wchPrefixSelection,wchAppendSelection)) {
BeginWaitCursor(NULL);
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditEncloseSelection(g_hwndEdit,wchPrefixSelection,wchAppendSelection);
EndUndoAction(token);
EndWaitCursor();
@ -3405,7 +3422,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_SELECTIONDUPLICATE:
{
BeginWaitCursor(NULL);
int token = BeginUndoAction();
int const token = BeginUndoAction();
SendMessage(g_hwndEdit,SCI_SELECTIONDUPLICATE,0,0);
EndUndoAction(token);
EndWaitCursor();
@ -3425,7 +3442,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_STRIP1STCHAR:
{
BeginWaitCursor(NULL);
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditStripFirstCharacter(g_hwndEdit);
EndUndoAction(token);
EndWaitCursor();
@ -3436,7 +3453,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_STRIPLASTCHAR:
{
BeginWaitCursor(NULL);
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditStripLastCharacter(g_hwndEdit, false, false);
EndUndoAction(token);
EndWaitCursor();
@ -3447,7 +3464,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_TRIMLINES:
{
BeginWaitCursor(NULL);
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditStripLastCharacter(g_hwndEdit, false, true);
EndUndoAction(token);
EndWaitCursor();
@ -3458,7 +3475,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_COMPRESSWS:
{
BeginWaitCursor(NULL);
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditCompressSpaces(g_hwndEdit);
EndUndoAction(token);
EndWaitCursor();
@ -3469,7 +3486,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_MERGEBLANKLINES:
{
BeginWaitCursor(NULL);
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditRemoveBlankLines(g_hwndEdit, true, true);
EndUndoAction(token);
EndWaitCursor();
@ -3479,7 +3496,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_MERGEEMPTYLINES:
{
BeginWaitCursor(NULL);
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditRemoveBlankLines(g_hwndEdit, true, false);
EndUndoAction(token);
EndWaitCursor();
@ -3490,7 +3507,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_REMOVEBLANKLINES:
{
BeginWaitCursor(NULL);
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditRemoveBlankLines(g_hwndEdit, false, true);
EndUndoAction(token);
EndWaitCursor();
@ -3501,7 +3518,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_REMOVEEMPTYLINES:
{
BeginWaitCursor(NULL);
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditRemoveBlankLines(g_hwndEdit, false, false);
EndUndoAction(token);
EndWaitCursor();
@ -3512,7 +3529,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_REMOVEDUPLICATELINES:
{
BeginWaitCursor(NULL);
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditRemoveDuplicateLines(g_hwndEdit, false);
EndUndoAction(token);
EndWaitCursor();
@ -3524,7 +3541,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
{
if (EditModifyLinesDlg(hwnd,wchPrefixLines,wchAppendLines)) {
BeginWaitCursor(NULL);
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditModifyLines(g_hwndEdit,wchPrefixLines,wchAppendLines);
EndUndoAction(token);
EndWaitCursor();
@ -3537,7 +3554,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
{
if (EditAlignDlg(hwnd,&iAlignMode)) {
BeginWaitCursor(NULL);
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditAlignText(g_hwndEdit,iAlignMode);
EndUndoAction(token);
EndWaitCursor();
@ -3550,7 +3567,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
{
if (EditSortDlg(hwnd,&iSortOptions)) {
BeginWaitCursor(NULL);
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditSortLines(g_hwndEdit,iSortOptions);
EndUndoAction(token);
EndWaitCursor();
@ -3570,7 +3587,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
{
iWrapCol = (DocPos)max(min(uWrpCol,(UINT)g_iLongLinesLimit),1);
BeginWaitCursor(NULL);
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditWrapToColumn(g_hwndEdit,iWrapCol);
EndUndoAction(token);
EndWaitCursor();
@ -3582,7 +3599,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_SPLITLINES:
{
BeginWaitCursor(NULL);
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditSplitLines(g_hwndEdit);
EndUndoAction(token);
EndWaitCursor();
@ -3593,7 +3610,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_JOINLINES:
{
BeginWaitCursor(NULL);
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditJoinLinesEx(g_hwndEdit, false, true);
EndUndoAction(token);
EndWaitCursor();
@ -3603,7 +3620,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_JOINLN_NOSP:
{
BeginWaitCursor(NULL);
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditJoinLinesEx(g_hwndEdit, false, false);
EndUndoAction(token);
EndWaitCursor();
@ -3613,7 +3630,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_JOINLINES_PARA:
{
BeginWaitCursor(NULL);
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditJoinLinesEx(g_hwndEdit, true, true);
EndUndoAction(token);
EndWaitCursor();
@ -3624,7 +3641,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_CONVERTUPPERCASE:
{
BeginWaitCursor(NULL);
int token = BeginUndoAction();
int const token = BeginUndoAction();
SendMessage(g_hwndEdit,SCI_UPPERCASE,0,0);
EndUndoAction(token);
EndWaitCursor();
@ -3635,7 +3652,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_CONVERTLOWERCASE:
{
BeginWaitCursor(NULL);
int token = BeginUndoAction();
int const token = BeginUndoAction();
SendMessage(g_hwndEdit,SCI_LOWERCASE,0,0);
EndUndoAction(token);
EndWaitCursor();
@ -3646,7 +3663,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_INVERTCASE:
{
BeginWaitCursor(NULL);
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditInvertCase(g_hwndEdit);
EndUndoAction(token);
EndWaitCursor();
@ -3657,7 +3674,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_TITLECASE:
{
BeginWaitCursor(NULL);
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditTitleCase(g_hwndEdit);
EndUndoAction(token);
EndWaitCursor();
@ -3668,7 +3685,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_SENTENCECASE:
{
BeginWaitCursor(NULL);
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditSentenceCase(g_hwndEdit);
EndUndoAction(token);
EndWaitCursor();
@ -3679,7 +3696,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_CONVERTTABS:
{
BeginWaitCursor(NULL);
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditTabsToSpaces(g_hwndEdit, g_iTabWidth, false);
EndUndoAction(token);
EndWaitCursor();
@ -3690,7 +3707,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_CONVERTSPACES:
{
BeginWaitCursor(NULL);
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditSpacesToTabs(g_hwndEdit, g_iTabWidth, false);
EndUndoAction(token);
EndWaitCursor();
@ -3701,7 +3718,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_CONVERTTABS2:
{
BeginWaitCursor(NULL);
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditTabsToSpaces(g_hwndEdit, g_iTabWidth, true);
EndUndoAction(token);
EndWaitCursor();
@ -3712,7 +3729,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_CONVERTSPACES2:
{
BeginWaitCursor(NULL);
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditSpacesToTabs(g_hwndEdit, g_iTabWidth, true);
EndUndoAction(token);
EndWaitCursor();
@ -3725,7 +3742,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
WCHAR wszOpen[256] = { L'\0' };
WCHAR wszClose[256] = { L'\0' };
if (EditInsertTagDlg(hwnd, wszOpen, wszClose)) {
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditEncloseSelection(g_hwndEdit, wszOpen, wszClose);
EndUndoAction(token);
}
@ -3742,7 +3759,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
char *p = StrChrA(msz, ',');
if (p)
*p = 0;
int token = BeginUndoAction();
int const token = BeginUndoAction();
SendMessage(g_hwndEdit,SCI_REPLACESEL,0,(LPARAM)msz);
EndUndoAction(token);
}
@ -3788,7 +3805,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
}
WideCharToMultiByteStrg(Encoding_SciCP,tchDateTime,mszBuf);
int token = BeginUndoAction();
int const token = BeginUndoAction();
SendMessage(g_hwndEdit,SCI_REPLACESEL,0,(LPARAM)mszBuf);
EndUndoAction(token);
}
@ -3819,7 +3836,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
}
WideCharToMultiByteStrg(Encoding_SciCP,pszInsert,mszBuf);
int token = BeginUndoAction();
int const token = BeginUndoAction();
SendMessage(g_hwndEdit,SCI_REPLACESEL,0,(LPARAM)mszBuf);
EndUndoAction(token);
}
@ -3836,7 +3853,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
wszGuid[wcslen(wszGuid) - 1] = L'\0'; // trim last brace char
char mszGuid[40 * 4]; // UTF-8 max of 4 bytes per char
if (WideCharToMultiByteStrg(Encoding_SciCP,pwszGuid,mszGuid)) {
int token = BeginUndoAction();
int const token = BeginUndoAction();
SendMessage(g_hwndEdit,SCI_REPLACESEL,0,(LPARAM)mszGuid);
EndUndoAction(token);
}
@ -3849,7 +3866,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_LINECOMMENT:
{
BeginWaitCursor(NULL);
int token = BeginUndoAction();
int const token = BeginUndoAction();
switch (SendMessage(g_hwndEdit, SCI_GETLEXER, 0, 0)) {
default:
@ -3916,7 +3933,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_STREAMCOMMENT:
{
BeginWaitCursor(NULL);
int token = BeginUndoAction();
int const token = BeginUndoAction();
switch (SendMessage(g_hwndEdit, SCI_GETLEXER, 0, 0)) {
default:
@ -3977,7 +3994,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_URLENCODE:
{
BeginWaitCursor(NULL);
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditURLEncode(g_hwndEdit);
EndUndoAction(token);
EndWaitCursor();
@ -3988,7 +4005,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_URLDECODE:
{
BeginWaitCursor(NULL);
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditURLDecode(g_hwndEdit);
EndUndoAction(token);
EndWaitCursor();
@ -3999,7 +4016,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_ESCAPECCHARS:
{
BeginWaitCursor(NULL);
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditEscapeCChars(g_hwndEdit);
EndUndoAction(token);
EndWaitCursor();
@ -4010,7 +4027,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_UNESCAPECCHARS:
{
BeginWaitCursor(NULL);
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditUnescapeCChars(g_hwndEdit);
EndUndoAction(token);
EndWaitCursor();
@ -4020,7 +4037,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_CHAR2HEX:
{
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditChar2Hex(g_hwndEdit);
EndUndoAction(token);
}
@ -4039,7 +4056,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_SELTOMATCHINGBRACE:
{
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditSelectToMatchingBrace(g_hwndEdit);
EndUndoAction(token);
}
@ -4878,7 +4895,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case CMD_CTRLENTER:
{
int token = BeginUndoAction();
int const token = BeginUndoAction();
const DocPos iPos = SciCall_GetCurrentPos();
const DocLn iLine = SciCall_LineFromPosition(iPos);
if (iLine <= 0) {
@ -4906,7 +4923,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_CLEAR:
case CMD_DEL:
{
int token = BeginUndoAction();
int const token = BeginUndoAction();
SciCall_Clear();
EndUndoAction(token);
}
@ -4932,7 +4949,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
const DocPos iIndentPos = SciCall_GetLineIndentPosition(iLine);
if (iPos != iAnchor) {
int token = BeginUndoAction();
int const token = BeginUndoAction();
SciCall_SetSel(iPos, iPos);
EndUndoAction(token);
}
@ -4957,7 +4974,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
const DocPos iEndPos = SciCall_GetLineEndPosition(iLine);
if (iPos != iAnchor) {
int token = BeginUndoAction();
int const token = BeginUndoAction();
SciCall_SetSel(iPos, iPos);
EndUndoAction(token);
}
@ -5203,7 +5220,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case CMD_STRINGIFY:
{
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditEncloseSelection(g_hwndEdit, L"'", L"'");
EndUndoAction(token);
}
@ -5212,7 +5229,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case CMD_STRINGIFY2:
{
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditEncloseSelection(g_hwndEdit, L"\"", L"\"");
EndUndoAction(token);
}
@ -5221,7 +5238,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case CMD_EMBRACE:
{
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditEncloseSelection(g_hwndEdit, L"(", L")");
EndUndoAction(token);
}
@ -5230,7 +5247,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case CMD_EMBRACE2:
{
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditEncloseSelection(g_hwndEdit, L"[", L"]");
EndUndoAction(token);
}
@ -5239,7 +5256,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case CMD_EMBRACE3:
{
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditEncloseSelection(g_hwndEdit, L"{", L"}");
EndUndoAction(token);
}
@ -5248,7 +5265,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case CMD_EMBRACE4:
{
int token = BeginUndoAction();
int const token = BeginUndoAction();
EditEncloseSelection(g_hwndEdit, L"`", L"`");
EndUndoAction(token);
}
@ -5558,10 +5575,6 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
break;
}
UNUSED(wParam);
UNUSED(lParam);
return(0);
}
@ -5663,6 +5676,7 @@ void OpenHotSpotURL(DocPos position, bool bForceBrowser)
//
// MsgNotify() - Handles WM_NOTIFY
//
// !!! Set correct SCI_SETMODEVENTMASK in _InitializeSciEditCtrl()
//
LRESULT MsgNotify(HWND hwnd,WPARAM wParam,LPARAM lParam)
{
@ -5674,6 +5688,7 @@ LRESULT MsgNotify(HWND hwnd,WPARAM wParam,LPARAM lParam)
// --- check only mandatory events (must be fast !!!) ---
if (pnmh->idFrom == IDC_EDIT) {
if (pnmh->code == SCN_MODIFIED) {
bool bModified = true;
// check for ADDUNDOACTION step
if (scn->modificationType & SC_MOD_CONTAINER)
{
@ -5684,7 +5699,15 @@ LRESULT MsgNotify(HWND hwnd,WPARAM wParam,LPARAM lParam)
RestoreAction(scn->token, REDO);
}
}
_SetDocumentModified(true);
else if ((scn->modificationType & SC_MOD_BEFOREINSERT) ||
(scn->modificationType & SC_MOD_BEFOREDELETE)) {
if (!(scn->modificationType & SC_STARTACTION) && !SciCall_IsSelectionEmpty()) {
int const token = BeginUndoAction();
if (token >= 0) { EndUndoAction(token); }
}
bModified = false; // not yet
}
if (bModified) { _SetDocumentModified(true); }
}
else if (pnmh->code == SCN_SAVEPOINTREACHED) {
_SetDocumentModified(false);
@ -5782,7 +5805,7 @@ LRESULT MsgNotify(HWND hwnd,WPARAM wParam,LPARAM lParam)
case SCN_MODIFIED:
{
// check for ADDUNDOACTION step
bool bModified = true;
if (scn->modificationType & SC_MOD_CONTAINER) {
if (scn->modificationType & SC_PERFORMED_UNDO) {
RestoreAction(scn->token, UNDO);
@ -5791,6 +5814,14 @@ LRESULT MsgNotify(HWND hwnd,WPARAM wParam,LPARAM lParam)
RestoreAction(scn->token, REDO);
}
}
else if ((scn->modificationType & SC_MOD_BEFOREINSERT) ||
(scn->modificationType & SC_MOD_BEFOREDELETE)) {
if (!(scn->modificationType & SC_STARTACTION) && !SciCall_IsSelectionEmpty()) {
int const token = BeginUndoAction();
if (token >= 0) { EndUndoAction(token); }
}
bModified = false; // not yet
}
else if (scn->modificationType & SC_MOD_CHANGESTYLE) {
const DocPos iStartPos = (DocPos)scn->position;
const DocPos iEndPos = (DocPos)(scn->position + scn->length);
@ -5806,7 +5837,7 @@ LRESULT MsgNotify(HWND hwnd,WPARAM wParam,LPARAM lParam)
UpdateLineNumberWidth();
}
_SetDocumentModified(true);
if (bModified) { _SetDocumentModified(true); }
UpdateToolbar();
UpdateStatusbar(false);
@ -5861,7 +5892,7 @@ LRESULT MsgNotify(HWND hwnd,WPARAM wParam,LPARAM lParam)
*pPos = '\0';
}
if (*pLineBuf) {
int token = BeginUndoAction();
int const token = BeginUndoAction();
SciCall_AddText(lstrlenA(pLineBuf), pLineBuf);
EndUndoAction(token);
}
@ -5915,7 +5946,7 @@ LRESULT MsgNotify(HWND hwnd,WPARAM wParam,LPARAM lParam)
StringCchCompareINA(g_pTempLineBufferMain, COUNTOF(g_pTempLineBufferMain), "</link>", -1) &&
StringCchCompareINA(g_pTempLineBufferMain, COUNTOF(g_pTempLineBufferMain), "</meta>", -1))
{
int token = BeginUndoAction();
int const token = BeginUndoAction();
SciCall_ReplaceSel(g_pTempLineBufferMain);
SciCall_SetSel(iCurPos, iCurPos);
EndUndoAction(token);
@ -8026,7 +8057,7 @@ int BeginUndoAction()
break;
}
int token = UndoRedoActionMap(-1, &sel);
int const token = UndoRedoActionMap(-1, &sel);
if (token >= 0) {
SciCall_BeginUndoAction();
@ -8436,7 +8467,7 @@ bool FileLoad(bool bDontSave, bool bNew, bool bReload, bool bSkipUnicodeDetect,
SendMessage(g_hwndEdit,SCI_GETTEXT,5,(LPARAM)tchLog);
if (StringCchCompareXA(tchLog,".LOG") == 0) {
EditJumpTo(g_hwndEdit,-1,0);
int token = BeginUndoAction();
int const token = BeginUndoAction();
SendMessage(g_hwndEdit,SCI_NEWLINE,0,0);
SendMessage(g_hwndMain,WM_COMMAND,MAKELONG(IDM_EDIT_INSERT_SHORTDATE,1),0);
EditJumpTo(g_hwndEdit,-1,0);
@ -9486,7 +9517,7 @@ void CALLBACK PasteBoardTimer(HWND hwnd,UINT uMsg,UINT_PTR idEvent,DWORD dwTime)
bool bAutoIndent2 = bAutoIndent;
bAutoIndent = 0;
EditJumpTo(g_hwndEdit,-1,0);
int token = BeginUndoAction();
int const token = BeginUndoAction();
if (SendMessage(g_hwndEdit, SCI_GETLENGTH, 0, 0) > 0) {
SendMessage(g_hwndEdit, SCI_NEWLINE, 0, 0);
}

View File

@ -138,11 +138,7 @@ DeclareSciCallR0(GetReadOnly, GETREADONLY, bool)
DeclareSciCallV1(SetReadOnly, SETREADONLY, bool, flag)
DeclareSciCallR0(CanUndo, CANUNDO, bool)
DeclareSciCallR0(CanRedo, CANREDO, bool)
DeclareSciCallR0(IsDocModified, GETMODIFY, bool)
DeclareSciCallR0(IsSelectionEmpty, GETSELECTIONEMPTY, bool)
DeclareSciCallR0(IsSelectionRectangle, SELECTIONISRECTANGLE, bool)
DeclareSciCallR0(CanPaste, CANPASTE, bool)
DeclareSciCallR0(GetCurrentPos, GETCURRENTPOS, DocPos)
@ -367,11 +363,12 @@ DeclareSciCallV1(SetTechnology, SETTECHNOLOGY, int, technology)
//
// Utilities
//
DeclareSciCallR0(IsSelectionEmpty, GETSELECTIONEMPTY, bool)
DeclareSciCallR0(IsSelectionRectangle, SELECTIONISRECTANGLE, bool)
#define Sci_IsStreamSelected() (SciCall_GetSelectionMode() == SC_SEL_STREAM)
#define Sci_IsFullLineSelected() (SciCall_GetSelectionMode() == SC_SEL_LINES)
#define Sci_IsThinRectangleSelected() (SciCall_GetSelectionMode() == SC_SEL_THIN)
#define Sci_IsSingleLineSelection() \
(SciCall_LineFromPosition(SciCall_GetCurrentPos()) == SciCall_LineFromPosition(SciCall_GetAnchor()))
#define Sci_IsSingleLineSelection() (SciCall_LineFromPosition(SciCall_GetCurrentPos()) == SciCall_LineFromPosition(SciCall_GetAnchor()))
#define Sci_GetEOLLen() ((SciCall_GetEOLMode() == SC_EOL_CRLF) ? 2 : 1)