diff --git a/Build/Notepad3.ini b/Build/Notepad3.ini
index 52c91feaa..54f5b11e6 100644
Binary files a/Build/Notepad3.ini and b/Build/Notepad3.ini differ
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/Dialogs.c b/src/Dialogs.c
index 1e0548d2e..2d2c849f1 100644
--- a/src/Dialogs.c
+++ b/src/Dialogs.c
@@ -2343,6 +2343,29 @@ INT_PTR CALLBACK InfoBoxDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam)
}
+
+//=============================================================================
+//
+// InfoBox()
+//
+//
+void UpdateCheck()
+{
+ SHELLEXECUTEINFO sei;
+ ZeroMemory(&sei, sizeof(SHELLEXECUTEINFO));
+ sei.cbSize = sizeof(SHELLEXECUTEINFO);
+ sei.fMask = SEE_MASK_NOZONECHECKS;
+ sei.hwnd = NULL;
+ sei.lpVerb = NULL;
+ sei.lpFile = VERSION_UPDATE_CHECK;
+ sei.lpParameters = NULL;
+ sei.lpDirectory = NULL;
+ sei.nShow = SW_SHOWNORMAL;
+ ShellExecuteEx(&sei);
+}
+
+
+
//=============================================================================
//
// InfoBox()
@@ -2352,33 +2375,29 @@ extern WCHAR szIniFile[MAX_PATH];
INT_PTR InfoBox(int iType,LPCWSTR lpstrSetting,int uidMessage,...)
{
-
- HWND hwnd;
- int idDlg = IDD_INFOBOX;
- INFOBOX ib;
- WCHAR wchFormat[LARGE_BUFFER];
- int iMode;
-
- iMode = IniGetInt(L"Suppressed Messages",lpstrSetting,0);
+ int iMode = IniGetInt(L"Suppressed Messages",lpstrSetting,0);
if (lstrlen(lpstrSetting) > 0 && iMode == 1)
return (iType == MBYESNO) ? IDYES : IDOK;
+ WCHAR wchFormat[LARGE_BUFFER];
if (!GetString(uidMessage,wchFormat,COUNTOF(wchFormat)))
return(-1);
+ INFOBOX ib;
ib.lpstrMessage = LocalAlloc(LPTR, HUGE_BUFFER * sizeof(WCHAR));
StringCchVPrintfW(ib.lpstrMessage,HUGE_BUFFER,wchFormat,(LPVOID)((PUINT_PTR)&uidMessage + 1));
ib.lpstrSetting = (LPWSTR)lpstrSetting;
ib.bDisableCheckBox = (StringCchLenW(szIniFile,COUNTOF(szIniFile)) == 0 || lstrlen(lpstrSetting) == 0 || iMode == 2) ? TRUE : FALSE;
+ int idDlg = IDD_INFOBOX;
if (iType == MBYESNO)
idDlg = IDD_INFOBOX2;
else if (iType == MBOKCANCEL)
idDlg = IDD_INFOBOX3;
HWND focus = GetFocus();
- hwnd = focus ? focus : g_hwndMain;
+ HWND hwnd = focus ? focus : g_hwndMain;
MessageBeep(MB_ICONEXCLAMATION);
diff --git a/src/Dialogs.h b/src/Dialogs.h
index 54d25498b..8b35944cd 100644
--- a/src/Dialogs.h
+++ b/src/Dialogs.h
@@ -41,6 +41,7 @@ BOOL SelectDefEncodingDlg(HWND,int *);
BOOL SelectEncodingDlg(HWND,int *);
BOOL RecodeDlg(HWND,int *);
BOOL SelectDefLineEndingDlg(HWND,int *);
+void UpdateCheck();
INT_PTR InfoBox(int,LPCWSTR,int,...);
diff --git a/src/Edit.c b/src/Edit.c
index 084554b50..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);
@@ -3238,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 {
@@ -3258,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();
@@ -3311,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()
@@ -4088,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;
@@ -4110,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);
}
@@ -6876,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..ee2480d0e 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"
/******************************************************************************
@@ -64,41 +64,48 @@ HWND hDlgFindReplace = NULL;
#define INISECTIONBUFCNT 32
#define NUMTOOLBITMAPS 25
-#define NUMINITIALTOOLS 24
+#define NUMINITIALTOOLS 30
#define MARGIN_FOLD_INDEX 2
-TBBUTTON tbbMainWnd[] = { {0,IDT_FILE_NEW,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0},
- {1,IDT_FILE_OPEN,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0},
- {2,IDT_FILE_BROWSE,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0},
- {3,IDT_FILE_SAVE,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0},
- {0,0,0,TBSTYLE_SEP,0,0},
- {4,IDT_EDIT_UNDO,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0},
- {5,IDT_EDIT_REDO,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0},
- {0,0,0,TBSTYLE_SEP,0,0},
- {6,IDT_EDIT_CUT,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0},
- {7,IDT_EDIT_COPY,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0},
- {8,IDT_EDIT_PASTE,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0},
- {0,0,0,TBSTYLE_SEP,0,0},
- {9,IDT_EDIT_FIND,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0},
- {10,IDT_EDIT_REPLACE,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0},
- {0,0,0,TBSTYLE_SEP,0,0},
- {11,IDT_VIEW_WORDWRAP,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0},
- {0,0,0,TBSTYLE_SEP,0,0},
- {12,IDT_VIEW_ZOOMIN,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0},
- {13,IDT_VIEW_ZOOMOUT,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0},
- {0,0,0,TBSTYLE_SEP,0,0},
- {14,IDT_VIEW_SCHEME,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0},
- {15,IDT_VIEW_SCHEMECONFIG,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0},
- {0,0,0,TBSTYLE_SEP,0,0},
- {16,IDT_FILE_EXIT,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0},
- {17,IDT_FILE_SAVEAS,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0},
- {18,IDT_FILE_SAVECOPY,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0},
- {19,IDT_EDIT_CLEAR,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0},
- {20,IDT_FILE_PRINT,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0},
- {21,IDT_FILE_OPENFAV,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0},
- {22,IDT_FILE_ADDTOFAV,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0},
- {23,IDT_VIEW_TOGGLEFOLDS,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0},
- {24,IDT_FILE_LAUNCH,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0} };
+TBBUTTON tbbMainWnd[] = { { 0,IDT_FILE_NEW,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 },
+ { 1,IDT_FILE_OPEN,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 },
+ { 3,IDT_FILE_SAVE,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 },
+ { 2,IDT_FILE_BROWSE,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 },
+ { 0,0,0,TBSTYLE_SEP,0,0 },
+ { 4,IDT_EDIT_UNDO,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 },
+ { 5,IDT_EDIT_REDO,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 },
+ { 0,0,0,TBSTYLE_SEP,0,0 },
+ { 6,IDT_EDIT_CUT,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 },
+ { 7,IDT_EDIT_COPY,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 },
+ { 8,IDT_EDIT_PASTE,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 },
+ { 0,0,0,TBSTYLE_SEP,0,0 },
+ { 9,IDT_EDIT_FIND,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 },
+ { 10,IDT_EDIT_REPLACE,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 },
+ { 0,0,0,TBSTYLE_SEP,0,0 },
+ { 11,IDT_VIEW_WORDWRAP,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 },
+ { 0,0,0,TBSTYLE_SEP,0,0 },
+ { 23,IDT_VIEW_TOGGLEFOLDS,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 },
+ { 0,0,0,TBSTYLE_SEP,0,0 },
+ { 21,IDT_FILE_OPENFAV,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 },
+ { 22,IDT_FILE_ADDTOFAV,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 },
+ { 0,0,0,TBSTYLE_SEP,0,0 },
+ { 12,IDT_VIEW_ZOOMIN,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 },
+ { 13,IDT_VIEW_ZOOMOUT,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 },
+ { 0,0,0,TBSTYLE_SEP,0,0 },
+ { 14,IDT_VIEW_SCHEME,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 },
+ { 0,0,0,TBSTYLE_SEP,0,0 },
+ { 24,IDT_FILE_LAUNCH,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 },
+ { 0,0,0,TBSTYLE_SEP,0,0 },
+ { 16,IDT_FILE_EXIT,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 },
+ { 0,0,0,TBSTYLE_SEP,0,0 },
+ { 15,IDT_VIEW_SCHEMECONFIG,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 },
+ { 0,0,0,TBSTYLE_SEP,0,0 },
+ { 17,IDT_FILE_SAVEAS,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 },
+ { 18,IDT_FILE_SAVECOPY,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 },
+ { 19,IDT_EDIT_CLEAR,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 },
+ { 20,IDT_FILE_PRINT,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 }
+};
+
WCHAR szIniFile[MAX_PATH] = { L'\0' };
WCHAR szIniFile2[MAX_PATH] = { L'\0' };
@@ -1133,6 +1140,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 +1219,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)
@@ -1470,8 +1490,10 @@ void CreateBars(HWND hwnd,HINSTANCE hInstance)
SendMessage(hwndToolbar,TB_GETEXTENDEDSTYLE,0,0) | TBSTYLE_EX_MIXEDBUTTONS);
SendMessage(hwndToolbar,TB_ADDBUTTONS,NUMINITIALTOOLS,(LPARAM)tbbMainWnd);
- if (Toolbar_SetButtons(hwndToolbar,IDT_FILE_NEW,tchToolbarButtons,tbbMainWnd,COUNTOF(tbbMainWnd)) == 0)
- SendMessage(hwndToolbar,TB_ADDBUTTONS,NUMINITIALTOOLS,(LPARAM)tbbMainWnd);
+
+ if (Toolbar_SetButtons(hwndToolbar, IDT_FILE_NEW, tchToolbarButtons, tbbMainWnd, COUNTOF(tbbMainWnd)) == 0) {
+ SendMessage(hwndToolbar, TB_ADDBUTTONS, NUMINITIALTOOLS, (LPARAM)tbbMainWnd);
+ }
SendMessage(hwndToolbar,TB_GETITEMRECT,0,(LPARAM)&rc);
//SendMessage(hwndToolbar,TB_SETINDENT,2,0);
@@ -2407,8 +2429,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 +2904,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 +2932,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 +2947,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 +3229,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 +3240,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 +4031,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 +4207,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 +4544,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);
@@ -4833,12 +4757,18 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
break;
+ case IDM_HELP_UPDATECHECK:
+ UpdateCheck();
+ break;
+
+
case CMD_WEBACTION1:
case CMD_WEBACTION2:
{
+ WCHAR szCmdTemplate[256] = { L'\0' };
+
LPWSTR lpszTemplateName = (LOWORD(wParam) == CMD_WEBACTION1) ? L"WebTemplate1" : L"WebTemplate2";
- WCHAR szCmdTemplate[256] = { L'\0' };
BOOL bCmdEnabled = IniGetString(L"Settings2",lpszTemplateName,L"",szCmdTemplate,COUNTOF(szCmdTemplate));
if (bCmdEnabled) {
@@ -5735,8 +5665,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 +5674,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;
@@ -5806,8 +5736,9 @@ LRESULT MsgNotify(HWND hwnd,WPARAM wParam,LPARAM lParam)
case TBN_RESET:
{
int i; int c = (int)SendMessage(hwndToolbar,TB_BUTTONCOUNT,0,0);
- for (i = 0; i < c; i++)
- SendMessage(hwndToolbar,TB_DELETEBUTTON,0,0);
+ for (i = 0; i < c; i++) {
+ SendMessage(hwndToolbar, TB_DELETEBUTTON, 0, 0);
+ }
SendMessage(hwndToolbar,TB_ADDBUTTONS,NUMINITIALTOOLS,(LPARAM)tbbMainWnd);
return(0);
}
@@ -6104,7 +6035,9 @@ void LoadSettings()
bTransparentModeAvailable = (GetProcAddress(GetModuleHandle(L"User32"),"SetLayeredWindowAttributes") != NULL);
bTransparentModeAvailable = (bTransparentModeAvailable) ? TRUE : FALSE;
- IniSectionGetString(pIniSection,L"ToolbarButtons",L"",tchToolbarButtons,COUNTOF(tchToolbarButtons));
+ IniSectionGetString(pIniSection,L"ToolbarButtons",
+ // see TBBUTTON tbbMainWnd[] for initial/reset set of buttons
+ L"1 2 4 3 0 5 6 0 7 8 9 0 10 11 0 12 0 24 0 22 23 0 13 14 0 15 0 25 0 17", tchToolbarButtons,COUNTOF(tchToolbarButtons));
bShowToolbar = IniSectionGetBool(pIniSection,L"ShowToolbar",TRUE);
@@ -7405,25 +7338,21 @@ void InvalidateSelections()
int BeginUndoAction()
{
int token = -1;
- 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);
+ UndoRedoSelection_t sel = { -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0 };
+ sel.selMode_undo = (int)SendMessage(g_hwndEdit,SCI_GETSELECTIONMODE,0,0);
+ sel.rectSelVS_undo = (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_undo == SC_SEL_STREAM) || (sel.selMode_undo == SC_SEL_LINES)) {
+ sel.anchorPos_undo = SciCall_GetAnchor();
+ sel.curPos_undo = SciCall_GetCurrentPos();
+ }
+ else // SC_SEL_RECTANGLE | SC_SEL_THIN
+ {
+ sel.anchorPos_undo = (int)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONANCHOR, 0, 0);
+ sel.curPos_undo = (int)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONCARET, 0, 0);
+ if ((sel.rectSelVS_undo & SCVS_RECTANGULARSELECTION) != 0) {
+ sel.anchorVS_undo = (int)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE, 0, 0);
+ sel.curVS_undo = (int)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE, 0, 0);
}
}
token = UndoRedoActionMap(-1, &sel);
@@ -7444,25 +7373,23 @@ int BeginUndoAction()
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
+ UndoRedoSelection_t sel = { -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0 };
+ if (UndoRedoActionMap(token, &sel) >= 0) {
- sel.anchorPos_redo = (int)SendMessage(g_hwndEdit, SCI_GETANCHOR, 0, 0);
- sel.currPos_redo = (int)SendMessage(g_hwndEdit, SCI_GETCURRENTPOS, 0, 0);
+ sel.selMode_redo = (int)SendMessage(g_hwndEdit, SCI_GETSELECTIONMODE, 0, 0);
+ sel.rectSelVS_redo = (int)SendMessage(g_hwndEdit, SCI_GETVIRTUALSPACEOPTIONS, 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 ((sel.selMode_redo == SC_SEL_STREAM) || (sel.selMode_redo == SC_SEL_LINES)) {
+ sel.anchorPos_redo = SciCall_GetAnchor();
+ sel.curPos_redo = SciCall_GetCurrentPos();
+ }
+ else // SC_SEL_RECTANGLE | SC_SEL_THIN
+ {
+ sel.anchorPos_redo = (int)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONANCHOR, 0, 0);
+ sel.curPos_redo = (int)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONCARET, 0, 0);
+ if ((sel.rectSelVS_redo & SCVS_RECTANGULARSELECTION) != 0) {
+ sel.anchorVS_redo = (int)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE, 0, 0);
+ sel.curVS_redo = (int)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE, 0, 0);
}
}
}
@@ -7479,46 +7406,45 @@ 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) {
+ UndoRedoSelection_t sel = { -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0 };
+ if (UndoRedoActionMap(token,&sel) >= 0)
+ {
+ const int anchorPos = (doAct == UNDO ? sel.anchorPos_undo : sel.anchorPos_redo);
+ const int currPos = (doAct == UNDO ? sel.curPos_undo : sel.curPos_redo);
+
// 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);
+ const int anchorPosLine = SciCall_LineFromPosition(anchorPos);
+ const int currPosLine = SciCall_LineFromPosition(currPos);
+ ISSUE_MESSAGE(g_hwndEdit, SCI_ENSUREVISIBLE, anchorPosLine, 0);
+ if (anchorPosLine != currPosLine) { ISSUE_MESSAGE(g_hwndEdit, SCI_ENSUREVISIBLE, currPosLine, 0); }
- #define ISSUE_MESSAGE PostMessage
+ const int selectionMode = (doAct == UNDO ? sel.selMode_undo : sel.selMode_redo);
+ ISSUE_MESSAGE(g_hwndEdit,SCI_SETSELECTIONMODE,(WPARAM)selectionMode,0);
+ const int virtualSpaceOpt = (doAct == UNDO ? sel.rectSelVS_undo : sel.rectSelVS_redo);
+ ISSUE_MESSAGE(g_hwndEdit,SCI_SETVIRTUALSPACEOPTIONS,(WPARAM)virtualSpaceOpt,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 ((selectionMode == SC_SEL_STREAM) || (selectionMode == 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) {
+ if ((virtualSpaceOpt & SCVS_RECTANGULARSELECTION) != 0) {
int anchorVS = (doAct == UNDO ? sel.anchorVS_undo : sel.anchorVS_redo);
- int currVS = (doAct == UNDO ? sel.currVS_undo : sel.currVS_redo);
+ int currVS = (doAct == UNDO ? sel.curVS_undo : sel.curVS_redo);
ISSUE_MESSAGE(g_hwndEdit, SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE, (WPARAM)anchorVS, 0);
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_CANCEL, 0, 0);
- #undef ISSUE_MASSAGE
-
+ #undef ISSUE_MASSAGE
}
}
@@ -7528,7 +7454,6 @@ void RestoreAction(int token, DoAction doAct)
// UndoSelectionMap()
//
//
-
int UndoRedoActionMap(int token, UndoRedoSelection_t* selection)
{
if (UndoRedoSelectionUTArray == NULL)
diff --git a/src/Notepad3.h b/src/Notepad3.h
index 6f03336a1..acfec3055 100644
--- a/src/Notepad3.h
+++ b/src/Notepad3.h
@@ -44,16 +44,19 @@ typedef struct np3params {
typedef struct _undoSel
{
- int selMode;
+ int selMode_undo;
int anchorPos_undo;
- int currPos_undo;
- int anchorPos_redo;
- int currPos_redo;
- int rectSelVS;
+ int curPos_undo;
+ int rectSelVS_undo;
int anchorVS_undo;
- int currVS_undo;
+ int curVS_undo;
+
+ int selMode_redo;
+ int anchorPos_redo;
+ int curPos_redo;
+ int rectSelVS_redo;
int anchorVS_redo;
- int currVS_redo;
+ int curVS_redo;
}
UndoRedoSelection_t;
diff --git a/src/Notepad3.rc b/src/Notepad3.rc
index 8be1621e8..4e593e103 100644
--- a/src/Notepad3.rc
+++ b/src/Notepad3.rc
@@ -181,8 +181,8 @@ BEGIN
END
POPUP "&Block"
BEGIN
- MENUITEM "&Indent\t(Tab)", IDM_EDIT_INDENT
- MENUITEM "&Unindent\t(Shift+Tab)", IDM_EDIT_UNINDENT
+ MENUITEM "&Indent\t(Tab)", IDM_EDIT_INDENT
+ MENUITEM "&Unindent\t(Shift+Tab)", IDM_EDIT_UNINDENT
MENUITEM SEPARATOR
POPUP "&Enclose Selection"
BEGIN
@@ -310,9 +310,9 @@ BEGIN
MENUITEM "Match &Case Sensitive", IDM_VIEW_MARKOCCUR_CASE
POPUP "Match &Whole Word Only"
BEGIN
- MENUITEM "OFF", IDM_VIEW_MARKOCCUR_WNONE
- MENUITEM "Match &Selected Word", IDM_VIEW_MARKOCCUR_WORD
- MENUITEM "Match &Current Word", IDM_VIEW_MARKOCCUR_CURRENT
+ MENUITEM "OFF", IDM_VIEW_MARKOCCUR_WNONE
+ MENUITEM "Match &Selected Word", IDM_VIEW_MARKOCCUR_WORD
+ MENUITEM "Match &Current Word", IDM_VIEW_MARKOCCUR_CURRENT
END
END
MENUITEM SEPARATOR
@@ -322,61 +322,62 @@ BEGIN
MENUITEM "Code &Folding\tCtrl+Shift+Alt+F", IDM_VIEW_FOLDING
MENUITEM "&Toggle All Folds\tCtrl+Shift+F", IDM_VIEW_TOGGLEFOLDS
MENUITEM SEPARATOR
- MENUITEM "Zoom &In\tCtrl++", IDM_VIEW_ZOOMIN
- MENUITEM "Zoom &Out\tCtrl+-", IDM_VIEW_ZOOMOUT
- MENUITEM "Reset &Zoom\tCtrl+0", IDM_VIEW_RESETZOOM
+ MENUITEM "Zoom &In\tCtrl++", IDM_VIEW_ZOOMIN
+ MENUITEM "Zoom &Out\tCtrl+-", IDM_VIEW_ZOOMOUT
+ MENUITEM "Reset &Zoom\tCtrl+0", IDM_VIEW_RESETZOOM
END
POPUP "&Settings"
BEGIN
- MENUITEM "Insert Tabs as &Spaces", IDM_VIEW_TABSASSPACES
- MENUITEM "&Tab Settings...\tCtrl+T", IDM_VIEW_TABSETTINGS
- MENUITEM "&Word Wrap Settings...", IDM_VIEW_WORDWRAPSETTINGS
- MENUITEM "&Long Line Settings...", IDM_VIEW_LONGLINESETTINGS
- MENUITEM "Auto In&dent Text", IDM_VIEW_AUTOINDENTTEXT
+ MENUITEM "Insert Tabs as &Spaces", IDM_VIEW_TABSASSPACES
+ MENUITEM "&Tab Settings...\tCtrl+T", IDM_VIEW_TABSETTINGS
+ MENUITEM "&Word Wrap Settings...", IDM_VIEW_WORDWRAPSETTINGS
+ MENUITEM "&Long Line Settings...", IDM_VIEW_LONGLINESETTINGS
+ MENUITEM "Auto In&dent Text", IDM_VIEW_AUTOINDENTTEXT
MENUITEM "Auto Close &HTML/XML\tCtrl+Shift+H", IDM_VIEW_AUTOCLOSETAGS
- MENUITEM "Auto Complete Wo&rds", IDM_VIEW_AUTOCOMPLETEWORDS
+ MENUITEM "Auto Complete Wo&rds", IDM_VIEW_AUTOCOMPLETEWORDS
MENUITEM "&Accelerated Word Navigation", IDM_VIEW_ACCELWORDNAV
MENUITEM SEPARATOR
- MENUITEM "&Reuse Window", IDM_VIEW_REUSEWINDOW
- MENUITEM "Sticky Window &Position", IDM_VIEW_STICKYWINPOS
- MENUITEM "&Always On Top\tAlt+T", IDM_VIEW_ALWAYSONTOP
- MENUITEM "Minimi&ze To Tray", IDM_VIEW_MINTOTRAY
+ MENUITEM "&Reuse Window", IDM_VIEW_REUSEWINDOW
+ MENUITEM "Sticky Window &Position", IDM_VIEW_STICKYWINPOS
+ MENUITEM "&Always On Top\tAlt+T", IDM_VIEW_ALWAYSONTOP
+ MENUITEM "Minimi&ze To Tray", IDM_VIEW_MINTOTRAY
MENUITEM "Transparent &Mode\tCtrl+Numpad_*", IDM_VIEW_TRANSPARENT
MENUITEM SEPARATOR
- MENUITEM "Single &File Instance", IDM_VIEW_SINGLEFILEINSTANCE
+ MENUITEM "Single &File Instance", IDM_VIEW_SINGLEFILEINSTANCE
MENUITEM "File &Change Notification...\tAlt+F5", IDM_VIEW_CHANGENOTIFY
POPUP "Window Title Displa&y"
BEGIN
- MENUITEM "Filename &Only", IDM_VIEW_SHOWFILENAMEONLY
- MENUITEM "Filename and &Directory", IDM_VIEW_SHOWFILENAMEFIRST
- MENUITEM "Full &Pathname", IDM_VIEW_SHOWFULLPATH
- MENUITEM "&Text Excerpt\tCtrl+9", IDM_VIEW_SHOWEXCERPT
+ MENUITEM "Filename &Only", IDM_VIEW_SHOWFILENAMEONLY
+ MENUITEM "Filename and &Directory", IDM_VIEW_SHOWFILENAMEFIRST
+ MENUITEM "Full &Pathname", IDM_VIEW_SHOWFULLPATH
+ MENUITEM "&Text Excerpt\tCtrl+9", IDM_VIEW_SHOWEXCERPT
END
POPUP "Esc &Key Function"
BEGIN
- MENUITEM "&None", IDM_VIEW_NOESCFUNC
- MENUITEM "&Minimize Notepad3", IDM_VIEW_ESCMINIMIZE
- MENUITEM "E&xit Notepad3", IDM_VIEW_ESCEXIT
+ MENUITEM "&None", IDM_VIEW_NOESCFUNC
+ MENUITEM "&Minimize Notepad3", IDM_VIEW_ESCMINIMIZE
+ MENUITEM "E&xit Notepad3", IDM_VIEW_ESCEXIT
END
- MENUITEM "Sa&ve Before Running Tools", IDM_VIEW_SAVEBEFORERUNNINGTOOLS
- MENUITEM "Remember Recent F&iles", IDM_VIEW_NOSAVERECENT
- MENUITEM "Preserve Caret &Position", IDM_VIEW_NOPRESERVECARET
- MENUITEM "Remember S&earch Strings", IDM_VIEW_NOSAVEFINDREPL
+ MENUITEM "Sa&ve Before Running Tools", IDM_VIEW_SAVEBEFORERUNNINGTOOLS
+ MENUITEM "Remember Recent F&iles", IDM_VIEW_NOSAVERECENT
+ MENUITEM "Preserve Caret &Position", IDM_VIEW_NOPRESERVECARET
+ MENUITEM "Remember S&earch Strings", IDM_VIEW_NOSAVEFINDREPL
MENUITEM SEPARATOR
- MENUITEM "Sh&ow Toolbar", IDM_VIEW_TOOLBAR
- MENUITEM "C&ustomize Toolbar...", IDM_VIEW_CUSTOMIZETB
- MENUITEM "Sh&ow Statusbar", IDM_VIEW_STATUSBAR
+ MENUITEM "Sh&ow Toolbar", IDM_VIEW_TOOLBAR
+ MENUITEM "C&ustomize Toolbar...", IDM_VIEW_CUSTOMIZETB
+ MENUITEM "Sh&ow Statusbar", IDM_VIEW_STATUSBAR
MENUITEM SEPARATOR
- MENUITEM "Save Settings On E&xit", IDM_VIEW_SAVESETTINGS
- MENUITEM "Save Settings &Now\tF7", IDM_VIEW_SAVESETTINGSNOW
+ MENUITEM "Save Settings On E&xit", IDM_VIEW_SAVESETTINGS
+ MENUITEM "Save Settings &Now\tF7", IDM_VIEW_SAVESETTINGSNOW
MENUITEM "&Open Settings File\tCtrl+F7", CMD_OPENINIFILE
END
POPUP "&?"
BEGIN
- MENUITEM "&Online Documentation\tF1", IDM_HELP_ONLINEDOCUMENTATION
+ MENUITEM "&Online Documentation\tF1", IDM_HELP_ONLINEDOCUMENTATION
MENUITEM SEPARATOR
- MENUITEM "&About...", IDM_HELP_ABOUT
- MENUITEM "&Command Line Help", IDM_HELP_CMD
+ MENUITEM "&About...", IDM_HELP_ABOUT
+ MENUITEM "&Command Line Help", IDM_HELP_CMD
+ MENUITEM "Check for Updates", IDM_HELP_UPDATECHECK
END
END
@@ -535,7 +536,7 @@ BEGIN
VK_DOWN, IDM_EDIT_MOVELINEDOWN, VIRTKEY, SHIFT, CONTROL, NOINVERT
VK_ESCAPE, CMD_ESCAPE, VIRTKEY, NOINVERT
VK_ESCAPE, CMD_SHIFTESC, VIRTKEY, SHIFT, NOINVERT
- VK_F1, IDM_HELP_ONLINEDOCUMENTATION, VIRTKEY, NOINVERT
+ VK_F1, IDM_HELP_ONLINEDOCUMENTATION, VIRTKEY, NOINVERT
VK_F11, CMD_LEXDEFAULT, VIRTKEY, NOINVERT
VK_F11, CMD_LEXHTML, VIRTKEY, CONTROL, NOINVERT
VK_F11, CMD_LEXXML, VIRTKEY, SHIFT, NOINVERT
diff --git a/src/Notepad3.vcxproj b/src/Notepad3.vcxproj
index 3b39f6681..b8e736035 100644
--- a/src/Notepad3.vcxproj
+++ b/src/Notepad3.vcxproj
@@ -110,7 +110,10 @@
StreamingSIMDExtensions2
Fast
stdcpp17
+<<<<<<< HEAD
true
+=======
+>>>>>>> Notepad3_upstream_Rizone/master
msimg32.lib;comctl32.lib;imm32.lib;shlwapi.lib;scintilla.lib;%(AdditionalDependencies)
@@ -164,7 +167,10 @@
true
Fast
stdcpp17
+<<<<<<< HEAD
true
+=======
+>>>>>>> Notepad3_upstream_Rizone/master
msimg32.lib;comctl32.lib;imm32.lib;shlwapi.lib;scintilla.lib;%(AdditionalDependencies)
@@ -216,7 +222,10 @@
StreamingSIMDExtensions2
Fast
stdcpp17
+<<<<<<< HEAD
true
+=======
+>>>>>>> Notepad3_upstream_Rizone/master
msimg32.lib;comctl32.lib;imm32.lib;shlwapi.lib;scintilla.lib;%(AdditionalDependencies)
@@ -270,7 +279,10 @@
true
Fast
stdcpp17
+<<<<<<< HEAD
true
+=======
+>>>>>>> Notepad3_upstream_Rizone/master
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);
diff --git a/src/Version.h b/src/Version.h
index b451c5aa8..5be69c46d 100644
--- a/src/Version.h
+++ b/src/Version.h
@@ -43,6 +43,8 @@
#define VERSION_WEBPAGE2DISPLAY L"http://www.flos-freeware.ch"
#define VERSION_SCIVERSION L"Scintilla Library Ver: " STRINGIFY(SCINTILLA_VER) L" (RegEx:Onigmo v." STRINGIFY(ONIGMO_REGEX_VER) L")"
+#define VERSION_UPDATE_CHECK L"https://www.rizonesoft.com/notepad3/update.html?version=" VERSION_FILEVERSION
+
#if defined(_WIN64)
// #define VERSION_FILEVERSION_LONG L"Notepad3 (64-bit) " STRINGIFY(VERSION_MAJOR) L" Build " \
// STRINGIFY(VERSION_BUILD)
@@ -55,7 +57,6 @@
#endif
-
// Compiler specific
#if defined(_MSC_VER)
#if (_MSC_VER >= 1912)
diff --git a/src/resource.h b/src/resource.h
index f8e11dd8b..f5a969e00 100644
--- a/src/resource.h
+++ b/src/resource.h
@@ -30,7 +30,7 @@
#define IDC_INFOBOXTEXT 124
#define IDB_OPEN 125
#define IDR_ACCFINDREPLACE 126
-#define IDC_STYLELABEL_ROOT 127
+#define IDC_STYLELABEL_ROOT 127
#define IDC_STYLELABEL 128
#define IDC_STYLEEDIT_ROOT 129
#define IDC_STYLEEDIT 130
@@ -159,6 +159,7 @@
#define IDC_EDIT3 510
#define IDS_PASS_FAILURE 511
#define IDS_NOPASS 512
+#define IDM_HELP_UPDATECHECK 513
#define IDS_APPTITLE 10000
#define IDS_APPTITLE_ELEVATED 10001
#define IDS_APPTITLE_PASTEBOARD 10002
@@ -492,7 +493,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 601
-#define _APS_NEXT_COMMAND_VALUE 703
+#define _APS_NEXT_COMMAND_VALUE 701
#define _APS_NEXT_CONTROL_VALUE 801
#define _APS_NEXT_SYMED_VALUE 901
#endif