diff --git a/scintilla/Scintilla.vcxproj b/scintilla/Scintilla.vcxproj
index 0774548c5..329943977 100644
--- a/scintilla/Scintilla.vcxproj
+++ b/scintilla/Scintilla.vcxproj
@@ -126,6 +126,9 @@
Level3
false
+ true
+ StreamingSIMDExtensions2
+ Fast
true
@@ -146,6 +149,8 @@
MultiThreadedDebug
Level3
false
+ true
+ Fast
MachineX64
@@ -159,15 +164,17 @@
include;lexlib;src;../onigmo;../onigmo/win32;%(AdditionalIncludeDirectories)
ProgramDatabase
- NoExtensions
+ StreamingSIMDExtensions2
true
- MaxSpeed
+ Full
NotUsing
_SCL_SECURE_NO_WARNINGS;SCI_OWNREGEX;ONIG_EXTERN=extern;WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES;STATIC_BUILD;SCI_LEXER;USE_D2D;%(PreprocessorDefinitions)
MultiThreaded
Level3
true
+ true
+ Fast
true
@@ -178,12 +185,14 @@
include;lexlib;src;../onigmo;../onigmo/win32;%(AdditionalIncludeDirectories)
ProgramDatabase
true
- MaxSpeed
+ Full
NotUsing
_SCL_SECURE_NO_WARNINGS;SCI_OWNREGEX;ONIG_EXTERN=extern;_WIN64;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES;STATIC_BUILD;SCI_LEXER;USE_D2D;%(PreprocessorDefinitions)
MultiThreaded
Level3
true
+ true
+ Fast
MachineX64
diff --git a/src/Edit.c b/src/Edit.c
index c9565afc3..7a91c7b6d 100644
--- a/src/Edit.c
+++ b/src/Edit.c
@@ -38,12 +38,12 @@
#include "styles.h"
#include "dialogs.h"
#include "resource.h"
-#include "SciCall.h"
#include "../crypto/crypto.h"
#include "../uthash/utarray.h"
//#include "../uthash/utstring.h"
#include "helpers.h"
#include "edit.h"
+#include "SciCall.h"
#ifndef LCMAP_TITLECASE
#define LCMAP_TITLECASE 0x00000300 // Title Case Letters bit mask
@@ -64,6 +64,7 @@ extern DWORD dwLastIOError;
extern UINT cpLastFind;
extern BOOL bReplaceInitialized;
extern BOOL bUseOldStyleBraceMatching;
+extern BOOL bSkipUnicodeDetection;
static EDITFINDREPLACE efrSave;
static BOOL bSwitchedFindReplace = FALSE;
@@ -199,8 +200,8 @@ HWND EditCreate(HWND hwndParent)
SendMessage(hwnd,SCI_SETMOUSESELECTIONRECTANGULARSWITCH,TRUE,0);
SendMessage(hwnd,SCI_SETMULTIPLESELECTION,FALSE,0);
SendMessage(hwnd,SCI_SETADDITIONALSELECTIONTYPING,FALSE,0);
- SendMessage(hwnd,SCI_SETADDITIONALCARETSBLINK,FALSE,0);
- SendMessage(hwnd,SCI_SETADDITIONALCARETSVISIBLE,FALSE,0);
+ SendMessage(hwnd,SCI_SETADDITIONALCARETSBLINK,TRUE,0);
+ SendMessage(hwnd,SCI_SETADDITIONALCARETSVISIBLE,TRUE,0);
SendMessage(hwnd,SCI_SETVIRTUALSPACEOPTIONS, SCVS_NONE, 0);
SendMessage(hwnd,SCI_SETLAYOUTCACHE,SC_CACHE_PAGE,0);
@@ -367,7 +368,7 @@ BOOL EditConvertText(HWND hwnd, int encSource, int encDest, BOOL bSetSavePoint)
if (!(Encoding_IsValid(encSource) && Encoding_IsValid(encDest)))
return(FALSE);
- int length = SciCall_GetTextLength();
+ DocPos length = SciCall_GetTextLength();
if (length == 0)
{
@@ -514,8 +515,6 @@ BOOL EditIsRecodingNeeded(WCHAR* pszText, int cchLen)
//
// EditGetClipboardText()
//
-
-
char* EditGetClipboardText(HWND hwnd,BOOL bCheckEncoding,int* pLineCount,int* pLenLastLn) {
if (!IsClipboardFormatAvailable(CF_UNICODETEXT) || !OpenClipboard(GetParent(hwnd))) {
@@ -628,6 +627,69 @@ char* EditGetClipboardText(HWND hwnd,BOOL bCheckEncoding,int* pLineCount,int* pL
return (pmch);
}
+//=============================================================================
+//
+// EditPaste()
+//
+BOOL EditPaste(HWND hwnd, BOOL bSwapClipBoard)
+{
+ int lineCount = 0;
+ int lenLastLine = 0;
+
+ char* pClip = EditGetClipboardText(hwnd, !bSkipUnicodeDetection, &lineCount, &lenLastLine);
+ if (!pClip) {
+ return FALSE; // recoding canceled
+ }
+ const int clipLen = lstrlenA(pClip);
+
+ const int iCurPos = SciCall_GetCurrentPos();
+ const int iAnchorPos = SciCall_GetAnchor();
+ const BOOL bIsSelRect = SciCall_IsSelectionRectangle();
+ const BOOL bIsSelEmpty = SciCall_IsSelectionEmpty();
+
+ if (bIsSelRect)
+ {
+ EditEnterTargetTransaction();
+
+ const int selCount = (int)SendMessage(hwnd, SCI_GETSELECTIONS, 0, 0);
+
+ for (int s = 0; s < selCount; ++s)
+ {
+ const int selCaret = (int)SendMessage(hwnd, SCI_GETSELECTIONNCARET, (WPARAM)s, 0);
+ const int selAnchor = (int)SendMessage(hwnd, SCI_GETSELECTIONNANCHOR, (WPARAM)s, 0);
+ SciCall_SetTargetRange(selAnchor, selCaret);
+ SciCall_ReplaceTarget(clipLen, pClip);
+ }
+
+ EditLeaveTargetTransaction();
+ }
+ else if (bIsSelEmpty)
+ {
+ SciCall_Paste();
+ if (bSwapClipBoard) {
+ SciClearClipboard();
+ }
+ }
+ else {
+
+ if (bSwapClipBoard) {
+ SciCall_Copy();
+ }
+ SciCall_ReplaceSel(pClip);
+
+ if (bSwapClipBoard) {
+ if (iCurPos < iAnchorPos)
+ EditSelectEx(hwnd, iCurPos + clipLen, iCurPos);
+ else
+ EditSelectEx(hwnd, iAnchorPos, iAnchorPos + clipLen);
+ }
+ else if (iCurPos < iAnchorPos)
+ EditSelectEx(hwnd, iCurPos, iCurPos);
+ }
+
+ LocalFree(pClip);
+ return TRUE;
+}
//=============================================================================
@@ -638,7 +700,7 @@ BOOL EditCopyAppend(HWND hwnd)
{
if (!IsClipboardFormatAvailable(CF_UNICODETEXT)) {
SendMessage(hwnd,SCI_COPY,0,0);
- return(TRUE);
+ return TRUE;
}
int iCurPos = (int)SendMessage(hwnd,SCI_GETCURRENTPOS,0,0);
@@ -648,7 +710,7 @@ BOOL EditCopyAppend(HWND hwnd)
if (iCurPos != iAnchorPos) {
if (SciCall_IsSelectionRectangle()) {
MsgBox(MBWARN, IDS_SELRECT);
- return(FALSE);
+ return FALSE;
}
else {
int iSelLength = (int)SendMessage(hwnd, SCI_GETSELTEXT, 0, 0);
@@ -680,7 +742,7 @@ BOOL EditCopyAppend(HWND hwnd)
if (!OpenClipboard(GetParent(hwnd))) {
LocalFree(pszTextW);
- return(FALSE);
+ return FALSE;
}
HANDLE hOld = GetClipboardData(CF_UNICODETEXT);
@@ -700,7 +762,7 @@ BOOL EditCopyAppend(HWND hwnd)
SetClipboardData(CF_UNICODETEXT,hNew);
CloseClipboard();
- return(TRUE);
+ return TRUE;
}
@@ -1079,10 +1141,10 @@ BOOL EditSaveFile(
// strip trailing blanks
if (bAutoStripBlanks)
- EditStripTrailingBlanks(hwnd,TRUE);
+ EditStripLastCharacter(hwnd, TRUE, TRUE);
// get text
- cbData = SciCall_GetTextLength();
+ cbData = (DWORD)SciCall_GetTextLength();
lpData = GlobalAlloc(GPTR, cbData + 4); //fix: +bom
SendMessage(hwnd,SCI_GETTEXT,GlobalSize(lpData),(LPARAM)lpData);
@@ -1622,10 +1684,10 @@ void EditChar2Hex(HWND hwnd) {
return;
}
- const int iCurPos = SciCall_GetCurrentPos();
- const int iAnchorPos = SciCall_GetAnchor();
- const int iSelStart = SciCall_GetSelectionStart();
- int iSelEnd = SciCall_GetSelectionEnd();
+ const DocPos iCurPos = SciCall_GetCurrentPos();
+ const DocPos iAnchorPos = SciCall_GetAnchor();
+ const DocPos iSelStart = SciCall_GetSelectionStart();
+ DocPos iSelEnd = SciCall_GetSelectionEnd();
if (iCurPos == iAnchorPos) {
iSelEnd = SciCall_PositionAfter(iCurPos);
@@ -3107,7 +3169,7 @@ void EditPadWithSpaces(HWND hwnd,BOOL bSkipEmpty,BOOL bNoUndoGroup)
for (iLine = iLineStart; iLine <= iLineEnd; iLine++) {
int iPos = SciCall_GetLineSelEndPosition(iLine);
- if (iPos != INVALID_POSITION) {
+ if (iPos != (DocPos)(INVALID_POSITION)) {
int iCol = SciCall_GetColumn(iPos);
iMaxColumn = max(iMaxColumn, iCol);
}
@@ -3131,7 +3193,7 @@ void EditPadWithSpaces(HWND hwnd,BOOL bSkipEmpty,BOOL bNoUndoGroup)
for (iLine = iLineStart; iLine <= iLineEnd; iLine++) {
const int iLineSelEndPos = SciCall_GetLineSelEndPosition(iLine);
- if (bIsRectangular && (INVALID_POSITION == iLineSelEndPos))
+ if (bIsRectangular && ((DocPos)(INVALID_POSITION) == iLineSelEndPos))
continue;
const int iPos = SciCall_GetLineEndPosition(iLine);
@@ -3221,13 +3283,11 @@ void EditStripFirstCharacter(HWND hwnd)
IgnoreNotifyChangeEvent();
EditEnterTargetTransaction();
- int chCnt = 0;
for (int iLine = iLineStart; iLine <= iLineEnd; ++iLine) {
const int 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)"");
- ++chCnt;
}
}
@@ -3240,12 +3300,12 @@ void EditStripFirstCharacter(HWND hwnd)
//
// EditStripLastCharacter()
//
-void EditStripLastCharacter(HWND hwnd)
+void EditStripLastCharacter(HWND hwnd, BOOL bIgnoreSelection, BOOL bTrailingBlanksOnly)
{
int iSelStart = 0;
int iSelEnd = 0;
- if (SciCall_IsSelectionEmpty()) {
+ if (SciCall_IsSelectionEmpty() || bIgnoreSelection) {
iSelEnd = SciCall_GetTextLength();
}
else {
@@ -3260,51 +3320,6 @@ void EditStripLastCharacter(HWND hwnd)
const int iLineStart = SciCall_LineFromPosition(iSelStart);
const int iLineEnd = SciCall_LineFromPosition(iSelEnd);
- IgnoreNotifyChangeEvent();
- EditEnterTargetTransaction();
-
- for (int iLine = iLineStart; iLine <= iLineEnd; ++iLine)
- {
- const int iStartPos = SciCall_PositionFromLine(iLine);
- const int iEndPos = SciCall_GetLineEndPosition(iLine);
- if (iStartPos < iEndPos)
- {
- SendMessage(hwnd, SCI_SETTARGETRANGE, (WPARAM)SciCall_PositionBefore(iEndPos), (LPARAM)iEndPos);
- SendMessage(hwnd, SCI_REPLACETARGET, 0, (LPARAM)"");
- }
- }
-
- EditLeaveTargetTransaction();
- ObserveNotifyChangeEvent();
-}
-
-
-//=============================================================================
-//
-// EditStripTrailingBlanks()
-//
-void EditStripTrailingBlanks(HWND hwnd, BOOL bIgnoreSelection)
-{
-
- int iSelStart = 0;
- int iSelEnd = 0;
-
- if (bIgnoreSelection || SciCall_IsSelectionEmpty()) {
- iSelEnd = SciCall_GetTextLength();
- }
- else {
- if (SciCall_IsSelectionRectangle()) {
- MsgBox(MBWARN, IDS_SELRECT);
- return;
- }
- iSelStart = SciCall_GetSelectionStart();
- iSelEnd = SciCall_GetSelectionEnd();
- }
-
- const int iLineStart = SciCall_LineFromPosition(iSelStart);
- const int iLineEnd = SciCall_LineFromPosition(iSelEnd);
-
-
IgnoreNotifyChangeEvent();
EditEnterTargetTransaction();
@@ -3313,22 +3328,33 @@ void EditStripTrailingBlanks(HWND hwnd, BOOL bIgnoreSelection)
const int iStartPos = SciCall_PositionFromLine(iLine);
const int iEndPos = SciCall_GetLineEndPosition(iLine);
- int i = iEndPos;
- char ch = '\0';
- do {
- ch = SciCall_GetCharAt(--i);
- } while ((i >= iStartPos) && ((ch == ' ') || (ch == '\t')));
+ 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, "");
+ }
- if ((i + 1) < iEndPos) {
- SendMessage(hwnd, SCI_SETTARGETRANGE, (WPARAM)(i + 1), (LPARAM)iEndPos);
- SendMessage(hwnd, SCI_REPLACETARGET, 0, (LPARAM)"");
}
}
EditLeaveTargetTransaction();
ObserveNotifyChangeEvent();
+ UNUSED(hwnd);
}
+
//=============================================================================
//
// EditCompressSpaces()
@@ -3370,10 +3396,9 @@ void EditCompressSpaces(HWND hwnd)
bIsLineEnd = (iSelEndPos == SciCall_GetLineEndPosition(iLineEnd));
}
- int remWSuntilCaretPos = 0;
-
if (pszIn && pszOut) {
char* co = (char*)pszOut;
+ int remWSuntilCaretPos = 0;
for (int i = 0; i < cch; ++i) {
if (pszIn[i] == ' ' || pszIn[i] == '\t') {
if (pszIn[i] == '\t') { bModified = TRUE; }
@@ -4091,7 +4116,7 @@ void EditSortLines(HWND hwnd, int iSortFlags)
void EditSelectEx(HWND hwnd, int iAnchorPos, int iCurrentPos)
{
if ((iAnchorPos < 0) && (iCurrentPos < 0)) {
- SendMessage(hwnd, SCI_SELECTALL, 0, 0);
+ SciCall_SelectAll();
}
else if (iAnchorPos < 0) {
iAnchorPos = 0;
@@ -4113,9 +4138,10 @@ void EditSelectEx(HWND hwnd, int iAnchorPos, int iCurrentPos)
SciCall_ScrollRange(iCurrentPos, iAnchorPos);
// remember x-pos for moving caret vertically
- SendMessage(hwnd, SCI_CHOOSECARETX, 0, 0);
+ SciCall_ChooseCaret();
UpdateStatusbar();
+ UNUSED(hwnd);
}
@@ -5594,8 +5620,6 @@ int EditReplaceAllInRange(HWND hwnd, LPCEDITFINDREPLACE lpefr, BOOL bShowInfo, i
{
posPair.beg = start;
posPair.end = end;
-
-
utarray_push_back(ReplPosUTArray, &posPair);
start = end;
@@ -6881,133 +6905,86 @@ void EditSetBookmarkList(HWND hwnd, LPCWSTR pszBookMarks)
extern BOOL bNoEncodingTags;
extern int fNoFileVariables;
-BOOL FileVars_Init(char *lpData,DWORD cbData,LPFILEVARS lpfv) {
-
+void __fastcall SetFileVars(char* lpData, char* tch, LPFILEVARS lpfv)
+{
int i;
- char tch[LARGE_BUFFER];
- BOOL bDisableFileVariables = FALSE;
-
- ZeroMemory(lpfv,sizeof(FILEVARS));
- if ((fNoFileVariables && bNoEncodingTags) || !lpData || !cbData)
- return(TRUE);
-
- StringCchCopyNA(tch,COUNTOF(tch),lpData,min(cbData + 1,COUNTOF(tch)));
+ BOOL bDisableFileVar = FALSE;
if (!fNoFileVariables) {
- if (FileVars_ParseInt(tch,"enable-local-variables",&i) && (!i))
- bDisableFileVariables = TRUE;
- if (!bDisableFileVariables) {
+ if (FileVars_ParseInt(tch, "enable-local-variables", &i) && (!i))
+ bDisableFileVar = TRUE;
- if (FileVars_ParseInt(tch,"tab-width",&i)) {
- lpfv->iTabWidth = max(min(i,256),1);
+ if (!bDisableFileVar) {
+
+ if (FileVars_ParseInt(tch, "tab-width", &i)) {
+ lpfv->iTabWidth = max(min(i, 256), 1);
lpfv->mask |= FV_TABWIDTH;
}
- if (FileVars_ParseInt(tch,"c-basic-indent",&i)) {
- lpfv->iIndentWidth = max(min(i,256),0);
+ if (FileVars_ParseInt(tch, "c-basic-indent", &i)) {
+ lpfv->iIndentWidth = max(min(i, 256), 0);
lpfv->mask |= FV_INDENTWIDTH;
}
- if (FileVars_ParseInt(tch,"indent-tabs-mode",&i)) {
+ if (FileVars_ParseInt(tch, "indent-tabs-mode", &i)) {
lpfv->bTabsAsSpaces = (i) ? FALSE : TRUE;
lpfv->mask |= FV_TABSASSPACES;
}
- if (FileVars_ParseInt(tch,"c-tab-always-indent",&i)) {
+ if (FileVars_ParseInt(tch, "c-tab-always-indent", &i)) {
lpfv->bTabIndents = (i) ? TRUE : FALSE;
lpfv->mask |= FV_TABINDENTS;
}
- if (FileVars_ParseInt(tch,"truncate-lines",&i)) {
+ if (FileVars_ParseInt(tch, "truncate-lines", &i)) {
lpfv->fWordWrap = (i) ? FALSE : TRUE;
lpfv->mask |= FV_WORDWRAP;
}
- if (FileVars_ParseInt(tch,"fill-column",&i)) {
- lpfv->iLongLinesLimit = max(min(i,4096),0);
+ if (FileVars_ParseInt(tch, "fill-column", &i)) {
+ lpfv->iLongLinesLimit = max(min(i, 4096), 0);
lpfv->mask |= FV_LONGLINESLIMIT;
}
}
}
- if (!IsUTF8Signature(lpData) && !bNoEncodingTags && !bDisableFileVariables) {
+ if (!IsUTF8Signature(lpData) && !bNoEncodingTags && !bDisableFileVar) {
- if (FileVars_ParseStr(tch,"encoding",lpfv->tchEncoding,COUNTOF(lpfv->tchEncoding)))
+ if (FileVars_ParseStr(tch, "encoding", lpfv->tchEncoding, COUNTOF(lpfv->tchEncoding)))
lpfv->mask |= FV_ENCODING;
- else if (FileVars_ParseStr(tch,"charset",lpfv->tchEncoding,COUNTOF(lpfv->tchEncoding)))
+ else if (FileVars_ParseStr(tch, "charset", lpfv->tchEncoding, COUNTOF(lpfv->tchEncoding)))
lpfv->mask |= FV_ENCODING;
- else if (FileVars_ParseStr(tch,"coding",lpfv->tchEncoding,COUNTOF(lpfv->tchEncoding)))
+ else if (FileVars_ParseStr(tch, "coding", lpfv->tchEncoding, COUNTOF(lpfv->tchEncoding)))
lpfv->mask |= FV_ENCODING;
}
- if (!fNoFileVariables && !bDisableFileVariables) {
- if (FileVars_ParseStr(tch,"mode",lpfv->tchMode,COUNTOF(lpfv->tchMode)))
+ if (!fNoFileVariables && !bDisableFileVar) {
+ if (FileVars_ParseStr(tch, "mode", lpfv->tchMode, COUNTOF(lpfv->tchMode)))
lpfv->mask |= FV_MODE;
}
+}
+
+BOOL FileVars_Init(char *lpData, DWORD cbData, LPFILEVARS lpfv) {
+
+ char tch[LARGE_BUFFER];
+
+ ZeroMemory(lpfv,sizeof(FILEVARS));
+ if ((fNoFileVariables && bNoEncodingTags) || !lpData || !cbData)
+ return TRUE;
+
+ StringCchCopyNA(tch,COUNTOF(tch),lpData,min(cbData + 1,COUNTOF(tch)));
+ SetFileVars(lpData, tch, lpfv);
if (lpfv->mask == 0 && cbData > COUNTOF(tch)) {
-
StringCchCopyNA(tch,COUNTOF(tch),lpData + cbData - COUNTOF(tch) + 1,COUNTOF(tch));
-
- if (!fNoFileVariables) {
- if (FileVars_ParseInt(tch,"enable-local-variables",&i) && (!i))
- bDisableFileVariables = TRUE;
-
- if (!bDisableFileVariables) {
-
- if (FileVars_ParseInt(tch,"tab-width",&i)) {
- lpfv->iTabWidth = max(min(i,256),1);
- lpfv->mask |= FV_TABWIDTH;
- }
-
- if (FileVars_ParseInt(tch,"c-basic-indent",&i)) {
- lpfv->iIndentWidth = max(min(i,256),0);
- lpfv->mask |= FV_INDENTWIDTH;
- }
-
- if (FileVars_ParseInt(tch,"indent-tabs-mode",&i)) {
- lpfv->bTabsAsSpaces = (i) ? FALSE : TRUE;
- lpfv->mask |= FV_TABSASSPACES;
- }
-
- if (FileVars_ParseInt(tch,"c-tab-always-indent",&i)) {
- lpfv->bTabIndents = (i) ? TRUE : FALSE;
- lpfv->mask |= FV_TABINDENTS;
- }
-
- if (FileVars_ParseInt(tch,"truncate-lines",&i)) {
- lpfv->fWordWrap = (i) ? FALSE : TRUE;
- lpfv->mask |= FV_WORDWRAP;
- }
-
- if (FileVars_ParseInt(tch,"fill-column",&i)) {
- lpfv->iLongLinesLimit = max(min(i,4096),0);
- lpfv->mask |= FV_LONGLINESLIMIT;
- }
- }
- }
-
- if (!IsUTF8Signature(lpData) && !bNoEncodingTags && !bDisableFileVariables) {
-
- if (FileVars_ParseStr(tch,"encoding",lpfv->tchEncoding,COUNTOF(lpfv->tchEncoding)))
- lpfv->mask |= FV_ENCODING;
- else if (FileVars_ParseStr(tch,"charset",lpfv->tchEncoding,COUNTOF(lpfv->tchEncoding)))
- lpfv->mask |= FV_ENCODING;
- else if (FileVars_ParseStr(tch,"coding",lpfv->tchEncoding,COUNTOF(lpfv->tchEncoding)))
- lpfv->mask |= FV_ENCODING;
- }
-
- if (!fNoFileVariables && !bDisableFileVariables) {
- if (FileVars_ParseStr(tch,"mode",lpfv->tchMode,COUNTOF(lpfv->tchMode)))
- lpfv->mask |= FV_MODE;
- }
+ SetFileVars(lpData, tch, lpfv);
}
if (lpfv->mask & FV_ENCODING)
lpfv->iEncoding = Encoding_MatchA(lpfv->tchEncoding);
- return(TRUE);
+ return TRUE;
}
diff --git a/src/Edit.h b/src/Edit.h
index fb4732151..24d10503a 100644
--- a/src/Edit.h
+++ b/src/Edit.h
@@ -20,11 +20,6 @@
BOOL Scintilla_RegisterClasses(void*);
BOOL Scintilla_ReleaseResources();
-
-//typedef Sci_Position tPos;
-typedef ptrdiff_t tPos;
-
-
#define FNDRPL_BUFFER 512
typedef struct _editfindreplace
{
@@ -63,6 +58,7 @@ BOOL EditConvertText(HWND,int,int,BOOL);
BOOL EditSetNewEncoding(HWND,int,BOOL,BOOL);
BOOL EditIsRecodingNeeded(WCHAR*,int);
char* EditGetClipboardText(HWND,BOOL,int*,int*);
+BOOL EditPaste(HWND,BOOL);
BOOL EditCopyAppend(HWND);
int EditDetectEOLMode(HWND,char*,DWORD);
BOOL EditLoadFile(HWND,LPCWSTR,BOOL,int*,int*,BOOL*,BOOL*,BOOL*);
@@ -94,8 +90,7 @@ void EditEncloseSelection(HWND,LPCWSTR,LPCWSTR);
void EditToggleLineComments(HWND,LPCWSTR,BOOL);
void EditPadWithSpaces(HWND,BOOL,BOOL);
void EditStripFirstCharacter(HWND);
-void EditStripLastCharacter(HWND);
-void EditStripTrailingBlanks(HWND,BOOL);
+void EditStripLastCharacter(HWND,BOOL,BOOL);
void EditCompressSpaces(HWND);
void EditRemoveBlankLines(HWND,BOOL);
void EditWrapToColumn(HWND,int);
diff --git a/src/Notepad3.c b/src/Notepad3.c
index 671e13442..98413ddb1 100644
--- a/src/Notepad3.c
+++ b/src/Notepad3.c
@@ -40,12 +40,12 @@
#include "edit.h"
#include "styles.h"
#include "dialogs.h"
-#include "SciCall.h"
#include "resource.h"
#include "../crypto/crypto.h"
#include "../uthash/utarray.h"
#include "helpers.h"
#include "notepad3.h"
+#include "SciCall.h"
/******************************************************************************
@@ -1133,6 +1133,57 @@ LRESULT CALLBACK MainWndProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam)
}
+
+//
+// SetWordWrapping() - WordWrapSettings
+//
+void __fastcall SetWordWrapping()
+{
+ // Word wrap
+ if (bWordWrap)
+ SendMessage(g_hwndEdit, SCI_SETWRAPMODE, (iWordWrapMode == 0) ? SC_WRAP_WHITESPACE : SC_WRAP_CHAR, 0);
+ else
+ SendMessage(g_hwndEdit, SCI_SETWRAPMODE, SC_WRAP_NONE, 0);
+
+ if (iWordWrapIndent == 5)
+ SendMessage(g_hwndEdit, SCI_SETWRAPINDENTMODE, SC_WRAPINDENT_SAME, 0);
+ else if (iWordWrapIndent == 6)
+ SendMessage(g_hwndEdit, SCI_SETWRAPINDENTMODE, SC_WRAPINDENT_INDENT, 0);
+ else {
+ int i = 0;
+ switch (iWordWrapIndent) {
+ case 1: i = 1; break;
+ case 2: i = 2; break;
+ case 3: i = (iIndentWidth) ? 1 * iIndentWidth : 1 * iTabWidth; break;
+ case 4: i = (iIndentWidth) ? 2 * iIndentWidth : 2 * iTabWidth; break;
+ }
+ SendMessage(g_hwndEdit, SCI_SETWRAPSTARTINDENT, i, 0);
+ SendMessage(g_hwndEdit, SCI_SETWRAPINDENTMODE, SC_WRAPINDENT_FIXED, 0);
+ }
+
+ if (bShowWordWrapSymbols) {
+ int wrapVisualFlags = 0;
+ int wrapVisualFlagsLocation = 0;
+ if (iWordWrapSymbols == 0)
+ iWordWrapSymbols = 22;
+ switch (iWordWrapSymbols % 10) {
+ case 1: wrapVisualFlags |= SC_WRAPVISUALFLAG_END; wrapVisualFlagsLocation |= SC_WRAPVISUALFLAGLOC_END_BY_TEXT; break;
+ case 2: wrapVisualFlags |= SC_WRAPVISUALFLAG_END; break;
+ }
+ switch (((iWordWrapSymbols % 100) - (iWordWrapSymbols % 10)) / 10) {
+ case 1: wrapVisualFlags |= SC_WRAPVISUALFLAG_START; wrapVisualFlagsLocation |= SC_WRAPVISUALFLAGLOC_START_BY_TEXT; break;
+ case 2: wrapVisualFlags |= SC_WRAPVISUALFLAG_START; break;
+ }
+ SendMessage(g_hwndEdit, SCI_SETWRAPVISUALFLAGSLOCATION, wrapVisualFlagsLocation, 0);
+ SendMessage(g_hwndEdit, SCI_SETWRAPVISUALFLAGS, wrapVisualFlags, 0);
+ }
+ else {
+ SendMessage(g_hwndEdit, SCI_SETWRAPVISUALFLAGS, 0, 0);
+ }
+}
+
+
+
//=============================================================================
//
// MsgCreate() - Handles WM_CREATE
@@ -1161,46 +1212,8 @@ LRESULT MsgCreate(HWND hwnd,WPARAM wParam,LPARAM lParam)
// Indent Guides
Style_SetIndentGuides(g_hwndEdit,bShowIndentGuides);
- // Word wrap
- if (!bWordWrap)
- SendMessage(g_hwndEdit,SCI_SETWRAPMODE,SC_WRAP_NONE,0);
- else
- SendMessage(g_hwndEdit,SCI_SETWRAPMODE,(iWordWrapMode == 0) ? SC_WRAP_WHITESPACE : SC_WRAP_CHAR,0);
-
- if (iWordWrapIndent == 5)
- SendMessage(g_hwndEdit,SCI_SETWRAPINDENTMODE,SC_WRAPINDENT_SAME,0);
- else if (iWordWrapIndent == 6)
- SendMessage(g_hwndEdit,SCI_SETWRAPINDENTMODE,SC_WRAPINDENT_INDENT,0);
- else {
- int i = 0;
- switch (iWordWrapIndent) {
- case 1: i = 1; break;
- case 2: i = 2; break;
- case 3: i = (iIndentWidth) ? 1 * iIndentWidth : 1 * iTabWidth; break;
- case 4: i = (iIndentWidth) ? 2 * iIndentWidth : 2 * iTabWidth; break;
- }
- SendMessage(g_hwndEdit,SCI_SETWRAPSTARTINDENT,i,0);
- SendMessage(g_hwndEdit,SCI_SETWRAPINDENTMODE,SC_WRAPINDENT_FIXED,0);
- }
- if (bShowWordWrapSymbols) {
- int wrapVisualFlags = 0;
- int wrapVisualFlagsLocation = 0;
- if (iWordWrapSymbols == 0)
- iWordWrapSymbols = 22;
- switch (iWordWrapSymbols%10) {
- case 1: wrapVisualFlags |= SC_WRAPVISUALFLAG_END; wrapVisualFlagsLocation |= SC_WRAPVISUALFLAGLOC_END_BY_TEXT; break;
- case 2: wrapVisualFlags |= SC_WRAPVISUALFLAG_END; break;
- }
- switch (((iWordWrapSymbols%100)-(iWordWrapSymbols%10))/10) {
- case 1: wrapVisualFlags |= SC_WRAPVISUALFLAG_START; wrapVisualFlagsLocation |= SC_WRAPVISUALFLAGLOC_START_BY_TEXT; break;
- case 2: wrapVisualFlags |= SC_WRAPVISUALFLAG_START; break;
- }
- SendMessage(g_hwndEdit,SCI_SETWRAPVISUALFLAGSLOCATION,wrapVisualFlagsLocation,0);
- SendMessage(g_hwndEdit,SCI_SETWRAPVISUALFLAGS,wrapVisualFlags,0);
- }
- else {
- SendMessage(g_hwndEdit,SCI_SETWRAPVISUALFLAGS,0,0);
- }
+ // Word Wrap
+ SetWordWrapping();
// Long Lines
if (bMarkLongLines)
@@ -2407,8 +2420,6 @@ LRESULT MsgSysCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
//
LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
{
- BOOL bSwapClipBoard = FALSE;
-
switch(LOWORD(wParam))
{
case IDC_MAIN_MARKALL_OCC:
@@ -2884,7 +2895,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
bLastCopyFromMe = TRUE;
int token = BeginUndoAction();
- if (!SendMessage(g_hwndEdit, SCI_GETSELECTIONEMPTY, 0, 0))
+ if (!SciCall_IsSelectionEmpty())
{
SendMessage(g_hwndEdit, SCI_CUT, 0, 0);
}
@@ -2912,7 +2923,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
{
if (flagPasteBoard)
bLastCopyFromMe = TRUE;
- SendMessage(g_hwndEdit,SCI_COPYRANGE,0,SendMessage(g_hwndEdit,SCI_GETLENGTH,0,0));
+ SendMessage(g_hwndEdit,SCI_COPYRANGE,0,(LPARAM)SciCall_GetTextLength());
UpdateToolbar();
}
break;
@@ -2927,64 +2938,32 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
}
break;
-
- case IDM_EDIT_SWAP:
- bSwapClipBoard = TRUE;
case IDM_EDIT_PASTE:
{
- int lineCount = 0;
- int lenLastLine = 0;
- char *pClip = EditGetClipboardText(g_hwndEdit,!bSkipUnicodeDetection,&lineCount,&lenLastLine);
- if (!pClip)
- break; // recoding canceled
-
- int iCurrPos = (int)SendMessage(g_hwndEdit, SCI_GETCURRENTPOS, 0, 0);
- int iAnchor = iCurrPos;
-
+ if (flagPasteBoard)
+ bLastCopyFromMe = TRUE;
int token = BeginUndoAction();
-
- if (SendMessage(g_hwndEdit,SCI_GETSELECTIONEMPTY,0,0))
- {
- SendMessage(g_hwndEdit, SCI_PASTE, 0, 0);
-
- if (bSwapClipBoard)
- SendMessage(g_hwndEdit, SCI_COPYTEXT, 0, (LPARAM)NULL);
-
- iCurrPos = (int)SendMessage(g_hwndEdit, SCI_GETCURRENTPOS, 0, 0);
- }
- else {
-
- iAnchor = (int)SendMessage(g_hwndEdit, SCI_GETANCHOR, 0, 0);
-
- if (flagPasteBoard)
- bLastCopyFromMe = TRUE;
-
- if (bSwapClipBoard)
- SendMessage(g_hwndEdit,SCI_COPY,0,0);
-
- SendMessage(g_hwndEdit,SCI_REPLACESEL,0,(LPARAM)pClip);
- }
-
- if (bSwapClipBoard) {
- if (iCurrPos > iAnchor)
- SendMessage(g_hwndEdit, SCI_SETSEL, iAnchor, iAnchor + lstrlenA(pClip));
- else
- SendMessage(g_hwndEdit, SCI_SETSEL, iCurrPos + lstrlenA(pClip), iCurrPos);
- }
-
+ EditPaste(g_hwndEdit, FALSE);
EndUndoAction(token);
-
- LocalFree(pClip);
-
UpdateToolbar();
UpdateStatusbar();
- SendMessage(g_hwndEdit, SCI_CHOOSECARETX, 0, 0);
}
break;
+ case IDM_EDIT_SWAP:
+ {
+ if (flagPasteBoard)
+ bLastCopyFromMe = TRUE;
+ int token = BeginUndoAction();
+ EditPaste(g_hwndEdit, TRUE);
+ EndUndoAction(token);
+ UpdateToolbar();
+ UpdateStatusbar();
+ }
+ break;
case IDM_EDIT_CLEARCLIPBOARD:
- SendMessage(g_hwndEdit, SCI_COPYTEXT, 0, (LPARAM)NULL);
+ SciClearClipboard();
UpdateToolbar();
UpdateStatusbar();
break;
@@ -3241,7 +3220,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
{
BeginWaitCursor(NULL);
int token = BeginUndoAction();
- EditStripLastCharacter(g_hwndEdit);
+ EditStripLastCharacter(g_hwndEdit, FALSE, FALSE);
EndUndoAction(token);
EndWaitCursor();
}
@@ -3252,7 +3231,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
{
BeginWaitCursor(NULL);
int token = BeginUndoAction();
- EditStripTrailingBlanks(g_hwndEdit, FALSE);
+ EditStripLastCharacter(g_hwndEdit, FALSE, TRUE);
EndUndoAction(token);
EndWaitCursor();
}
@@ -4043,48 +4022,18 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_VIEW_WORDWRAPSETTINGS:
- if (WordWrapSettingsDlg(hwnd,IDD_WORDWRAP,&iWordWrapIndent))
- {
- if (bWordWrap)
- SendMessage(g_hwndEdit,SCI_SETWRAPMODE,(iWordWrapMode == 0) ? SC_WRAP_WHITESPACE : SC_WRAP_CHAR,0);
- if (iWordWrapIndent == 5)
- SendMessage(g_hwndEdit,SCI_SETWRAPINDENTMODE,SC_WRAPINDENT_SAME,0);
- else if (iWordWrapIndent == 6)
- SendMessage(g_hwndEdit,SCI_SETWRAPINDENTMODE,SC_WRAPINDENT_INDENT,0);
- else {
- int i = 0;
- switch (iWordWrapIndent) {
- case 1: i = 1; break;
- case 2: i = 2; break;
- case 3: i = (iIndentWidth) ? 1 * iIndentWidth : 1 * iTabWidth; break;
- case 4: i = (iIndentWidth) ? 2 * iIndentWidth : 2 * iTabWidth; break;
- }
- SendMessage(g_hwndEdit,SCI_SETWRAPSTARTINDENT,i,0);
- SendMessage(g_hwndEdit,SCI_SETWRAPINDENTMODE,SC_WRAPINDENT_FIXED,0);
- }
- if (bShowWordWrapSymbols) {
- int wrapVisualFlags = 0;
- int wrapVisualFlagsLocation = 0;
- if (iWordWrapSymbols == 0)
- iWordWrapSymbols = 22;
- switch (iWordWrapSymbols%10) {
- case 1: wrapVisualFlags |= SC_WRAPVISUALFLAG_END; wrapVisualFlagsLocation |= SC_WRAPVISUALFLAGLOC_END_BY_TEXT; break;
- case 2: wrapVisualFlags |= SC_WRAPVISUALFLAG_END; break;
- }
- switch (((iWordWrapSymbols%100)-(iWordWrapSymbols%10))/10) {
- case 1: wrapVisualFlags |= SC_WRAPVISUALFLAG_START; wrapVisualFlagsLocation |= SC_WRAPVISUALFLAGLOC_START_BY_TEXT; break;
- case 2: wrapVisualFlags |= SC_WRAPVISUALFLAG_START; break;
- }
- SendMessage(g_hwndEdit,SCI_SETWRAPVISUALFLAGSLOCATION,wrapVisualFlagsLocation,0);
- SendMessage(g_hwndEdit,SCI_SETWRAPVISUALFLAGS,wrapVisualFlags,0);
- }
- else {
- SendMessage(g_hwndEdit,SCI_SETWRAPVISUALFLAGS,0,0);
- }
+ if (WordWrapSettingsDlg(hwnd,IDD_WORDWRAP,&iWordWrapIndent)) {
+ SetWordWrapping();
}
break;
+ case IDM_VIEW_WORDWRAPSYMBOLS:
+ bShowWordWrapSymbols = (bShowWordWrapSymbols) ? FALSE : TRUE;
+ SetWordWrapping();
+ break;
+
+
case IDM_VIEW_LONGLINEMARKER:
bMarkLongLines = (bMarkLongLines) ? FALSE: TRUE;
if (bMarkLongLines) {
@@ -4249,30 +4198,6 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
break;
- case IDM_VIEW_WORDWRAPSYMBOLS:
- bShowWordWrapSymbols = (bShowWordWrapSymbols) ? 0 : 1;
- if (bShowWordWrapSymbols) {
- int wrapVisualFlags = 0;
- int wrapVisualFlagsLocation = 0;
- if (iWordWrapSymbols == 0)
- iWordWrapSymbols = 22;
- switch (iWordWrapSymbols%10) {
- case 1: wrapVisualFlags |= SC_WRAPVISUALFLAG_END; wrapVisualFlagsLocation |= SC_WRAPVISUALFLAGLOC_END_BY_TEXT; break;
- case 2: wrapVisualFlags |= SC_WRAPVISUALFLAG_END; break;
- }
- switch (((iWordWrapSymbols%100)-(iWordWrapSymbols%10))/10) {
- case 1: wrapVisualFlags |= SC_WRAPVISUALFLAG_START; wrapVisualFlagsLocation |= SC_WRAPVISUALFLAGLOC_START_BY_TEXT; break;
- case 2: wrapVisualFlags |= SC_WRAPVISUALFLAG_START; break;
- }
- SendMessage(g_hwndEdit,SCI_SETWRAPVISUALFLAGSLOCATION,wrapVisualFlagsLocation,0);
- SendMessage(g_hwndEdit,SCI_SETWRAPVISUALFLAGS,wrapVisualFlags,0);
- }
- else {
- SendMessage(g_hwndEdit,SCI_SETWRAPVISUALFLAGS,0,0);
- }
- break;
-
-
case IDM_VIEW_MATCHBRACES:
bMatchBraces = (bMatchBraces) ? FALSE : TRUE;
if (bMatchBraces)
@@ -4610,25 +4535,15 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_CLEAR:
case CMD_DEL:
{
- if (SciCall_IsSelectionEmpty()) {
- SendMessage(g_hwndEdit, SCI_CLEAR, 0, 0);
- }
- else {
- int token = BeginUndoAction();
- SendMessage(g_hwndEdit, SCI_CLEAR, 0, 0);
- // possible unexpected behavior on Virtual Space Access, so:
- const int iPos = SciCall_GetCurrentPos();
- SendMessage(g_hwndEdit, SCI_SETSEL, iPos, iPos);
- EndUndoAction(token);
- }
+ int token = BeginUndoAction();
+ SciCall_Clear();
+ EndUndoAction(token);
}
break;
case CMD_BACK:
- if ((BOOL)SendMessage(g_hwndEdit, SCI_GETSELECTIONEMPTY, 0, 0))
- SendMessage(g_hwndEdit, SCI_DELETEBACK, 0, 0);
- else {
+ {
int token = BeginUndoAction();
SendMessage(g_hwndEdit, SCI_DELETEBACK, 0, 0);
EndUndoAction(token);
@@ -5735,8 +5650,8 @@ LRESULT MsgNotify(HWND hwnd,WPARAM wParam,LPARAM lParam)
case SCN_NEEDSHOWN:
{
- int iFirstLine = SciCall_LineFromPosition(scn->position);
- int iLastLine = SciCall_LineFromPosition(scn->position + scn->length - 1);
+ DocLn iFirstLine = SciCall_LineFromPosition((DocPos)scn->position);
+ DocLn iLastLine = SciCall_LineFromPosition((DocPos)(scn->position + scn->length - 1));
for (int i = iFirstLine; i <= iLastLine; ++i) { SciCall_EnsureVisible(i); }
}
break;
@@ -5744,7 +5659,7 @@ LRESULT MsgNotify(HWND hwnd,WPARAM wParam,LPARAM lParam)
case SCN_MARGINCLICK:
if (scn->margin == MARGIN_FOLD_INDEX) {
- EditFoldClick(SciCall_LineFromPosition(scn->position), scn->modifiers);
+ EditFoldClick(SciCall_LineFromPosition((DocPos)scn->position), scn->modifiers);
}
break;
@@ -7408,22 +7323,17 @@ int BeginUndoAction()
UndoRedoSelection_t sel = { -1, -1, -1, -1, -1, 0, 0, 0, 0, 0 };
sel.selMode = (int)SendMessage(g_hwndEdit,SCI_GETSELECTIONMODE,0,0);
sel.rectSelVS = (int)SendMessage(g_hwndEdit,SCI_GETVIRTUALSPACEOPTIONS,0,0);
-
- sel.anchorPos_undo = (int)SendMessage(g_hwndEdit, SCI_GETANCHOR, 0, 0);
- sel.currPos_undo = (int)SendMessage(g_hwndEdit, SCI_GETCURRENTPOS, 0, 0);
-
- if (!(BOOL)SendMessage(g_hwndEdit, SCI_GETSELECTIONEMPTY, 0, 0)) {
- if (sel.selMode == SC_SEL_LINES) {
- sel.anchorPos_undo = (int)SendMessage(g_hwndEdit, SCI_GETSELECTIONSTART, 0, 0);
- sel.currPos_undo = (int)SendMessage(g_hwndEdit, SCI_GETSELECTIONEND, 0, 0);
- }
- else if (sel.selMode == SC_SEL_RECTANGLE) {
- sel.anchorPos_undo = (int)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONANCHOR, 0, 0);
- sel.currPos_undo = (int)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONCARET, 0, 0);
- if ((sel.rectSelVS & SCVS_RECTANGULARSELECTION) != 0) {
- sel.anchorVS_undo = (int)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE, 0, 0);
- sel.currVS_undo = (int)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE, 0, 0);
- }
+ if ((sel.selMode == SC_SEL_STREAM) || (sel.selMode == SC_SEL_LINES)) {
+ sel.anchorPos_undo = SciCall_GetAnchor();
+ sel.currPos_undo = SciCall_GetCurrentPos();
+ }
+ else // SC_SEL_RECTANGLE | SC_SEL_THIN
+ {
+ sel.anchorPos_undo = (int)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONANCHOR, 0, 0);
+ sel.currPos_undo = (int)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONCARET, 0, 0);
+ if ((sel.rectSelVS & SCVS_RECTANGULARSELECTION) != 0) {
+ sel.anchorVS_undo = (int)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE, 0, 0);
+ sel.currVS_undo = (int)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE, 0, 0);
}
}
token = UndoRedoActionMap(-1, &sel);
@@ -7445,24 +7355,18 @@ void EndUndoAction(int token)
{
if (token >= 0) {
UndoRedoSelection_t sel = { -1, -1, -1, -1, -1, 0, 0, 0, 0, 0 };
- if (UndoRedoActionMap(token,&sel) >= 0) {
- // mode and type should not have changed
-
- sel.anchorPos_redo = (int)SendMessage(g_hwndEdit, SCI_GETANCHOR, 0, 0);
- sel.currPos_redo = (int)SendMessage(g_hwndEdit, SCI_GETCURRENTPOS, 0, 0);
-
- if (!(BOOL)SendMessage(g_hwndEdit, SCI_GETSELECTIONEMPTY, 0, 0)) {
- if (sel.selMode == SC_SEL_LINES) {
- sel.anchorPos_redo = (int)SendMessage(g_hwndEdit, SCI_GETSELECTIONSTART, 0, 0);
- sel.currPos_redo = (int)SendMessage(g_hwndEdit, SCI_GETSELECTIONEND, 0, 0);
- }
- else if (sel.selMode == SC_SEL_RECTANGLE) {
- sel.anchorPos_redo = (int)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONANCHOR, 0, 0);
- sel.currPos_redo = (int)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONCARET, 0, 0);
- if ((sel.rectSelVS & SCVS_RECTANGULARSELECTION) != 0) {
- sel.anchorVS_redo = (int)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE, 0, 0);
- sel.currVS_redo = (int)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE, 0, 0);
- }
+ if (UndoRedoActionMap(token, &sel) >= 0) {
+ if ((sel.selMode == SC_SEL_STREAM) || (sel.selMode == SC_SEL_LINES)) {
+ sel.anchorPos_redo = SciCall_GetAnchor();
+ sel.currPos_redo = SciCall_GetCurrentPos();
+ }
+ else // SC_SEL_RECTANGLE | SC_SEL_THIN
+ {
+ sel.anchorPos_redo = (int)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONANCHOR, 0, 0);
+ sel.currPos_redo = (int)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONCARET, 0, 0);
+ if ((sel.rectSelVS & SCVS_RECTANGULARSELECTION) != 0) {
+ sel.anchorVS_redo = (int)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE, 0, 0);
+ sel.currVS_redo = (int)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE, 0, 0);
}
}
}
@@ -7480,27 +7384,31 @@ void EndUndoAction(int token)
void RestoreAction(int token, DoAction doAct)
{
UndoRedoSelection_t sel = { -1, -1, -1, -1, -1, 0, 0, 0, 0, 0 };
- if (UndoRedoActionMap(token,&sel) >= 0) {
+ if (UndoRedoActionMap(token,&sel) >= 0)
+ {
+ const int anchorPos = (doAct == UNDO ? sel.anchorPos_undo : sel.anchorPos_redo);
+ const int currPos = (doAct == UNDO ? sel.currPos_undo : sel.currPos_redo);
+
+ const int anchorPosLine = SciCall_LineFromPosition(anchorPos);
+ const int currPosLine = SciCall_LineFromPosition(currPos);
+ //const int currRectType = (int)SendMessage(g_hwndEdit, SCI_GETVIRTUALSPACEOPTIONS, 0, 0);
+
// we are inside undo/redo transaction, so do delayed PostMessage() instead of SendMessage()
- int anchorPos = (doAct == UNDO ? sel.anchorPos_undo : sel.anchorPos_redo);
- int currPos = (doAct == UNDO ? sel.currPos_undo : sel.currPos_redo);
- int anchorPosLine = (int)SendMessage(g_hwndEdit, SCI_LINEFROMPOSITION, anchorPos, 0);
- int currPosLine = (int)SendMessage(g_hwndEdit, SCI_LINEFROMPOSITION, currPos, 0);
+ #define ISSUE_MESSAGE PostMessage
+
// Ensure that the first and last lines of a selection are always unfolded
// This needs to be done _before_ the SCI_SETSEL message
- SendMessage(g_hwndEdit, SCI_ENSUREVISIBLE, anchorPosLine, 0);
- if (anchorPosLine != currPosLine) { SendMessage(g_hwndEdit, SCI_ENSUREVISIBLE, currPosLine, 0); }
- int currRectType = (int)SendMessage(g_hwndEdit,SCI_GETVIRTUALSPACEOPTIONS,0,0);
-
- #define ISSUE_MESSAGE PostMessage
+ ISSUE_MESSAGE(g_hwndEdit, SCI_ENSUREVISIBLE, anchorPosLine, 0);
+ if (anchorPosLine != currPosLine) { ISSUE_MESSAGE(g_hwndEdit, SCI_ENSUREVISIBLE, currPosLine, 0); }
ISSUE_MESSAGE(g_hwndEdit,SCI_SETSELECTIONMODE,(WPARAM)sel.selMode,0);
ISSUE_MESSAGE(g_hwndEdit,SCI_SETVIRTUALSPACEOPTIONS,(WPARAM)sel.rectSelVS,0);
- if (sel.selMode == SC_SEL_LINES) {
- ISSUE_MESSAGE(g_hwndEdit,SCI_SETSELECTIONSTART,(WPARAM)anchorPos,0);
- ISSUE_MESSAGE(g_hwndEdit,SCI_SETSELECTIONEND,(WPARAM)currPos,0);
+ if ((sel.selMode == SC_SEL_STREAM) || (sel.selMode == SC_SEL_LINES)) {
+ ISSUE_MESSAGE(g_hwndEdit,SCI_SETANCHOR,(WPARAM)anchorPos,0);
+ ISSUE_MESSAGE(g_hwndEdit,SCI_SETCURRENTPOS,(WPARAM)currPos,0);
}
- else if (sel.selMode == SC_SEL_RECTANGLE) {
+ else // SC_SEL_RECTANGLE | SC_SEL_THIN
+ {
ISSUE_MESSAGE(g_hwndEdit, SCI_SETRECTANGULARSELECTIONANCHOR, (WPARAM)anchorPos, 0);
ISSUE_MESSAGE(g_hwndEdit, SCI_SETRECTANGULARSELECTIONCARET, (WPARAM)currPos, 0);
if ((sel.rectSelVS & SCVS_RECTANGULARSELECTION) != 0) {
@@ -7510,14 +7418,10 @@ void RestoreAction(int token, DoAction doAct)
ISSUE_MESSAGE(g_hwndEdit, SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE, (WPARAM)currVS, 0);
}
}
- else {
- ISSUE_MESSAGE(g_hwndEdit, SCI_SETSEL, (LPARAM)anchorPos, (WPARAM)currPos);
- ISSUE_MESSAGE(g_hwndEdit, SCI_SCROLLRANGE, (LPARAM)anchorPos, (WPARAM)currPos);
- }
- ISSUE_MESSAGE(g_hwndEdit,SCI_SETVIRTUALSPACEOPTIONS,(WPARAM)currRectType,0);
+ //ISSUE_MESSAGE(g_hwndEdit,SCI_SETVIRTUALSPACEOPTIONS,(WPARAM)currRectType,0);
ISSUE_MESSAGE(g_hwndEdit, SCI_CANCEL, 0, 0);
- #undef ISSUE_MASSAGE
+ #undef ISSUE_MASSAGE
}
}
@@ -7528,7 +7432,6 @@ void RestoreAction(int token, DoAction doAct)
// UndoSelectionMap()
//
//
-
int UndoRedoActionMap(int token, UndoRedoSelection_t* selection)
{
if (UndoRedoSelectionUTArray == NULL)
diff --git a/src/Notepad3.vcxproj b/src/Notepad3.vcxproj
index a5edf2131..1260b882f 100644
--- a/src/Notepad3.vcxproj
+++ b/src/Notepad3.vcxproj
@@ -106,7 +106,10 @@
Level4
false
true
-
+ true
+ StreamingSIMDExtensions2
+ Fast
+ stdcpp17
msimg32.lib;comctl32.lib;imm32.lib;shlwapi.lib;scintilla.lib;%(AdditionalDependencies)
@@ -156,9 +159,10 @@
MultiThreadedDebug
Level4
false
-
-
true
+ true
+ Fast
+ stdcpp17
msimg32.lib;comctl32.lib;imm32.lib;shlwapi.lib;scintilla.lib;%(AdditionalDependencies)
@@ -200,13 +204,16 @@
..\scintilla\include;..\scintilla\lexlib;..\scintilla\src;%(AdditionalIncludeDirectories)
true
- MaxSpeed
+ Full
WIN32;STATIC_BUILD;SCI_LEXER;NDEBUG;%(PreprocessorDefinitions)
MultiThreaded
Level4
None
-
true
+ true
+ StreamingSIMDExtensions2
+ Fast
+ stdcpp17
msimg32.lib;comctl32.lib;imm32.lib;shlwapi.lib;scintilla.lib;%(AdditionalDependencies)
@@ -251,12 +258,15 @@
..\scintilla\include;..\scintilla\lexlib;..\scintilla\src;%(AdditionalIncludeDirectories)
true
- MaxSpeed
+ Full
_WIN64;STATIC_BUILD;SCI_LEXER;NDEBUG;%(PreprocessorDefinitions)
MultiThreaded
Level4
None
true
+ true
+ Fast
+ stdcpp17
msimg32.lib;comctl32.lib;imm32.lib;shlwapi.lib;scintilla.lib;%(AdditionalDependencies)
diff --git a/src/SciCall.h b/src/SciCall.h
index 364b56b96..8715e9a21 100644
--- a/src/SciCall.h
+++ b/src/SciCall.h
@@ -20,6 +20,19 @@
#ifndef _NP3_SCICALL_H_
#define _NP3_SCICALL_H_
+#include
+#include "Sci_Position.h"
+
+#if defined(SCI_LARGE_FILE_SUPPORT)
+typedef Sci_Position DocPos;
+typedef Sci_PositionCR DocPosCR;
+typedef int DocLn; // Sci_Line?
+#else
+typedef int DocPos;
+//typedef ptrdiff_t DocPos; // compile test
+typedef long DocPosCR;
+typedef int DocLn;
+#endif
//=============================================================================
//
@@ -32,7 +45,6 @@ __forceinline void InitScintillaHandle(HWND hwnd) {
g_hScintilla = (HANDLE)SendMessage(hwnd, SCI_GETDIRECTPOINTER, 0, 0);
}
-
//=============================================================================
//
// SciCall()
@@ -41,7 +53,6 @@ __forceinline void InitScintillaHandle(HWND hwnd) {
LRESULT WINAPI Scintilla_DirectFunction(HANDLE, UINT, WPARAM, LPARAM);
#define SciCall(m, w, l) Scintilla_DirectFunction(g_hScintilla, m, w, l)
-
//=============================================================================
//
// DeclareSciCall[RV][0-2] Macros
@@ -63,6 +74,7 @@ __forceinline ret SciCall_##fn(type1 var1) { \
__forceinline ret SciCall_##fn(type1 var1, type2 var2) { \
return((ret)SciCall(SCI_##msg, (WPARAM)(var1), (LPARAM)(var2))); \
}
+
#define DeclareSciCallV0(fn, msg) \
__forceinline LRESULT SciCall_##fn() { \
return(SciCall(SCI_##msg, 0, 0)); \
@@ -71,6 +83,10 @@ __forceinline LRESULT SciCall_##fn() { \
__forceinline LRESULT SciCall_##fn(type1 var1) { \
return(SciCall(SCI_##msg, (WPARAM)(var1), 0)); \
}
+#define DeclareSciCallV01(fn, msg, type2, var2) \
+__forceinline LRESULT SciCall_##fn(type2 var2) { \
+ return(SciCall(SCI_##msg, 0, (LPARAM)(var2))); \
+}
#define DeclareSciCallV2(fn, msg, type1, var1, type2, var2) \
__forceinline LRESULT SciCall_##fn(type1 var1, type2 var2) { \
return(SciCall(SCI_##msg, (WPARAM)(var1), (LPARAM)(var2))); \
@@ -82,44 +98,50 @@ __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(GetCurrentPos, GETCURRENTPOS, int);
-DeclareSciCallR0(GetAnchor, GETANCHOR, int);
+DeclareSciCallR0(IsDocModified, GETMODIFY, bool);
+DeclareSciCallR0(IsSelectionEmpty, GETSELECTIONEMPTY, bool);
+DeclareSciCallR0(IsSelectionRectangle, SELECTIONISRECTANGLE, bool);
+
+DeclareSciCallR0(GetCurrentPos, GETCURRENTPOS, DocPos);
+DeclareSciCallR0(GetAnchor, GETANCHOR, DocPos);
DeclareSciCallR0(GetSelectionMode, GETSELECTIONMODE, int);
-DeclareSciCallR0(GetSelectionStart, GETSELECTIONSTART, int);
-DeclareSciCallR0(GetSelectionEnd, GETSELECTIONEND, int);
-DeclareSciCallR1(GetLineSelStartPosition, GETLINESELSTARTPOSITION, int, Sci_Position, line);
-DeclareSciCallR1(GetLineSelEndPosition, GETLINESELENDPOSITION, int, Sci_Position, line);
+DeclareSciCallR0(GetSelectionStart, GETSELECTIONSTART, DocPos);
+DeclareSciCallR0(GetSelectionEnd, GETSELECTIONEND, DocPos);
+DeclareSciCallR1(GetLineSelStartPosition, GETLINESELSTARTPOSITION, DocPos, DocPos, line);
+DeclareSciCallR1(GetLineSelEndPosition, GETLINESELENDPOSITION, DocPos, DocPos, line);
-DeclareSciCallV2(SetSel, SETSEL, Sci_Position, anchorPos, Sci_Position, currentPos);
-DeclareSciCallV2(ScrollRange, SCROLLRANGE, Sci_Position, secondaryPos, Sci_Position, primaryPos);
DeclareSciCallV0(Clear, CLEAR);
-DeclareSciCallV2(SetTargetRange, SETTARGETRANGE, int, start, int, end);
+DeclareSciCallV0(Copy, COPY);
+DeclareSciCallV0(Paste, PASTE);
+DeclareSciCallV2(CopyText, COPYTEXT, DocPos, length, LPCCH, text);
+DeclareSciCallV2(SetSel, SETSEL, DocPos, anchorPos, DocPos, currentPos);
+DeclareSciCallV0(SelectAll, SELECTALL);
+DeclareSciCallV2(SetTargetRange, SETTARGETRANGE, DocPos, start, DocPos, end);
DeclareSciCallV0(TargetFromSelection, TARGETFROMSELECTION);
+DeclareSciCallV01(ReplaceSel, REPLACESEL, LPCCH, text);
+DeclareSciCallV2(ReplaceTarget, REPLACETARGET, DocPos, length, LPCCH, text);
-DeclareSciCallV1(SetAnchor, SETANCHOR, Sci_Position, position);
-DeclareSciCallV1(SetCurrentPos, SETCURRENTPOS, Sci_Position, position);
-DeclareSciCallV1(GotoPos, GOTOPOS, Sci_Position, position);
-DeclareSciCallV1(GotoLine, GOTOLINE, Sci_Position, line);
-DeclareSciCallR1(PositionBefore, POSITIONBEFORE, int, Sci_Position, position);
-DeclareSciCallR1(PositionAfter, POSITIONAFTER, int, Sci_Position, position);
-DeclareSciCallR1(GetCharAt, GETCHARAT, char, Sci_Position, position);
+DeclareSciCallV1(SetAnchor, SETANCHOR, DocPos, position);
+DeclareSciCallV1(SetCurrentPos, SETCURRENTPOS, DocPos, position);
+DeclareSciCallV1(GotoPos, GOTOPOS, DocPos, position);
+DeclareSciCallV1(GotoLine, GOTOLINE, DocPos, 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, int);
-DeclareSciCallR0(GetTextLength, GETTEXTLENGTH, int);
-DeclareSciCallR1(LineLength, LINELENGTH, int, Sci_Position, line);
-DeclareSciCallR1(LineFromPosition, LINEFROMPOSITION, int, Sci_Position, position);
-DeclareSciCallR1(PositionFromLine, POSITIONFROMLINE, int, int, line);
-DeclareSciCallR1(GetLineEndPosition, GETLINEENDPOSITION, int, int, line);
-DeclareSciCallR1(GetColumn, GETCOLUMN, int, Sci_Position, position);
-DeclareSciCallR0(LinesOnScreen, LINESONSCREEN, int);
-DeclareSciCallR0(GetFirstVisibleLine, GETFIRSTVISIBLELINE, int);
-DeclareSciCallR1(DocLineFromVisible, DOCLINEFROMVISIBLE, int, Sci_Position, line);
+DeclareSciCallR0(GetLineCount, GETLINECOUNT, DocLn);
+DeclareSciCallR0(GetTextLength, GETTEXTLENGTH, DocPos);
+DeclareSciCallR1(LineLength, LINELENGTH, DocPos, DocPos, 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);
+DeclareSciCallR0(LinesOnScreen, LINESONSCREEN, DocLn);
+DeclareSciCallR0(GetFirstVisibleLine, GETFIRSTVISIBLELINE, DocLn);
+DeclareSciCallR1(DocLineFromVisible, DOCLINEFROMVISIBLE, DocLn, DocLn, line);
-DeclareSciCallR2(GetRangePointer, GETRANGEPOINTER, LPCCH, Sci_Position, start, Sci_Position, length);
+DeclareSciCallR2(GetRangePointer, GETRANGEPOINTER, LPCCH, DocPos, start, DocPos, length);
DeclareSciCallR0(GetCharacterPointer, GETCHARACTERPOINTER, LPCCH);
@@ -129,9 +151,11 @@ DeclareSciCallR0(GetCharacterPointer, GETCHARACTERPOINTER, LPCCH);
// Scrolling and automatic scrolling
//
//
+DeclareSciCallV0(ChooseCaret, CHOOSECARETX);
DeclareSciCallV0(ScrollCaret, SCROLLCARET);
DeclareSciCallV2(SetXCaretPolicy, SETXCARETPOLICY, int, caretPolicy, int, caretSlop);
DeclareSciCallV2(SetYCaretPolicy, SETYCARETPOLICY, int, caretPolicy, int, caretSlop);
+DeclareSciCallV2(ScrollRange, SCROLLRANGE, DocPos, secondaryPos, DocPos, primaryPos);
//=============================================================================
@@ -141,8 +165,8 @@ DeclareSciCallV2(SetYCaretPolicy, SETYCARETPOLICY, int, caretPolicy, int, caretS
//
DeclareSciCallR1(StyleGetFore, STYLEGETFORE, COLORREF, int, styleNumber);
DeclareSciCallR1(StyleGetBack, STYLEGETBACK, COLORREF, int, styleNumber);
-DeclareSciCallV2(SetStyling, SETSTYLING, Sci_PositionCR, length, int, style);
-DeclareSciCallV1(StartStyling, STARTSTYLING, Sci_Position, position);
+DeclareSciCallV2(SetStyling, SETSTYLING, DocPosCR, length, int, style);
+DeclareSciCallV1(StartStyling, STARTSTYLING, DocPos, position);
DeclareSciCallR0(GetEndStyled, GETENDSTYLED, int);
//=============================================================================
@@ -153,9 +177,9 @@ DeclareSciCallR0(GetEndStyled, GETENDSTYLED, int);
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(SetFoldMarginColour, SETFOLDMARGINCOLOUR, BOOL, useSetting, COLORREF, colour);
-DeclareSciCallV2(SetFoldMarginHiColour, SETFOLDMARGINHICOLOUR, BOOL, useSetting, COLORREF, colour);
+DeclareSciCallV2(SetMarginSensitive, SETMARGINSENSITIVEN, int, margin, bool, sensitive);
+DeclareSciCallV2(SetFoldMarginColour, SETFOLDMARGINCOLOUR, bool, useSetting, COLORREF, colour);
+DeclareSciCallV2(SetFoldMarginHiColour, SETFOLDMARGINHICOLOUR, bool, useSetting, COLORREF, colour);
//=============================================================================
@@ -173,8 +197,8 @@ DeclareSciCallV2(MarkerSetBack, MARKERSETBACK, int, markerNumber, COLORREF, colo
// Indicators
//
//
-DeclareSciCallR2(IndicatorValueAt, INDICATORVALUEAT, int, int, indicatorID, Sci_Position, position);
-DeclareSciCallV2(IndicatorFillRange, INDICATORFILLRANGE, Sci_Position, position, Sci_Position, length);
+DeclareSciCallR2(IndicatorValueAt, INDICATORVALUEAT, int, int, indicatorID, DocPos, position);
+DeclareSciCallV2(IndicatorFillRange, INDICATORFILLRANGE, DocPos, position, DocPos, length);
//=============================================================================
@@ -182,7 +206,7 @@ DeclareSciCallV2(IndicatorFillRange, INDICATORFILLRANGE, Sci_Position, position,
// Folding
//
//
-DeclareSciCallR1(GetLineVisible, GETLINEVISIBLE, BOOL, int, line);
+DeclareSciCallR1(GetLineVisible, GETLINEVISIBLE, bool, int, line);
DeclareSciCallR1(GetFoldLevel, GETFOLDLEVEL, int, int, line);
DeclareSciCallV1(SetFoldFlags, SETFOLDFLAGS, int, flags);
DeclareSciCallR1(GetFoldParent, GETFOLDPARENT, int, int, line);
@@ -204,7 +228,7 @@ DeclareSciCallV2(SetProperty, SETPROPERTY, const char *, key, const char *, valu
// SetTechnology
//
//
-DeclareSciCallV1(SetBufferedDraw, SETBUFFEREDDRAW, BOOL, value);
+DeclareSciCallV1(SetBufferedDraw, SETBUFFEREDDRAW, bool, value);
DeclareSciCallV1(SetTechnology, SETTECHNOLOGY, int, technology);
@@ -214,9 +238,10 @@ DeclareSciCallV1(SetTechnology, SETTECHNOLOGY, int, technology);
//
//
+#define SciClearClipboard() SciCall_CopyText(0, NULL)
+
#define IsSingleLineSelection() \
-(SciCall_LineFromPosition(SciCall_GetCurrentPos()) \
-== SciCall_LineFromPosition(SciCall_GetAnchor()))
+(SciCall_LineFromPosition(SciCall_GetCurrentPos()) == SciCall_LineFromPosition(SciCall_GetAnchor()))
#define GetEOLLen() ((SciCall_GetEOLMode() == SC_EOL_CRLF) ? 2 : 1)
diff --git a/src/Styles.c b/src/Styles.c
index 88a2e57f4..7d1c8d3e1 100644
--- a/src/Styles.c
+++ b/src/Styles.c
@@ -36,9 +36,9 @@
#include "edit.h"
#include "dialogs.h"
#include "resource.h"
-#include "SciCall.h"
#include "helpers.h"
#include "styles.h"
+#include "SciCall.h"
extern HINSTANCE g_hInstance;
@@ -3529,11 +3529,14 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew) {
}
if (StrStr(pCurrentStandard->Styles[STY_CARET].szValue,L"noblink")) {
SendMessage(hwnd,SCI_SETCARETPERIOD,(WPARAM)0,0);
+ SendMessage(hwnd, SCI_SETADDITIONALCARETSBLINK, FALSE, 0);
StringCchCat(wchSpecificStyle,COUNTOF(wchSpecificStyle),L"; noblink");
}
- else
- SendMessage(hwnd,SCI_SETCARETPERIOD,(WPARAM)GetCaretBlinkTime(),0);
-
+ else {
+ const UINT uCaretBlinkTime = GetCaretBlinkTime();
+ SendMessage(hwnd, SCI_SETCARETPERIOD, (WPARAM)uCaretBlinkTime, 0);
+ SendMessage(hwnd, SCI_SETADDITIONALCARETSBLINK, ((uCaretBlinkTime != 0) ? TRUE : FALSE), 0);
+ }
// caret fore
if (!Style_StrGetColor(TRUE,pCurrentStandard->Styles[STY_CARET].szValue,&rgb))
rgb = GetSysColor(COLOR_WINDOWTEXT);
@@ -3551,6 +3554,7 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew) {
SendMessage(hwnd,SCI_SETCARETFORE,rgb,0);
SendMessage(hwnd,SCI_SETADDITIONALCARETFORE,rgb,0);
+
StrTrimW(wchSpecificStyle, L" ;");
StringCchCopy(pCurrentStandard->Styles[STY_CARET].szValue,
COUNTOF(pCurrentStandard->Styles[STY_CARET].szValue),wchSpecificStyle);