diff --git a/src/Edit.c b/src/Edit.c index 9451094ad..76b3e4a8f 100644 --- a/src/Edit.c +++ b/src/Edit.c @@ -121,6 +121,11 @@ static char PunctuationCharsAccelerated[1] = { '\0' }; // empty! //static WCHAR W_WhiteSpaceCharsDefault[DELIM_BUFFER] = { L'\0' }; //static WCHAR W_WhiteSpaceCharsAccelerated[DELIM_BUFFER] = { L'\0' }; +// temporary line buffer for fast line ops +# +static char g_pTempLineBuffer[TEMPLINE_BUFFER]; + + enum AlignMask { ALIGN_LEFT = 0, ALIGN_RIGHT = 1, @@ -3123,12 +3128,11 @@ void EditPadWithSpaces(HWND hwnd,BOOL bSkipEmpty,BOOL bNoUndoGroup) continue; const DocPos iCol = SciCall_GetColumn(iPos); - //iCol += (DocPos)SendMessage(hwnd, SCI_GETSELECTIONNCARETVIRTUALSPACE, 0, 0); const DocPos iPadLen = iMaxColumn - iCol; pmszPadStr[iPadLen] = '\0'; - SendMessage(hwnd, SCI_SETTARGETRANGE, iPos, iPos); - SendMessage(hwnd, SCI_REPLACETARGET, (WPARAM)-1, (LPARAM)pmszPadStr); + SciCall_SetTargetRange(iPos, iPos); + SciCall_ReplaceTarget(-1, pmszPadStr); pmszPadStr[iPadLen] = ' '; } @@ -3165,10 +3169,10 @@ void EditPadWithSpaces(HWND hwnd,BOOL bSkipEmpty,BOOL bNoUndoGroup) } else if (bIsRectangular) { - const DocPos iCurPos = (DocPos)SendMessage(hwnd,SCI_FINDCOLUMN,(WPARAM)iRcCurLine,(LPARAM)iRcCurCol); - const DocPos iAnchorPos = (DocPos)SendMessage(hwnd,SCI_FINDCOLUMN,(WPARAM)iRcAnchorLine,(LPARAM)iRcAnchorCol); - SendMessage(hwnd,SCI_SETRECTANGULARSELECTIONCARET,(WPARAM)iCurPos,0); - SendMessage(hwnd,SCI_SETRECTANGULARSELECTIONANCHOR,(WPARAM)iAnchorPos,0); + const DocPos iCurPos = SciCall_FindColumn(iRcCurLine, iRcCurCol); + const DocPos iAnchorPos = SciCall_FindColumn(iRcAnchorLine, iRcAnchorCol); + SciCall_SetRectangularSelectionCaret(iCurPos); + SciCall_SetRectangularSelectionAnchor(iAnchorPos); } } @@ -3180,36 +3184,91 @@ void EditPadWithSpaces(HWND hwnd,BOOL bSkipEmpty,BOOL bNoUndoGroup) // void EditStripFirstCharacter(HWND hwnd) { + UNUSED(hwnd); + DocPos iSelStart = 0; DocPos iSelEnd = 0; - if (SciCall_IsSelectionEmpty()) - { - iSelEnd = SciCall_GetTextLength(); - } - else { - if (SciCall_IsSelectionRectangle()) { - MsgBox(MBWARN, IDS_SELRECT); - return; - } - iSelStart = SciCall_GetSelectionStart(); - iSelEnd = SciCall_GetSelectionEnd(); - } - - const DocLn iLineStart = SciCall_LineFromPosition(iSelStart); - const DocLn iLineEnd = SciCall_LineFromPosition(iSelEnd); - IgnoreNotifyChangeEvent(); EditEnterTargetTransaction(); - for (DocLn iLine = iLineStart; iLine <= iLineEnd; ++iLine) { - const DocPos iPos = SciCall_PositionFromLine(iLine); - if (iPos < SciCall_GetLineEndPosition(iLine)) { - SendMessage(hwnd, SCI_SETTARGETRANGE, (WPARAM)iPos, (LPARAM)SciCall_PositionAfter(iPos)); - SendMessage(hwnd, SCI_REPLACETARGET, 0, (LPARAM)""); + if (SciCall_IsSelectionRectangle()) { + if (SciCall_IsSelectionEmpty()) { + SciCall_Clear(); + return; + } + const DocPosU selCount = SciCall_GetSelections(); + for (DocPosU s = 0; s < selCount; ++s) + { + const DocPos selCaretPos = SciCall_GetSelectionNCaret(s); + const DocPos selAnchorPos = SciCall_GetSelectionNAnchor(s); + const DocPos vSpcCaretPos = SciCall_GetSelectionNCaretVirtualSpace(s); + const DocPos vSpcAnchorPos = SciCall_GetSelectionNAnchorVirtualSpace(s); + + const DocPos selTargetStart = (selAnchorPos < selCaretPos) ? selAnchorPos : selCaretPos; + const DocPos selTargetEnd = (selAnchorPos < selCaretPos) ? selCaretPos : selAnchorPos; + + DocPos nextPos = SciCall_PositionAfter(selTargetStart); + DocPos diff = (nextPos - selTargetStart); + DocPos len = (selTargetEnd - nextPos); + if ((len >= 0) && (len < TEMPLINE_BUFFER)) //TODO: @@@ alloc memory dynamically + { + StringCchCopyNA(g_pTempLineBuffer, TEMPLINE_BUFFER, SciCall_GetRangePointer(nextPos, len+1), len); + SciCall_SetTargetRange(selTargetStart, selTargetEnd); + SciCall_ReplaceTarget(len, g_pTempLineBuffer); + } + if (selAnchorPos < selCaretPos) { + if (len >= 0) { + SciCall_SetSelectionNAnchor(s, selAnchorPos); + SciCall_SetSelectionNCaret(s, selCaretPos - diff); + SciCall_SetSelectionNAnchorVirtualSpace(s, vSpcAnchorPos - diff); + SciCall_SetSelectionNCaretVirtualSpace(s, vSpcCaretPos + diff); + } + else { + SciCall_SetSelectionNAnchor(s, selAnchorPos); + SciCall_SetSelectionNCaret(s, selCaretPos); + SciCall_SetSelectionNAnchorVirtualSpace(s, vSpcAnchorPos); + SciCall_SetSelectionNCaretVirtualSpace(s, vSpcCaretPos); + } + } + else { + if (len >= 0) { + SciCall_SetSelectionNCaret(s, selCaretPos); + SciCall_SetSelectionNAnchor(s, selAnchorPos - diff); + SciCall_SetSelectionNCaretVirtualSpace(s, vSpcCaretPos - diff); + SciCall_SetSelectionNAnchorVirtualSpace(s, vSpcAnchorPos + diff); + } + else { + SciCall_SetSelectionNCaret(s, selCaretPos); + SciCall_SetSelectionNAnchor(s, selAnchorPos); + SciCall_SetSelectionNCaretVirtualSpace(s, vSpcCaretPos); + SciCall_SetSelectionNAnchorVirtualSpace(s, vSpcAnchorPos); + } + } + } // for() + } + else // SC_SEL_LINES | SC_SEL_STREAM + { + if (SciCall_IsSelectionEmpty()) + { + iSelEnd = SciCall_GetTextLength(); + } + else { + iSelStart = SciCall_GetSelectionStart(); + iSelEnd = SciCall_GetSelectionEnd(); + } + + const DocLn iLineStart = SciCall_LineFromPosition(iSelStart); + const DocLn iLineEnd = SciCall_LineFromPosition(iSelEnd); + + for (DocLn iLine = iLineStart; iLine <= iLineEnd; ++iLine) { + const DocPos iPos = SciCall_PositionFromLine(iLine); + if (iPos < SciCall_GetLineEndPosition(iLine)) { + SciCall_SetTargetRange(iPos, SciCall_PositionAfter(iPos)); + SciCall_ReplaceTarget(0, ""); + } } } - EditLeaveTargetTransaction(); ObserveNotifyChangeEvent(); } @@ -3221,56 +3280,110 @@ void EditStripFirstCharacter(HWND hwnd) // void EditStripLastCharacter(HWND hwnd, BOOL bIgnoreSelection, BOOL bTrailingBlanksOnly) { + UNUSED(hwnd); + DocPos iSelStart = 0; DocPos iSelEnd = 0; - if (SciCall_IsSelectionEmpty() || bIgnoreSelection) { - iSelEnd = SciCall_GetTextLength(); - } - else { - if (SciCall_IsSelectionRectangle()) { - MsgBox(MBWARN, IDS_SELRECT); - return; - } - iSelStart = SciCall_GetSelectionStart(); - iSelEnd = SciCall_GetSelectionEnd(); - } - - const DocLn iLineStart = SciCall_LineFromPosition(iSelStart); - const DocLn iLineEnd = SciCall_LineFromPosition(iSelEnd); - IgnoreNotifyChangeEvent(); EditEnterTargetTransaction(); - for (DocLn iLine = iLineStart; iLine <= iLineEnd; ++iLine) - { - const DocPos iStartPos = SciCall_PositionFromLine(iLine); - const DocPos iEndPos = SciCall_GetLineEndPosition(iLine); - - if (bTrailingBlanksOnly) - { - DocPos i = iEndPos; - char ch = '\0'; - do { - ch = SciCall_GetCharAt(--i); - } while ((i >= iStartPos) && ((ch == ' ') || (ch == '\t'))); - if ((++i) < iEndPos) { - SciCall_SetTargetRange(i, iEndPos); - SciCall_ReplaceTarget(0, ""); - } + if (SciCall_IsSelectionRectangle()) { + if (SciCall_IsSelectionEmpty()) { + SciCall_Clear(); + return; } - else { // any char at line end - if (iStartPos < iEndPos) { - SciCall_SetTargetRange(SciCall_PositionBefore(iEndPos), iEndPos); - SciCall_ReplaceTarget(0, ""); - } + const DocPosU selCount = (DocPosU)SendMessage(hwnd, SCI_GETSELECTIONS, 0, 0); + for (DocPosU s = 0; s < selCount; ++s) + { + const DocPos selCaretPos = SciCall_GetSelectionNCaret(s); + const DocPos selAnchorPos = SciCall_GetSelectionNAnchor(s); + const DocPos vSpcCaretPos = SciCall_GetSelectionNCaretVirtualSpace(s); + const DocPos vSpcAnchorPos = SciCall_GetSelectionNAnchorVirtualSpace(s); + const DocPos selTargetStart = (selAnchorPos < selCaretPos) ? selAnchorPos : selCaretPos; + const DocPos selTargetEnd = (selAnchorPos < selCaretPos) ? selCaretPos : selAnchorPos; + + DocPos prevPos = SciCall_PositionBefore(selTargetEnd); + DocPos diff = (selTargetEnd - prevPos); + DocPos len = (prevPos - selTargetStart); + if ((len >= 0) && (len < TEMPLINE_BUFFER)) + { + StringCchCopyNA(g_pTempLineBuffer, TEMPLINE_BUFFER, SciCall_GetRangePointer(selTargetStart, len+1), len); + SciCall_SetTargetRange(selTargetStart, selTargetEnd); + SciCall_ReplaceTarget(len, g_pTempLineBuffer); + } + if (selAnchorPos < selCaretPos) { + if (len >= 0) { + SciCall_SetSelectionNAnchor(s, selAnchorPos); + SciCall_SetSelectionNCaret(s, selCaretPos - diff); + SciCall_SetSelectionNAnchorVirtualSpace(s, vSpcAnchorPos - diff); + SciCall_SetSelectionNCaretVirtualSpace(s, vSpcCaretPos + diff); + } + else { + SciCall_SetSelectionNAnchor(s, selAnchorPos); + SciCall_SetSelectionNCaret(s, selCaretPos); + SciCall_SetSelectionNAnchorVirtualSpace(s, vSpcAnchorPos); + SciCall_SetSelectionNCaretVirtualSpace(s, vSpcCaretPos); + } + } + else { + if (len >= 0) { + SciCall_SetSelectionNCaret(s, selCaretPos); + SciCall_SetSelectionNAnchor(s, selAnchorPos - diff); + SciCall_SetSelectionNCaretVirtualSpace(s, vSpcCaretPos - diff); + SciCall_SetSelectionNAnchorVirtualSpace(s, vSpcAnchorPos + diff); + } + else { + SciCall_SetSelectionNCaret(s, selCaretPos); + SciCall_SetSelectionNAnchor(s, selAnchorPos); + SciCall_SetSelectionNCaretVirtualSpace(s, vSpcCaretPos); + SciCall_SetSelectionNAnchorVirtualSpace(s, vSpcAnchorPos); + } + } + } // for() + } + else // SC_SEL_LINES | SC_SEL_STREAM + { + if (SciCall_IsSelectionEmpty() || bIgnoreSelection) { + iSelEnd = SciCall_GetTextLength(); + } + else { + iSelStart = SciCall_GetSelectionStart(); + iSelEnd = SciCall_GetSelectionEnd(); + } + + const DocLn iLineStart = SciCall_LineFromPosition(iSelStart); + const DocLn iLineEnd = SciCall_LineFromPosition(iSelEnd); + + for (DocLn iLine = iLineStart; iLine <= iLineEnd; ++iLine) + { + const DocPos iStartPos = SciCall_PositionFromLine(iLine); + const DocPos iEndPos = SciCall_GetLineEndPosition(iLine); + + if (bTrailingBlanksOnly) + { + DocPos i = iEndPos; + char ch = '\0'; + do { + ch = SciCall_GetCharAt(--i); + } while ((i >= iStartPos) && ((ch == ' ') || (ch == '\t'))); + if ((++i) < iEndPos) { + SciCall_SetTargetRange(i, iEndPos); + SciCall_ReplaceTarget(0, ""); + } + } + else { // any char at line end + if (iStartPos < iEndPos) { + SciCall_SetTargetRange(SciCall_PositionBefore(iEndPos), iEndPos); + SciCall_ReplaceTarget(0, ""); + } + + } } } - EditLeaveTargetTransaction(); ObserveNotifyChangeEvent(); - UNUSED(hwnd); } diff --git a/src/Notepad3.c b/src/Notepad3.c index 2afbee96d..1fdcf4078 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -4630,11 +4630,11 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam) } else { if (iPos == iStartPos) - Sci_SendMessageV0(SCI_DELETEBACK); + Sci_SendMsgV0(SCI_DELETEBACK); else if (iPos <= iIndentPos) - Sci_SendMessageV0(SCI_DELLINELEFT); + Sci_SendMsgV0(SCI_DELLINELEFT); else - Sci_SendMessageV0(SCI_DELWORDLEFT); + Sci_SendMsgV0(SCI_DELWORDLEFT); } } break; @@ -4655,9 +4655,9 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam) } else { if (iStartPos != iEndPos) - Sci_SendMessageV0(SCI_DELWORDRIGHT); + Sci_SendMsgV0(SCI_DELWORDRIGHT); else // iStartPos == iEndPos - Sci_SendMessageV0(SCI_LINEDELETE); + Sci_SendMsgV0(SCI_LINEDELETE); } } break; @@ -5489,7 +5489,7 @@ LRESULT MsgNotify(HWND hwnd,WPARAM wParam,LPARAM lParam) case SCN_CHARADDED: { - static char chLineBuffer[FNDRPL_BUFFER] = { '\0' }; + static char chLineBuffer[XHUGE_BUFFER] = { '\0' }; // Auto indent if (bAutoIndent && (scn->ch == '\x0D' || scn->ch == '\x0A')) @@ -5520,7 +5520,7 @@ LRESULT MsgNotify(HWND hwnd,WPARAM wParam,LPARAM lParam) const DocPos iPrevLineLength = SciCall_LineLength(iCurLine - 1); char* pLineBuf = NULL; bool bAllocLnBuf = false; - if (iPrevLineLength < FNDRPL_BUFFER) { + if (iPrevLineLength < XHUGE_BUFFER) { pLineBuf = chLineBuffer; } else { diff --git a/src/SciCall.h b/src/SciCall.h index 7c3157eeb..d06d53056 100644 --- a/src/SciCall.h +++ b/src/SciCall.h @@ -16,6 +16,39 @@ * * * * *******************************************************************************/ + + +/****************************************************************************** +* +* On Windows, the message - passing scheme used to communicate between the +* container and Scintilla is mediated by the operating system SendMessage +* function and can lead to bad performance when calling intensively. +* To avoid this overhead, Scintilla provides messages that allow you to call +* the Scintilla message function directly. +* The code to do this in C / C++ is of the form : +* +* #include "Scintilla.h" +* SciFnDirect pSciMsg = (SciFnDirect)SendMessage(hSciWnd, SCI_GETDIRECTFUNCTION, 0, 0); +* sptr_t pSciWndData = (sptr_t)SendMessage(hSciWnd, SCI_GETDIRECTPOINTER, 0, 0); +* +* // now a wrapper to call Scintilla directly +* sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { +* return pSciMsg(pSciWndData, iMessage, wParam, lParam); +* } +* +* SciFnDirect, sptr_t and uptr_t are declared in Scintilla.h.hSciWnd +* is the window handle returned when you created the Scintilla window. +* +* While faster, this direct calling will cause problems if performed from a +* different thread to the native thread of the Scintilla window in which case +* SendMessage(hSciWnd, SCI_*, wParam, lParam) should be used +* to synchronize with the window's thread. +* +*******************************************************************************/ + +#define SCI_DIRECTFUNCTION_INTERFACE 1 // disable for asynchronous operation + + #pragma once #ifndef _NP3_SCICALL_H_ #define _NP3_SCICALL_H_ @@ -27,20 +60,30 @@ extern HANDLE g_hwndEdit; //============================================================================= // -// Sci_SendMessage() +// Sci_SendMessage() short version // -#define Sci_SendMessageV0(CMD) SendMessage(g_hwndEdit, (CMD), (WPARAM)0, (LPARAM)0) -#define Sci_SendMessageV1(CMD,WP) SendMessage(g_hwndEdit, (CMD), (WPARAM)(WP), (LPARAM)0) -#define Sci_SendMessageV2(CMD,WP,LP) SendMessage(g_hwndEdit, (CMD), (WPARAM)(WP), (LPARAM)(LP)) +#define Sci_SendMsgV0(CMD) SendMessage(g_hwndEdit, (CMD), (WPARAM)0, (LPARAM)0) +#define Sci_SendMsgV1(CMD,WP) SendMessage(g_hwndEdit, (CMD), (WPARAM)(WP), (LPARAM)0) +#define Sci_SendMsgV2(CMD,WP,LP) SendMessage(g_hwndEdit, (CMD), (WPARAM)(WP), (LPARAM)(LP)) //============================================================================= // // SciCall() // +#ifdef SCI_DIRECTFUNCTION_INTERFACE + LRESULT WINAPI Scintilla_DirectFunction(HANDLE, UINT, WPARAM, LPARAM); #define SciCall(m, w, l) Scintilla_DirectFunction(g_hScintilla, m, w, l) +#else + +#define SciCall(m, w, l) SendMessage(g_hwndEdit, m, w, l) + +#endif // SCI_DIRECTFUNCTION_INTERFACE + + + //============================================================================= // // DeclareSciCall[RV][0-2] Macros @@ -88,133 +131,147 @@ __forceinline LRESULT SciCall_##fn(type1 var1, type2 var2) { \ // // Selection, positions and information // -DeclareSciCallR0(IsDocModified, GETMODIFY, bool); -DeclareSciCallR0(IsSelectionEmpty, GETSELECTIONEMPTY, bool); -DeclareSciCallR0(IsSelectionRectangle, SELECTIONISRECTANGLE, bool); +DeclareSciCallR0(IsDocModified, GETMODIFY, bool) +DeclareSciCallR0(IsSelectionEmpty, GETSELECTIONEMPTY, bool) +DeclareSciCallR0(IsSelectionRectangle, SELECTIONISRECTANGLE, bool) -DeclareSciCallR0(CanPaste, CANPASTE, bool); +DeclareSciCallR0(CanPaste, CANPASTE, bool) -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); -DeclareSciCallR1(GetLineSelEndPosition, GETLINESELENDPOSITION, DocPos, DocLn, line); +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) +DeclareSciCallR1(GetLineSelEndPosition, GETLINESELENDPOSITION, DocPos, DocLn, line) + +// Rectangular selection with virtual space +DeclareSciCallV1(SetRectangularSelectionCaret, SETRECTANGULARSELECTIONCARET, DocPos, position) +DeclareSciCallV1(SetRectangularSelectionAnchor, SETRECTANGULARSELECTIONANCHOR, DocPos, position) + +DeclareSciCallR0(GetSelections, GETSELECTIONS, DocPosU) +DeclareSciCallR1(GetSelectionNCaret, GETSELECTIONNCARET, DocPos, DocPosU, selnum) +DeclareSciCallR1(GetSelectionNAnchor, GETSELECTIONNANCHOR, DocPos, DocPosU, selnum) +DeclareSciCallR1(GetSelectionNCaretVirtualSpace, GETSELECTIONNCARETVIRTUALSPACE, DocPos, DocPosU, selnum) +DeclareSciCallR1(GetSelectionNAnchorVirtualSpace, GETSELECTIONNANCHORVIRTUALSPACE, DocPos, DocPosU, selnum) +DeclareSciCallV2(SetSelectionNCaret, SETSELECTIONNCARET, DocPosU, selnum, DocPos, caretPos) +DeclareSciCallV2(SetSelectionNAnchor, SETSELECTIONNANCHOR, DocPosU, selnum, DocPos, anchorPos) +DeclareSciCallV2(SetSelectionNCaretVirtualSpace, SETSELECTIONNCARETVIRTUALSPACE, DocPosU, selnum, DocPos, position) +DeclareSciCallV2(SetSelectionNAnchorVirtualSpace, SETSELECTIONNANCHORVIRTUALSPACE, DocPosU, selnum, DocPos, position) + +// Operations +DeclareSciCallV0(Cut, CUT) +DeclareSciCallV0(Copy, COPY) +DeclareSciCallV0(Paste, PASTE) +DeclareSciCallV0(Clear, CLEAR) +DeclareSciCallV0(CopyAllowLine, COPYALLOWLINE) +DeclareSciCallV0(LineDelete, LINEDELETE) +DeclareSciCallV2(CopyText, COPYTEXT, DocPos, length, const char*, text) +DeclareSciCallV2(GetTextFromBegin, GETTEXT, DocPos, length, const char*, text) + +DeclareSciCallV2(SetSel, SETSEL, DocPos, anchorPos, DocPos, currentPos) +DeclareSciCallV0(SelectAll, SELECTALL) +DeclareSciCallR01(GetSelText, GETSELTEXT, DocPos, const char*, text) +DeclareSciCallV01(ReplaceSel, REPLACESEL, const char*, text) +DeclareSciCallR2(GetLine, GETLINE, DocPos, DocLn, line, const char*, text) +DeclareSciCallV2(InsertText, INSERTTEXT, DocPos, position, const char*, text) -DeclareSciCallV0(Cut, CUT); -DeclareSciCallV0(Copy, COPY); -DeclareSciCallV0(Paste, PASTE); -DeclareSciCallV0(Clear, CLEAR); -DeclareSciCallV0(CopyAllowLine, COPYALLOWLINE); -DeclareSciCallV0(LineDelete, LINEDELETE); -DeclareSciCallV2(CopyText, COPYTEXT, DocPos, length, const char*, text); -DeclareSciCallV2(GetTextFromBegin, GETTEXT, DocPos, length, const char*, text); - -DeclareSciCallV2(SetSel, SETSEL, DocPos, anchorPos, DocPos, currentPos); -DeclareSciCallV0(SelectAll, SELECTALL); -DeclareSciCallR01(GetSelText, GETSELTEXT, DocPos, const char*, text); -DeclareSciCallV01(ReplaceSel, REPLACESEL, const char*, text); -DeclareSciCallR2(GetLine, GETLINE, DocPos, DocLn, line, const char*, text); -DeclareSciCallV2(InsertText, INSERTTEXT, DocPos, position, const char*, text); +DeclareSciCallR0(GetTargetStart, GETTARGETSTART, DocPos) +DeclareSciCallR0(GetTargetEnd, GETTARGETEND, DocPos) +DeclareSciCallV0(TargetFromSelection, TARGETFROMSELECTION) +DeclareSciCallV2(SetTargetRange, SETTARGETRANGE, DocPos, start, DocPos, end) +DeclareSciCallR2(ReplaceTarget, REPLACETARGET, DocPos, DocPos, length, const char*, text) +DeclareSciCallV2(AddText, ADDTEXT, DocPos, length, const char*, text) -DeclareSciCallR0(GetTargetStart, GETTARGETSTART, DocPos); -DeclareSciCallR0(GetTargetEnd, GETTARGETEND, DocPos); -DeclareSciCallV0(TargetFromSelection, TARGETFROMSELECTION); -DeclareSciCallV2(SetTargetRange, SETTARGETRANGE, DocPos, start, DocPos, end); -DeclareSciCallR2(ReplaceTarget, REPLACETARGET, DocPos, DocPos, length, const char*, text); -DeclareSciCallV2(AddText, ADDTEXT, DocPos, length, const char*, text); +DeclareSciCallV1(SetAnchor, SETANCHOR, DocPos, position) +DeclareSciCallV1(SetCurrentPos, SETCURRENTPOS, DocPos, position) +DeclareSciCallV1(SetMultiPaste, SETMULTIPASTE, int, option) + +DeclareSciCallV1(GotoPos, GOTOPOS, DocPos, position) +DeclareSciCallV1(GotoLine, GOTOLINE, DocLn, line) +DeclareSciCallR1(PositionBefore, POSITIONBEFORE, DocPos, DocPos, position) +DeclareSciCallR1(PositionAfter, POSITIONAFTER, DocPos, DocPos, position) +DeclareSciCallR1(GetCharAt, GETCHARAT, char, DocPos, position) +DeclareSciCallR0(GetEOLMode, GETEOLMODE, int) + +DeclareSciCallR0(GetLineCount, GETLINECOUNT, DocLn) +DeclareSciCallR0(GetTextLength, GETTEXTLENGTH, DocPos) +DeclareSciCallR1(LineLength, LINELENGTH, DocPos, DocLn, line) +DeclareSciCallR1(LineFromPosition, LINEFROMPOSITION, DocLn, DocPos, position) +DeclareSciCallR1(PositionFromLine, POSITIONFROMLINE, DocPos, DocLn, line) +DeclareSciCallR1(GetLineEndPosition, GETLINEENDPOSITION, DocPos, DocLn, line) +DeclareSciCallR1(GetColumn, GETCOLUMN, DocPos, DocPos, position) +DeclareSciCallR2(FindColumn, FINDCOLUMN, DocPos, DocLn, line, DocPos, column) + +DeclareSciCallR0(LinesOnScreen, LINESONSCREEN, DocLn) +DeclareSciCallR0(GetFirstVisibleLine, GETFIRSTVISIBLELINE, DocLn) +DeclareSciCallR1(DocLineFromVisible, DOCLINEFROMVISIBLE, DocLn, DocLn, line) +DeclareSciCallR1(GetLineIndentPosition, GETLINEINDENTPOSITION, DocPos, DocLn, line) -DeclareSciCallV1(SetAnchor, SETANCHOR, DocPos, position); -DeclareSciCallV1(SetCurrentPos, SETCURRENTPOS, DocPos, position); -DeclareSciCallV1(SetMultiPaste, SETMULTIPASTE, int, option); - -DeclareSciCallV1(GotoPos, GOTOPOS, DocPos, position); -DeclareSciCallV1(GotoLine, GOTOLINE, DocLn, line); -DeclareSciCallR1(PositionBefore, POSITIONBEFORE, DocPos, DocPos, position); -DeclareSciCallR1(PositionAfter, POSITIONAFTER, DocPos, DocPos, position); -DeclareSciCallR1(GetCharAt, GETCHARAT, char, DocPos, position); -DeclareSciCallR0(GetEOLMode, GETEOLMODE, int); - -DeclareSciCallR0(GetLineCount, GETLINECOUNT, DocLn); -DeclareSciCallR0(GetTextLength, GETTEXTLENGTH, DocPos); -DeclareSciCallR1(LineLength, LINELENGTH, DocPos, DocLn, line); -DeclareSciCallR1(LineFromPosition, LINEFROMPOSITION, DocLn, DocPos, position); -DeclareSciCallR1(PositionFromLine, POSITIONFROMLINE, DocPos, DocLn, line); -DeclareSciCallR1(GetLineEndPosition, GETLINEENDPOSITION, DocPos, DocLn, line); -DeclareSciCallR1(GetColumn, GETCOLUMN, DocPos, DocPos, position); -DeclareSciCallR2(FindColumn, FINDCOLUMN, DocPos, DocLn, line, DocPos, column); - -DeclareSciCallR0(LinesOnScreen, LINESONSCREEN, DocLn); -DeclareSciCallR0(GetFirstVisibleLine, GETFIRSTVISIBLELINE, DocLn); -DeclareSciCallR1(DocLineFromVisible, DOCLINEFROMVISIBLE, DocLn, DocLn, line); -DeclareSciCallR1(GetLineIndentPosition, GETLINEINDENTPOSITION, DocPos, DocLn, line); +DeclareSciCallR2(GetRangePointer, GETRANGEPOINTER, const char*, DocPos, start, DocPos, length) +DeclareSciCallR0(GetCharacterPointer, GETCHARACTERPOINTER, const char*) -DeclareSciCallR2(GetRangePointer, GETRANGEPOINTER, const char*, DocPos, start, DocPos, length); -DeclareSciCallR0(GetCharacterPointer, GETCHARACTERPOINTER, const char*); - - -DeclareSciCallV1(SetVirtualSpaceOptions, SETVIRTUALSPACEOPTIONS, int, options); +DeclareSciCallV1(SetVirtualSpaceOptions, SETVIRTUALSPACEOPTIONS, int, options) //============================================================================= // // Commands // -DeclareSciCallV0(NewLine, NEWLINE); +DeclareSciCallV0(NewLine, NEWLINE) //============================================================================= // // Scrolling and automatic scrolling // -DeclareSciCallV0(ChooseCaretX, CHOOSECARETX); -DeclareSciCallV0(ScrollCaret, SCROLLCARET); -DeclareSciCallV2(ScrollRange, SCROLLRANGE, DocPos, secondaryPos, DocPos, primaryPos); +DeclareSciCallV0(ChooseCaretX, CHOOSECARETX) +DeclareSciCallV0(ScrollCaret, SCROLLCARET) +DeclareSciCallV2(ScrollRange, SCROLLRANGE, DocPos, secondaryPos, DocPos, primaryPos) //============================================================================= // // Style definition // -DeclareSciCallR1(StyleGetFore, STYLEGETFORE, COLORREF, int, styleNumber); -DeclareSciCallR1(StyleGetBack, STYLEGETBACK, COLORREF, int, styleNumber); -DeclareSciCallV2(SetStyling, SETSTYLING, DocPosCR, length, int, style); -DeclareSciCallV1(StartStyling, STARTSTYLING, DocPos, position); -DeclareSciCallR0(GetEndStyled, GETENDSTYLED, int); +DeclareSciCallR1(StyleGetFore, STYLEGETFORE, COLORREF, int, styleNumber) +DeclareSciCallR1(StyleGetBack, STYLEGETBACK, COLORREF, int, styleNumber) +DeclareSciCallV2(SetStyling, SETSTYLING, DocPosCR, length, int, style) +DeclareSciCallV1(StartStyling, STARTSTYLING, DocPos, position) +DeclareSciCallR0(GetEndStyled, GETENDSTYLED, int) //============================================================================= // // Margins // -DeclareSciCallV2(SetMarginType, SETMARGINTYPEN, int, margin, int, type); -DeclareSciCallV2(SetMarginWidth, SETMARGINWIDTHN, int, margin, int, pixelWidth); -DeclareSciCallV2(SetMarginMask, SETMARGINMASKN, int, margin, int, mask); -DeclareSciCallV2(SetMarginSensitive, SETMARGINSENSITIVEN, int, margin, bool, sensitive); -DeclareSciCallV2(SetMarginBackN, SETMARGINBACKN, int, margin, COLORREF, colour); -DeclareSciCallV2(SetFoldMarginColour, SETFOLDMARGINCOLOUR, bool, useSetting, COLORREF, colour); -DeclareSciCallV2(SetFoldMarginHiColour, SETFOLDMARGINHICOLOUR, bool, useSetting, COLORREF, colour); +DeclareSciCallV2(SetMarginType, SETMARGINTYPEN, int, margin, int, type) +DeclareSciCallV2(SetMarginWidth, SETMARGINWIDTHN, int, margin, int, pixelWidth) +DeclareSciCallV2(SetMarginMask, SETMARGINMASKN, int, margin, int, mask) +DeclareSciCallV2(SetMarginSensitive, SETMARGINSENSITIVEN, int, margin, bool, sensitive) +DeclareSciCallV2(SetMarginBackN, SETMARGINBACKN, int, margin, COLORREF, colour) +DeclareSciCallV2(SetFoldMarginColour, SETFOLDMARGINCOLOUR, bool, useSetting, COLORREF, colour) +DeclareSciCallV2(SetFoldMarginHiColour, SETFOLDMARGINHICOLOUR, bool, useSetting, COLORREF, colour) //============================================================================= // // Markers // -DeclareSciCallV2(MarkerDefine, MARKERDEFINE, int, markerNumber, int, markerSymbols); -DeclareSciCallV2(MarkerSetFore, MARKERSETFORE, int, markerNumber, COLORREF, colour); -DeclareSciCallV2(MarkerSetBack, MARKERSETBACK, int, markerNumber, COLORREF, colour); +DeclareSciCallV2(MarkerDefine, MARKERDEFINE, int, markerNumber, int, markerSymbols) +DeclareSciCallV2(MarkerSetFore, MARKERSETFORE, int, markerNumber, COLORREF, colour) +DeclareSciCallV2(MarkerSetBack, MARKERSETBACK, int, markerNumber, COLORREF, colour) //============================================================================= // // Indicators // -DeclareSciCallR2(IndicatorValueAt, INDICATORVALUEAT, int, int, indicatorID, DocPos, position); -DeclareSciCallV2(IndicatorFillRange, INDICATORFILLRANGE, DocPos, position, DocPos, length); +DeclareSciCallR2(IndicatorValueAt, INDICATORVALUEAT, int, int, indicatorID, DocPos, position) +DeclareSciCallV2(IndicatorFillRange, INDICATORFILLRANGE, DocPos, position, DocPos, length) //============================================================================= @@ -222,42 +279,42 @@ DeclareSciCallV2(IndicatorFillRange, INDICATORFILLRANGE, DocPos, position, DocPo // Folding // // -DeclareSciCallR1(GetLineVisible, GETLINEVISIBLE, bool, DocLn, line); -DeclareSciCallR1(GetFoldLevel, GETFOLDLEVEL, int, DocLn, line); -DeclareSciCallV1(SetFoldFlags, SETFOLDFLAGS, int, flags); -DeclareSciCallR1(GetFoldParent, GETFOLDPARENT, int, DocLn, line); -DeclareSciCallR1(GetFoldExpanded, GETFOLDEXPANDED, int, DocLn, line); -DeclareSciCallV1(ToggleFold, TOGGLEFOLD, DocLn, line); -DeclareSciCallV1(EnsureVisible, ENSUREVISIBLE, DocLn, line); +DeclareSciCallR1(GetLineVisible, GETLINEVISIBLE, bool, DocLn, line) +DeclareSciCallR1(GetFoldLevel, GETFOLDLEVEL, int, DocLn, line) +DeclareSciCallV1(SetFoldFlags, SETFOLDFLAGS, int, flags) +DeclareSciCallR1(GetFoldParent, GETFOLDPARENT, int, DocLn, line) +DeclareSciCallR1(GetFoldExpanded, GETFOLDEXPANDED, int, DocLn, line) +DeclareSciCallV1(ToggleFold, TOGGLEFOLD, DocLn, line) +DeclareSciCallV1(EnsureVisible, ENSUREVISIBLE, DocLn, line) //============================================================================= // // Lexer // -DeclareSciCallV2(SetProperty, SETPROPERTY, const char *, key, const char *, value); +DeclareSciCallV2(SetProperty, SETPROPERTY, const char *, key, const char *, value) //============================================================================= // // Cursor // -DeclareSciCallV1(SetCursor, SETCURSOR, int, flags); +DeclareSciCallV1(SetCursor, SETCURSOR, int, flags) //============================================================================= // // Undo/Redo Stack // -DeclareSciCallR0(GetUndoCollection, GETUNDOCOLLECTION, bool); +DeclareSciCallR0(GetUndoCollection, GETUNDOCOLLECTION, bool) //============================================================================= // // SetTechnology // -DeclareSciCallV1(SetBufferedDraw, SETBUFFEREDDRAW, bool, value); -DeclareSciCallV1(SetTechnology, SETTECHNOLOGY, int, technology); +DeclareSciCallV1(SetBufferedDraw, SETBUFFEREDDRAW, bool, value) +DeclareSciCallV1(SetTechnology, SETTECHNOLOGY, int, technology) //============================================================================= diff --git a/src/Styles.c b/src/Styles.c index 31b7e63b4..98eef1998 100644 --- a/src/Styles.c +++ b/src/Styles.c @@ -5729,7 +5729,6 @@ INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam hwndTV = GetDlgItem(hwnd,IDC_STYLELIST); fDragging = FALSE; - SHFILEINFO shfi; ZeroMemory(&shfi, sizeof(SHFILEINFO)); TreeView_SetImageList(hwndTV, diff --git a/src/TypeDefs.h b/src/TypeDefs.h index 046d7dd01..0be462cb1 100644 --- a/src/TypeDefs.h +++ b/src/TypeDefs.h @@ -52,7 +52,8 @@ XHUGE_BUFFER = 2048, FILE_ARG_BUF = MAX_PATH + 2, - FNDRPL_BUFFER = 1024 + FNDRPL_BUFFER = 1024, + TEMPLINE_BUFFER = 8192 }; //=============================================================================