From a2e4ec39709527b1d70362e4ecb2a517426b2d48 Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Thu, 13 Sep 2018 15:29:25 +0200 Subject: [PATCH 1/5] + add: 1st code snippets to change Accel-Keys by user --- src/AccelKeys.c | 285 +++++++++++++++++++++++++++++++++++ src/AccelKeys.h | 33 ++++ src/Encoding.h | 29 +--- src/Helpers.c | 6 +- src/Notepad3.c | 4 + src/Notepad3.vcxproj | 2 + src/Notepad3.vcxproj.filters | 6 + src/StyleLexers/EditLexer.h | 4 +- 8 files changed, 342 insertions(+), 27 deletions(-) create mode 100644 src/AccelKeys.c create mode 100644 src/AccelKeys.h diff --git a/src/AccelKeys.c b/src/AccelKeys.c new file mode 100644 index 000000000..572e5a858 --- /dev/null +++ b/src/AccelKeys.c @@ -0,0 +1,285 @@ +/****************************************************************************** +* * +* * +* Notepad3 * +* * +* AccelKeys.c * +* Load Accelerator Keys at Runtime * +* * +* * +* (c) Rizonesoft 2015-2018 * +* https://rizonesoft.com * +* * +*******************************************************************************/ + +// https://docs.microsoft.com/en-us/windows/desktop/menurc/using-keyboard-accelerators + +// ============================================================================ + +#if !defined(WINVER) +#define WINVER 0x601 /*_WIN32_WINNT_WIN7*/ +#endif +#if !defined(_WIN32_WINNT) +#define _WIN32_WINNT 0x601 /*_WIN32_WINNT_WIN7*/ +#endif +#if !defined(NTDDI_VERSION) +#define NTDDI_VERSION 0x06010000 /*NTDDI_WIN7*/ +#endif +#define VC_EXTRALEAN 1 +#define WIN32_LEAN_AND_MEAN 1 +#include + +#include "resource.h" + +#include "AccelKeys.h" + +// ============================================================================ + +// typedef struct tagACCEL { +// BYTE fVirt; // FVIRTKEY (else ASCII code) | FNOINVERT | FCONTROL | FALT | FSHIFT +// WORD key; // ASCII character code or a virtual-key code +// WORD cmd; +// } ACCEL, *LPACCEL; + +typedef struct _CMDNAMEIDMAP +{ + char* pCmdName; + int ridStrgTbl; + ACCEL accel; +} +CMD_NAME_ID_MAP, *LP_CMD_NAME_ID_MAP; + + +// ============================================================================ + +CMD_NAME_ID_MAP NP3_ACCEL_KEY_MAP[] = { + { "CMD_DUPLINES", 0, { (FVIRTKEY | FNOINVERT), 0 , IDM_EDIT_DUPLICATELINE } } + ,{ "CMD_TRANSPLINES", 0, { (FVIRTKEY | FNOINVERT), 0 , IDM_EDIT_LINETRANSPOSE } } +}; + + + + + +// ============================================================================ +// VKey Lookup Support +// ---------------------------------------------------------------------------- + +#define MAXKEYS 25 + +typedef struct _VKEYS +{ + char *pKeyName; + char *pKeyString; +} VKEYS; + +VKEYS vkeys[MAXKEYS] = { + "BkSp", "Back Space", + "PgUp", "Page Up", + "PgDn", "Page Down", + "End", "End", + "Home", "Home", + "Lft", "Left", + "Up", "Up", + "Rgt", "Right", + "Dn", "Down", + "Ins", "Insert", + "Del", "Delete", + "Mult", "Multiply", + "Add", "Add", + "Sub", "Subtract", + "DecPt", "Decimal Point", + "Div", "Divide", + "F2", "F2", + "F3", "F3", + "F5", "F5", + "F6", "F6", + "F7", "F7", + "F8", "F8", + "F9", "F9", + "F11", "F11", + "F12", "F12" +}; +// ============================================================================ + + +// ============================================================================ +// ============================================================================ +// Constant value Description +// ---------------------------------------------- - +// VK_LBUTTON 0x01 Left mouse button +// VK_RBUTTON 0x02 Right mouse button +// VK_CANCEL 0x03 Control - break processing +// VK_MBUTTON 0x04 Middle mouse button(three - button mouse) +// VK_XBUTTON1 0x05 X1 mouse button +// VK_XBUTTON2 0x06 X2 mouse button +// - 0x07 Undefined +// VK_BACK 0x08 BACKSPACE key +// VK_TAB 0x09 TAB key +// - 0x0A-0B Reserved +// VK_CLEAR 0x0C CLEAR key +// VK_RETURN 0x0D ENTER key +// - 0x0E - 0F Undefined +// VK_SHIFT 0x10 SHIFT key +// VK_CONTROL 0x11 CTRL key +// VK_MENU 0x12 ALT key +// VK_PAUSE 0x13 PAUSE key +// VK_CAPITAL 0x14 CAPS LOCK key +// VK_KANA 0x15 IME Kana mode +// VK_HANGUEL 0x15 IME Hanguel mode(maintained for compatibility; use VK_HANGUL) +// VK_HANGUL 0x15 IME Hangul mode +// - 0x16 Undefined +// VK_JUNJA 0x17 IME Junja mode +// VK_FINAL 0x18 IME final mode +// VK_HANJA 0x19 IME Hanja mode +// VK_KANJI 0x19 IME Kanji mode +// - 0x1A Undefined +// VK_ESCAPE 0x1B ESC key +// VK_CONVERT 0x1C IME convert +// VK_NONCONVERT 0x1D IME nonconvert +// VK_ACCEPT 0x1E IME accept +// VK_MODECHANGE 0x1F IME mode change request +// VK_SPACE 0x20 SPACEBAR +// VK_PRIOR 0x21 PAGE UP key +// VK_NEXT 0x22 PAGE DOWN key +// VK_END 0x23 END key +// VK_HOME 0x24 HOME key +// VK_LEFT 0x25 LEFT ARROW key +// VK_UP 0x26 UP ARROW key +// VK_RIGHT 0x27 RIGHT ARROW key +// VK_DOWN 0x28 DOWN ARROW key +// VK_SELECT 0x29 SELECT key +// VK_PRINT 0x2A PRINT key +// VK_EXECUTE 0x2B EXECUTE key +// VK_SNAPSHOT 0x2C PRINT SCREEN key +// VK_INSERT 0x2D INS key +// VK_DELETE 0x2E DEL key +// VK_HELP 0x2F HELP key +// - 0x30 Undefined +// - 0x30 - 39 0 - 9 key +// - 0x3A - 40 Undefined +// - 0x41 - 5A A - Z key +// VK_LWIN 0x5B Left Windows key(Natural keyboard) +// VK_RWIN 0x5C Right Windows key(Natural keyboard) +// VK_APPS 0x5D Applications key(Natural keyboard) +// - 0x5E Reserved +// VK_SLEEP 0x5F Computer Sleep key +// VK_NUMPAD0 0x60 Numeric keypad 0 key +// VK_NUMPAD1 0x61 Numeric keypad 1 key +// VK_NUMPAD2 0x62 Numeric keypad 2 key +// VK_NUMPAD3 0x63 Numeric keypad 3 key +// VK_NUMPAD4 0x64 Numeric keypad 4 key +// VK_NUMPAD5 0x65 Numeric keypad 5 key +// VK_NUMPAD6 0x66 Numeric keypad 6 key +// VK_NUMPAD7 0x67 Numeric keypad 7 key +// VK_NUMPAD8 0x68 Numeric keypad 8 key +// VK_NUMPAD9 0x69 Numeric keypad 9 key +// VK_MULTIPLY 0x6A Multiply key +// VK_ADD 0x6B Add key +// VK_SEPARATOR 0x6C Separator key +// VK_SUBTRACT 0x6D Subtract key +// VK_DECIMAL 0x6E Decimal key +// VK_DIVIDE 0x6F Divide key +// VK_F1 0x70 F1 key +// VK_F2 0x71 F2 key +// VK_F3 0x72 F3 key +// VK_F4 0x73 F4 key +// VK_F5 0x74 F5 key +// VK_F6 0x75 F6 key +// VK_F7 0x76 F7 key +// VK_F8 0x77 F8 key +// VK_F9 0x78 F9 key +// VK_F10 0x79 F10 key +// VK_F11 0x7A F11 key +// VK_F12 0x7B F12 key +// VK_F13 0x7C F13 key +// VK_F14 0x7D F14 key +// VK_F15 0x7E F15 key +// VK_F16 0x7F F16 key +// VK_F17 0x80 F17 key +// VK_F18 0x81 F18 key +// VK_F19 0x82 F19 key +// VK_F20 0x83 F20 key +// VK_F21 0x84 F21 key +// VK_F22 0x85 F22 key +// VK_F23 0x86 F23 key +// VK_F24 0x87 F24 key +// - 0x88 - 8F Unassigned +// VK_NUMLOCK 0x90 NUM LOCK key +// VK_SCROLL 0x91 SCROLL LOCK key +// - 0x92 - 96 OEM specific +// - 0x97 - 9F Unassigned +// VK_LSHIFT 0xA0 Left SHIFT key +// VK_RSHIFT 0xA1 Right SHIFT key +// VK_LCONTROL 0xA2 Left CONTROL key +// VK_RCONTROL 0xA3 Right CONTROL key +// VK_LMENU 0xA4 Left MENU key +// VK_RMENU 0xA5 Right MENU key +// VK_BROWSER_BACK 0xA6 Browser Back key +// VK_BROWSER_FORWARD 0xA7 Browser Forward key +// VK_BROWSER_REFRESH 0xA8 Browser Refresh key +// VK_BROWSER_STOP 0xA9 Browser Stop key +// VK_BROWSER_SEARCH 0xAA Browser Search key +// VK_BROWSER_FAVORITES 0xAB Browser Favorites key +// VK_BROWSER_HOME 0xAC Browser Start and Home key +// VK_VOLUME_MUTE 0xAD Volume Mute key +// VK_VOLUME_DOWN 0xAE Volume Down key +// VK_VOLUME_UP 0xAF Volume Up key +// VK_MEDIA_NEXT_TRACK 0xB0 Next Track key +// VK_MEDIA_PREV_TRACK 0xB1 Previous Track key +// VK_MEDIA_STOP 0xB2 Stop Media key +// VK_MEDIA_PLAY_PAUSE 0xB3 Play / Pause Media key +// VK_LAUNCH_MAIL 0xB4 Start Mail key +// VK_LAUNCH_MEDIA_SELECT 0xB5 Select Media key +// VK_LAUNCH_APP1 0xB6 Start Application 1 key +// VK_LAUNCH_APP2 0xB7 Start Application 2 key +// - 0xB8 - B9 Reserved +// VK_OEM_1 0xBA Used for miscellaneous characters; it can vary by keyboard.For the US standard keyboard, the ';:' key +// VK_OEM_PLUS 0xBB For any country / region, the '+' key +// VK_OEM_COMMA 0xBC For any country / region, the ',' key +// VK_OEM_MINUS 0xBD For any country / region, the '-' key +// VK_OEM_PERIOD 0xBE For any country / region, the '.' key +// VK_OEM_2 0xBF Used for miscellaneous characters; it can vary by keyboard.For the US standard keyboard, the '/?' key +// VK_OEM_3 0xC0 Used for miscellaneous characters; it can vary by keyboard.For the US standard keyboard, the '`~' key +// - 0xC1 - D7 Reserved +// - 0xD8 - DA Unassigned +// VK_OEM_4 0xDB Used for miscellaneous characters; it can vary by keyboard.For the US standard keyboard, the '[{' key +// VK_OEM_5 0xDC Used for miscellaneous characters; it can vary by keyboard.For the US standard keyboard, the '\|' key +// VK_OEM_6 0xDD Used for miscellaneous characters; it can vary by keyboard.For the US standard keyboard, the ']}' key +// VK_OEM_7 0xDE Used for miscellaneous characters; it can vary by keyboard.For the US standard keyboard, the 'single-quote/double-quote' key +// VK_OEM_8 0xDF Used for miscellaneous characters; it can vary by keyboard. +// - 0xE0 Reserved +// - 0xE1 OEM specific +// VK_OEM_102 0xE2 Either the angle bracket key or the backslash key on the RT 102 - key keyboard +// - 0xE3 - E4 OEM specific +// - 0xE4 OEM specific +// VK_PROCESSKEY 0xE5 IME PROCESS key +// - 0xE6 OEM specific +// VK_PACKET 0xE7 Used to pass Unicode characters as if they were keystrokes.The VK_PACKET key is the low word of a 32 - bit Virtual Key value used for non - keyboard input methods.For more information, see Remark in KEYBDINPUT, SendInput, WM_KEYDOWN, and WM_KEYUP +// - 0xE8 Unassigned +// - 0xE9 - F5 OEM specific +// VK_ATTN 0xF6 Attn key +// VK_CRSEL 0xF7 CrSel key +// VK_EXSEL 0xF8 ExSel key +// VK_EREOF 0xF9 Erase EOF key +// VK_PLAY 0xFA Play key +// VK_ZOOM 0xFB Zoom key +// VK_NONAME 0xFC Reserved +// VK_PA1 0xFD PA1 key +// VK_OEM_CLEAR 0xFE Clear key +// ============================================================================ + +// Sytem-Wide Accelerators +// --------------------------- +// ALT + ESC Switches to the next application. +// ALT + F4 Closes an application or a window. +// ALT + HYPHEN Opens the Window menu for a document window. +// ALT + PRINT SCREEN Copies an image in the active window onto the clipboard. +// ALT + SPACEBAR Opens the Window menu for the application's main window. +// ALT + TAB Switches to the next application. +// CTRL + ESC Switches to the Start menu. +// CTRL + F4 Closes the active group or document window. +// F1 Starts the application's help file, if one exists. +// PRINT SCREEN Copies an image on the screen onto the clipboard. +// SHIFT + ALT + TAB Switches to the previous application.The user must press and hold down ALT + SHIFT while pressing TAB. + diff --git a/src/AccelKeys.h b/src/AccelKeys.h new file mode 100644 index 000000000..7ad3f8ea0 --- /dev/null +++ b/src/AccelKeys.h @@ -0,0 +1,33 @@ +/****************************************************************************** +* * +* * +* Notepad3 * +* * +* AccelKeys.h * +* Load Accelerator Keys at Runtime * +* * +* (c) Rizonesoft 2008-2018 * +* https://rizonesoft.com * +* * +* * +*******************************************************************************/ + +#pragma once +#ifndef _ACCELKEYS_H_ +#define _ACCELKEYS_H_ + +// ============================================================================ + + + + +// ---------------------------------------------------------------------------- + + + + + + +// ============================================================================ + +#endif //_ACCELKEYS_H_ diff --git a/src/Encoding.h b/src/Encoding.h index 655c691f9..6e96d3922 100644 --- a/src/Encoding.h +++ b/src/Encoding.h @@ -4,32 +4,17 @@ * Notepad3 * * * * Encoding.h * +* General helper functions * +* Based on code from Notepad2, (c) Florian Balmer 1996-2011 * +* Parts taken from SciTE, (c) Neil Hodgson * +* MinimizeToTray, (c) 2000 Matthew Ellis * * * -* Copyright (C) 2006-2016 Wu Yongwei * -* * -* This software is provided 'as-is', without any express or implied * -* warranty. In no event will the authors be held liable for any * -* damages arising from the use of this software. * -* * -* Permission is granted to anyone to use this software for any purpose, * -* including commercial applications, and to alter it and redistribute * -* it freely, subject to the following restrictions: * -* * -* 1. The origin of this software must not be misrepresented; you must * -* not claim that you wrote the original software. If you use this * -* software in a product, an acknowledgement in the product * -* documentation would be appreciated but is not required. * -* 2. Altered source versions must be plainly marked as such, and must * -* not be misrepresented as being the original software. * -* 3. This notice may not be removed or altered from any source * -* distribution. * -* * -* * -* The latest version of this software should be available at: * -* * +* (c) Rizonesoft 2008-2018 * +* https://rizonesoft.com * * * * * *******************************************************************************/ + #pragma once #ifndef _NP3_ENCODING_H_ #define _NP3_ENCODING_H_ diff --git a/src/Helpers.c b/src/Helpers.c index 23deacf84..9898a645d 100644 --- a/src/Helpers.c +++ b/src/Helpers.c @@ -6,10 +6,10 @@ * Helpers.c * * General helper functions * * Based on code from Notepad2, (c) Florian Balmer 1996-2011 * -* Parts taken from SciTE, (c) Neil Hodgson * -* MinimizeToTray, (c) 2000 Matthew Ellis * +* Parts taken from SciTE, (c) Neil Hodgson * +* MinimizeToTray, (c) 2000 Matthew Ellis * * * -* (c) Rizonesoft 2008-2016 * +* (c) Rizonesoft 2008-2018 * * https://rizonesoft.com * * * * * diff --git a/src/Notepad3.c b/src/Notepad3.c index f00972b76..0a6a98a2c 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -3592,12 +3592,16 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) case IDM_EDIT_DUPLICATELINE: + _BEGIN_UNDO_ACTION_; SendMessage(g_hwndEdit,SCI_LINEDUPLICATE,0,0); + _END_UNDO_ACTION_; break; case IDM_EDIT_LINETRANSPOSE: + _BEGIN_UNDO_ACTION_; SendMessage(g_hwndEdit, SCI_LINETRANSPOSE,0,0); + _END_UNDO_ACTION_; break; case IDM_EDIT_CUTLINE: diff --git a/src/Notepad3.vcxproj b/src/Notepad3.vcxproj index e48206bc6..f618731d4 100644 --- a/src/Notepad3.vcxproj +++ b/src/Notepad3.vcxproj @@ -363,6 +363,7 @@ + @@ -449,6 +450,7 @@ + diff --git a/src/Notepad3.vcxproj.filters b/src/Notepad3.vcxproj.filters index e5fefc1ef..9e3dd949b 100644 --- a/src/Notepad3.vcxproj.filters +++ b/src/Notepad3.vcxproj.filters @@ -249,6 +249,9 @@ Source Files\StyleLexers + + Source Files + @@ -380,6 +383,9 @@ Source Files\uthash + + Header Files + diff --git a/src/StyleLexers/EditLexer.h b/src/StyleLexers/EditLexer.h index 48594dfce..9f1b7117e 100644 --- a/src/StyleLexers/EditLexer.h +++ b/src/StyleLexers/EditLexer.h @@ -17,7 +17,7 @@ typedef struct _editstyle { -#pragma warning(disable : 4201) // MS's Non-Std: Struktur/Union ohne Namen +#pragma warning(disable : 4201) // MS's Non-Std: Structure/Union w/o name union { INT32 iStyle; @@ -38,7 +38,7 @@ typedef struct _keywordlist } KEYWORDLIST, *PKEYWORDLIST; -#pragma warning(disable : 4200) // MS's Non-Std: Null-Array in Struktur/Union +#pragma warning(disable : 4200) // MS's Non-Std: Null-Array in Structure/Union typedef struct _editlexer { int lexerID; From e325b9836f1b12798e32c24162242eba25f10af6 Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Tue, 18 Sep 2018 15:49:04 +0200 Subject: [PATCH 2/5] repair --- language/common_res.h | 1 - src/AccelKeys.c | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/language/common_res.h b/language/common_res.h index 6162b1a62..295edbd87 100644 --- a/language/common_res.h +++ b/language/common_res.h @@ -388,7 +388,6 @@ #define IDM_EDIT_MOVELINEUP 40313 #define IDM_EDIT_MOVELINEDOWN 40314 #define IDM_EDIT_DUPLINEORSELECTION 40315 -//#define IDM_EDIT_SELECTIONDUPLICATE 40329 #define IDM_EDIT_LINETRANSPOSE 40316 #define IDM_EDIT_CUTLINE 40317 #define IDM_EDIT_COPYLINE 40318 diff --git a/src/AccelKeys.c b/src/AccelKeys.c index 572e5a858..96e4d299b 100644 --- a/src/AccelKeys.c +++ b/src/AccelKeys.c @@ -53,8 +53,8 @@ CMD_NAME_ID_MAP, *LP_CMD_NAME_ID_MAP; // ============================================================================ CMD_NAME_ID_MAP NP3_ACCEL_KEY_MAP[] = { - { "CMD_DUPLINES", 0, { (FVIRTKEY | FNOINVERT), 0 , IDM_EDIT_DUPLICATELINE } } - ,{ "CMD_TRANSPLINES", 0, { (FVIRTKEY | FNOINVERT), 0 , IDM_EDIT_LINETRANSPOSE } } + { "CMD_DUPLINEORSEL", 0, { (FVIRTKEY | FNOINVERT), 0 , IDM_EDIT_DUPLINEORSELECTION } } + ,{ "CMD_TRANSPLINES", 0, { (FVIRTKEY | FNOINVERT), 0 , IDM_EDIT_LINETRANSPOSE } } }; From ecfbc2b89e62a38399b5cbd7a2558a9e251755f4 Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Thu, 11 Oct 2018 11:35:47 +0200 Subject: [PATCH 3/5] Scintilla update --- scintilla/doc/ScintillaDoc.html | 14 +++++++++++++- scintilla/doc/ScintillaHistory.html | 4 ++++ scintilla/include/Scintilla.h | 6 ++++-- scintilla/include/Scintilla.iface | 10 ++++++++-- scintilla/src/Editor.cxx | 16 +++++++++++++--- scintilla/src/Editor.h | 1 + scintilla/win32/ScintillaWin.cxx | 8 +++++--- src/Notepad3.c | 7 +++++-- src/Version.h | Bin 12948 -> 12948 bytes 9 files changed, 53 insertions(+), 13 deletions(-) diff --git a/scintilla/doc/ScintillaDoc.html b/scintilla/doc/ScintillaDoc.html index ee78740e0..709b0e7ad 100644 --- a/scintilla/doc/ScintillaDoc.html +++ b/scintilla/doc/ScintillaDoc.html @@ -7264,6 +7264,8 @@ struct SCNotification {

The following SCI_* messages are associated with these notifications:

SCI_SETMODEVENTMASK(int eventMask)
SCI_GETMODEVENTMASK → int
+ SCI_SETCOMMANDEVENTS(bool commandEvents)
+ SCI_GETCOMMANDEVENTS → bool
SCI_SETMOUSEDWELLTIME(int periodMilliseconds)
SCI_GETMOUSEDWELLTIME → int
SCI_SETIDENTIFIER(int identifier)
@@ -7750,7 +7752,9 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); EN_CHANGE). No other information is sent. If you need more detailed information use SCN_MODIFIED. You can filter the types of changes you are notified about with SCI_SETMODEVENTMASK.

+ href="#SCI_SETMODEVENTMASK">SCI_SETMODEVENTMASK and + SCI_SETCOMMANDEVENTS.

SCI_SETMODEVENTMASK(int eventMask)
SCI_GETMODEVENTMASK → int
@@ -7770,6 +7774,14 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); SC_MOD_BEFOREINSERT, SC_MOD_BEFOREDELETE, SC_MULTILINEUNDOREDO, and SC_MODEVENTMASKALL.

+

SCI_SETCOMMANDEVENTS(bool commandEvents)
+ SCI_GETCOMMANDEVENTS → bool
+ These messages set and get whether SCEN_* command events are + sent to the container. For SCEN_CHANGE this acts as an additional filter over + SCI_SETMODEVENTMASK. + Most applications should set this off to avoid overhead and only use + SCN_MODIFIED.

+

SCEN_SETFOCUS
SCEN_KILLFOCUS
SCEN_SETFOCUS (512) is fired when Scintilla receives focus and diff --git a/scintilla/doc/ScintillaHistory.html b/scintilla/doc/ScintillaHistory.html index 4b6b8926d..7e2fc7e2e 100644 --- a/scintilla/doc/ScintillaHistory.html +++ b/scintilla/doc/ScintillaHistory.html @@ -551,6 +551,10 @@ Release 4.1.3

    +
  • + Add SCI_SETCOMMANDEVENTS API to allow turning off command events as they + can be a significant performance cost. +
  • Fixed a crash on Cocoa in bidirectional mode where some patterns of invalid UTF-8 caused failures to create Unicode strings. diff --git a/scintilla/include/Scintilla.h b/scintilla/include/Scintilla.h index 9b452c70a..5ef01dd2d 100644 --- a/scintilla/include/Scintilla.h +++ b/scintilla/include/Scintilla.h @@ -103,8 +103,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SC_IME_INLINE 1 #define SCI_GETIMEINTERACTION 2678 #define SCI_SETIMEINTERACTION 2679 -#define SCI_ISIMEOPEN 2717 -#define SCI_ISIMEMODECJK 2718 +#define SCI_ISIMEOPEN 2719 +#define SCI_ISIMEMODECJK 2720 #define MARKER_MAX 31 #define SC_MARK_CIRCLE 0 #define SC_MARK_ROUNDRECT 1 @@ -703,6 +703,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_RELEASEDOCUMENT 2377 #define SCI_GETDOCUMENTOPTIONS 2379 #define SCI_GETMODEVENTMASK 2378 +#define SCI_SETCOMMANDEVENTS 2717 +#define SCI_GETCOMMANDEVENTS 2718 #define SCI_SETFOCUS 2380 #define SCI_GETFOCUS 2381 #define SC_STATUS_OK 0 diff --git a/scintilla/include/Scintilla.iface b/scintilla/include/Scintilla.iface index a8e60baa6..b0efce43d 100644 --- a/scintilla/include/Scintilla.iface +++ b/scintilla/include/Scintilla.iface @@ -267,8 +267,8 @@ get int GetIMEInteraction=2678(,) set void SetIMEInteraction=2679(int imeInteraction,) # >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> -get bool IsIMEOpen=2717(,) -get bool IsIMEModeCJK=2718(,) +get bool IsIMEOpen=2719(,) +get bool IsIMEModeCJK=2720(,) # <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< enu MarkerSymbol=SC_MARK_ @@ -1813,6 +1813,12 @@ get int GetDocumentOptions=2379(,) # Get which document modification events are sent to the container. get int GetModEventMask=2378(,) +# Set whether command events are sent to the container. +set void SetCommandEvents=2717(bool commandEvents,) + +# Get whether command events are sent to the container. +get bool GetCommandEvents=2718(,) + # Change internal focus flag. set void SetFocus=2380(bool focus,) # Get internal focus flag. diff --git a/scintilla/src/Editor.cxx b/scintilla/src/Editor.cxx index c2eb315a4..309c9acd2 100644 --- a/scintilla/src/Editor.cxx +++ b/scintilla/src/Editor.cxx @@ -181,6 +181,7 @@ Editor::Editor() { needIdleStyling = false; modEventMask = SC_MODEVENTMASKALL; + commandEvents = true; pdoc->AddWatcher(this, 0); @@ -2677,9 +2678,11 @@ void Editor::NotifyModified(Document *, DocModification mh, void *) { // If client wants to see this modification if (mh.modificationType & modEventMask) { - if ((mh.modificationType & (SC_MOD_CHANGESTYLE | SC_MOD_CHANGEINDICATOR)) == 0) { - // Real modification made to text of document. - NotifyChange(); // Send EN_CHANGE + if (commandEvents) { + if ((mh.modificationType & (SC_MOD_CHANGESTYLE | SC_MOD_CHANGEINDICATOR)) == 0) { + // Real modification made to text of document. + NotifyChange(); // Send EN_CHANGE + } } SCNotification scn = {}; @@ -7665,6 +7668,13 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_GETMODEVENTMASK: return modEventMask; + case SCI_SETCOMMANDEVENTS: + commandEvents = static_cast(wParam); + return 0; + + case SCI_GETCOMMANDEVENTS: + return commandEvents; + case SCI_CONVERTEOLS: pdoc->ConvertLineEnds(static_cast(wParam)); SetSelection(sel.MainCaret(), sel.MainAnchor()); // Ensure selection inside document diff --git a/scintilla/src/Editor.h b/scintilla/src/Editor.h index 3135b0ddd..5a4de2588 100644 --- a/scintilla/src/Editor.h +++ b/scintilla/src/Editor.h @@ -229,6 +229,7 @@ protected: // ScintillaBase subclass needs access to much of Editor bool needIdleStyling; int modEventMask; + bool commandEvents; SelectionText drag; diff --git a/scintilla/win32/ScintillaWin.cxx b/scintilla/win32/ScintillaWin.cxx index 28c3d83bf..fe282ef54 100644 --- a/scintilla/win32/ScintillaWin.cxx +++ b/scintilla/win32/ScintillaWin.cxx @@ -2120,9 +2120,11 @@ void ScintillaWin::NotifyChange() noexcept { } void ScintillaWin::NotifyFocus(bool focus) { - ::SendMessage(::GetParent(MainHWND()), WM_COMMAND, - MAKELONG(GetCtrlID(), focus ? SCEN_SETFOCUS : SCEN_KILLFOCUS), - reinterpret_cast(MainHWND())); + if (commandEvents) { + ::SendMessage(::GetParent(MainHWND()), WM_COMMAND, + MAKELONG(GetCtrlID(), focus ? SCEN_SETFOCUS : SCEN_KILLFOCUS), + reinterpret_cast(MainHWND())); + } Editor::NotifyFocus(focus); } diff --git a/src/Notepad3.c b/src/Notepad3.c index 7f973cdd2..9719ae88d 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -1543,7 +1543,9 @@ static void _InitializeSciEditCtrl(HWND hwndEditCtrl) // SC_PERFORMED_UNDO, SC_PERFORMED_REDO, SC_MULTISTEPUNDOREDO, SC_LASTSTEPINUNDOREDO, SC_MOD_CHANGEMARKER, // SC_MOD_BEFOREINSERT, SC_MOD_BEFOREDELETE, SC_MULTILINEUNDOREDO, and SC_MODEVENTMASKALL. // - ///~ Don't use: SC_PERFORMED_USER | SC_MOD_CHANGESTYLE; + ///~ Don't use: SC_PERFORMED_USER | SC_MOD_CHANGESTYLE; + /// SC_MOD_CHANGESTYLE and SC_MOD_CHANGEINDICATOR needs SCI_SETCOMMANDEVENTS=true + int const evtMask1 = SC_MOD_CONTAINER | SC_PERFORMED_UNDO | SC_PERFORMED_REDO; int const evtMask2 = SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT | SC_MOD_BEFOREINSERT | SC_MOD_BEFOREDELETE; @@ -1564,7 +1566,8 @@ static void _InitializeSciEditCtrl(HWND hwndEditCtrl) SendMessage(hwndEditCtrl, SCI_SETADDITIONALCARETSVISIBLE, true, 0); SendMessage(hwndEditCtrl, SCI_SETVIRTUALSPACEOPTIONS, SCVS_NONE, 0); SendMessage(hwndEditCtrl, SCI_SETLAYOUTCACHE, SC_CACHE_PAGE, 0); - + SendMessage(hwndEditCtrl, SCI_SETCOMMANDEVENTS, false, 0); // SCI 4.1.3 : speedup folding + // assign command keys SendMessage(hwndEditCtrl, SCI_ASSIGNCMDKEY, (SCK_NEXT + (SCMOD_CTRL << 16)), SCI_PARADOWN); SendMessage(hwndEditCtrl, SCI_ASSIGNCMDKEY, (SCK_PRIOR + (SCMOD_CTRL << 16)), SCI_PARAUP); diff --git a/src/Version.h b/src/Version.h index 11bb533398e177e5789c30bbd26354062822a045..ddd4e9a6eb4c861548403a47f2d1f2204b463ea4 100644 GIT binary patch delta 16 XcmbP|Iwf_3k;G&XWuMJ;5@J#SHdh6F delta 16 XcmbP|Iwf_3k;G&cX`jt?5@J#SHJ=4! From 3f8c199e19c6bf6107c37ed62c2a9a1ad61c06fd Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Tue, 23 Oct 2018 12:42:50 +0200 Subject: [PATCH 4/5] + enh: Warning on inconsistent line-breaks --- language/common_res.h | 113 ++++++++++---------- language/np3_af_za/dialogs_af_za.rc | Bin 75412 -> 75806 bytes language/np3_af_za/strings_af_za.rc | Bin 34406 -> 34554 bytes language/np3_de_de/dialogs_de_de.rc | Bin 76630 -> 77020 bytes language/np3_de_de/strings_de_de.rc | Bin 38146 -> 38306 bytes language/np3_en_gb/dialogs_en_gb.rc | Bin 75438 -> 75832 bytes language/np3_en_gb/strings_en_gb.rc | Bin 34490 -> 34638 bytes language/np3_en_us/dialogs_en_us.rc | Bin 75280 -> 75674 bytes language/np3_en_us/strings_en_us.rc | Bin 35104 -> 35250 bytes language/np3_es_es/dialogs_es_es.rc | Bin 77514 -> 77908 bytes language/np3_es_es/strings_es_es.rc | Bin 37472 -> 37620 bytes language/np3_fr_fr/dialogs_fr_fr.rc | Bin 76842 -> 77236 bytes language/np3_fr_fr/strings_fr_fr.rc | Bin 37810 -> 37958 bytes language/np3_ja_jp/dialogs_ja_jp.rc | Bin 72334 -> 72704 bytes language/np3_ja_jp/strings_ja_jp.rc | Bin 28792 -> 28940 bytes language/np3_nl_nl/dialogs_nl_nl.rc | Bin 76686 -> 77054 bytes language/np3_nl_nl/strings_nl_nl.rc | Bin 36910 -> 37058 bytes language/np3_zh_cn/dialogs_zh_cn.rc | Bin 70438 -> 70918 bytes language/np3_zh_cn/strings_zh_cn.rc | Bin 28080 -> 28228 bytes src/Dialogs.c | 40 ++++--- src/Dialogs.h | 2 +- src/Edit.c | 158 ++++++++++++++++------------ src/Edit.h | 6 +- src/Notepad3.c | 101 +++++++++--------- src/Notepad3.h | 2 +- src/SciCall.h | 2 + src/Styles.c | 4 +- src/TypeDefs.h | 20 ++++ 28 files changed, 247 insertions(+), 201 deletions(-) diff --git a/language/common_res.h b/language/common_res.h index 8b709c5f6..38c8be2bc 100644 --- a/language/common_res.h +++ b/language/common_res.h @@ -70,6 +70,7 @@ #define IDS_MUI_ERR_ADMINEXE 13011 #define IDS_MUI_WARN_LOAD_BIG_FILE 13012 #define IDS_MUI_WARN_UNKNOWN_EXT 13013 +#define IDS_MUI_WARN_INCONSIST_EOLS 13014 #define IDS_MUI_SELRECT 14000 #define IDS_MUI_BUFFERTOOSMALL 14001 @@ -218,61 +219,63 @@ #define IDC_ASCIIASUTF8 18033 #define IDC_NFOASOEM 18034 #define IDC_ENCODINGFROMFILEVARS 18035 -#define IDC_CONSISTENTEOLS 18036 -#define IDC_AUTOSTRIPBLANKS 18037 -#define IDC_LINENUM 18038 -#define IDC_COLNUM 18039 -#define IDC_FILEMRU 18040 -#define IDC_PRESERVECARET 18041 -#define IDC_SAVEMRU 18042 -#define IDC_REMOVE 18043 -#define IDC_RESIZEGRIP 18044 -#define IDC_REMEMBERSEARCHPATTERN 18045 -#define IDC_STYLELIST 18046 -#define IDC_DEFAULTSCHEME 18047 -#define IDC_AUTOSELECT 18048 -#define IDC_STYLELABEL_ROOT 18049 -#define IDC_STYLEEDIT_ROOT 18050 -#define IDC_STYLELABEL 18051 -#define IDC_STYLEFORE 18052 -#define IDC_STYLEBACK 18053 -#define IDC_STYLEFONT 18054 -#define IDC_PREVIEW 18055 -#define IDC_STYLEDEFAULT 18056 -#define IDC_PREVSTYLE 18057 -#define IDC_NEXTSTYLE 18058 -#define IDC_IMPORT 18059 -#define IDC_EXPORT 18060 -#define IDC_TITLE 18061 -#define IDC_STYLEEDIT 18062 -#define IDC_PRINTER 18063 -#define IDC_FAVORITESDIR 18064 -#define IDC_GETFAVORITESDIR 18065 -#define IDC_FAVORITESDESCR 18066 -#define IDC_PWD_EDIT1 18067 -#define IDC_PWD_EDIT2 18068 -#define IDC_PWD_EDIT3 18069 -#define IDC_PWD_CHECK1 18070 -#define IDC_PWD_CHECK2 18071 -#define IDC_PWD_CHECK3 18072 -#define IDC_PWD_CHECK4 18073 -#define IDC_PWD_STATMPW 18074 -#define IDC_COLUMNWRAP 18075 -#define IDC_INFOBOXTEXT 18076 -#define IDC_INFOBOXCHECK 18077 -#define IDC_INFOBOXICON 18078 -#define IDC_RESIZEGRIP4 18079 -#define IDC_VERSION 18080 -#define IDC_SCI_VERSION 18081 -#define IDC_COMPILER 18082 -#define IDC_COPYRIGHT 18083 -#define IDC_WEBPAGE2 18084 -#define IDC_WEBPAGE 18085 -#define IDR_RIZBITMAP 18086 -#define IDC_RIZONEBMP 18087 -#define IDC_COPYVERSTRG 18088 -#define IDC_RICHEDITABOUT 18089 -#define IDC_TRANSL_AUTH 18090 +#define IDC_EOLMODELIST 18036 +#define IDC_WARNINCONSISTENTEOLS 18037 +#define IDC_CONSISTENTEOLS 18038 +#define IDC_AUTOSTRIPBLANKS 18039 +#define IDC_LINENUM 18040 +#define IDC_COLNUM 18041 +#define IDC_FILEMRU 18042 +#define IDC_PRESERVECARET 18043 +#define IDC_SAVEMRU 18044 +#define IDC_REMOVE 18045 +#define IDC_RESIZEGRIP 18046 +#define IDC_REMEMBERSEARCHPATTERN 18047 +#define IDC_STYLELIST 18048 +#define IDC_DEFAULTSCHEME 18049 +#define IDC_AUTOSELECT 18050 +#define IDC_STYLELABEL_ROOT 18051 +#define IDC_STYLEEDIT_ROOT 18052 +#define IDC_STYLELABEL 18053 +#define IDC_STYLEFORE 18054 +#define IDC_STYLEBACK 18055 +#define IDC_STYLEFONT 18056 +#define IDC_PREVIEW 18057 +#define IDC_STYLEDEFAULT 18058 +#define IDC_PREVSTYLE 18059 +#define IDC_NEXTSTYLE 18060 +#define IDC_IMPORT 18061 +#define IDC_EXPORT 18062 +#define IDC_TITLE 18063 +#define IDC_STYLEEDIT 18064 +#define IDC_PRINTER 18065 +#define IDC_FAVORITESDIR 18066 +#define IDC_GETFAVORITESDIR 18067 +#define IDC_FAVORITESDESCR 18068 +#define IDC_PWD_EDIT1 18069 +#define IDC_PWD_EDIT2 18070 +#define IDC_PWD_EDIT3 18071 +#define IDC_PWD_CHECK1 18072 +#define IDC_PWD_CHECK2 18073 +#define IDC_PWD_CHECK3 18074 +#define IDC_PWD_CHECK4 18075 +#define IDC_PWD_STATMPW 18076 +#define IDC_COLUMNWRAP 18077 +#define IDC_INFOBOXTEXT 18078 +#define IDC_INFOBOXCHECK 18079 +#define IDC_INFOBOXICON 18080 +#define IDC_RESIZEGRIP4 18081 +#define IDC_VERSION 18082 +#define IDC_SCI_VERSION 18083 +#define IDC_COMPILER 18084 +#define IDC_COPYRIGHT 18085 +#define IDC_WEBPAGE2 18086 +#define IDC_WEBPAGE 18087 +#define IDR_RIZBITMAP 18088 +#define IDC_RIZONEBMP 18089 +#define IDC_COPYVERSTRG 18090 +#define IDC_RICHEDITABOUT 18091 +#define IDC_TRANSL_AUTH 18092 #define CMD_ESCAPE 20000 #define CMD_SHIFTESC 20001 diff --git a/language/np3_af_za/dialogs_af_za.rc b/language/np3_af_za/dialogs_af_za.rc index fb3846f58316f990c43c3d388e9ccd8dab9f9617..95a8550b32b21b69f77f326bf8ff77b34a3a48e1 100644 GIT binary patch delta 279 zcmbPomSx@rmJJ?$+?EVx3_1)73>FLqlMNFNP8RY1#%#!7IC=gg0 ze1W73gDa5b$q>vC0@Ps+#6}DTKoY1Ls9Oh!4JSXG<2m_3o806L9tzwU4EYS@K$9~W z@+Q9zkQdiwNMa~rNM%T5$Yv-8ikAafML;?IKvC{+21kY<20x(bev_R8x3fdcwV14U z*L?DW06k8)-pTPn+LK)Zw{V*RZ3o$H!C*AmFv)zfRnVo$M*>Z_%@|C;;^qv-lMRDC z8I33Bho>?dGgwakdr*9Gz#6&fU2Keeo7F{_D3<~N8L~)g delta 153 zcmbPtfn~~BmJJ?$+!hQ53_1)74CV|LlNateI9bI18>7YKk28fQZ%|d3yx=4crx93% zB~boiWR=MwK{}Jq`SVS_6s$3MOVF0d3TYgSrjsw$nNMC3d}XqMrWCgsSdSrt z5rg66i;}{V6AY9lC!~on8c$X{oC+ipBTY9i3ca(D*_^?6dLuhyJfq?EhwO~D3IN)5 BGfe;h diff --git a/language/np3_af_za/strings_af_za.rc b/language/np3_af_za/strings_af_za.rc index 3cd4dd7372bf7425a5a08d93135c0602977cc414..64766d2ad7513ee903689c35973bddd3049e0cd3 100644 GIT binary patch delta 118 zcmaFX!}P0{X~Q|g$#--lChHh-sd_T_F*q~$1Ib_pPaqCqh-YvG@_m481qLM`KZ7B4 za-x-}VJ1T!Lo!1?kSu1%1mY5gR3N(qs454@&ja#w8Il-^fOH~5Hc(!1vae9+W*H-| F5CGBu8#e#| delta 18 acmey>%k->=X~Q|g$=jOwHWwImg#Z9qWC*$d diff --git a/language/np3_de_de/dialogs_de_de.rc b/language/np3_de_de/dialogs_de_de.rc index eace6a0c4ab336980cd5a7c4cae518de6886a551..ba8b4420c2b86993a50d03ef606730c5dad1021f 100644 GIT binary patch delta 222 zcmcb1jpfcwmJKX^j24qGwjG|FbBJg26+b@4$pTg!qOJ`73_c9LK+=W570B{r2xbVG z{M>(TbQD7>LncEykW^p@XGmlyV#s4C1>$rdKM5?S0F=*T$Y#g~lEpxFF+&MZJP%4L zFhESm0gII~!8`?qD6m)#kjw+B%wv%4 delta 18 acmZ3qnyG0O(*`@!$*&>;HtU&{!~+0J)CaHt diff --git a/language/np3_en_gb/dialogs_en_gb.rc b/language/np3_en_gb/dialogs_en_gb.rc index 73566709ac18cbdd0c76f61ffed180fe7bcac96a..d880cb7b7a5e332284779ba0c0bebafc265ecb06 100644 GIT binary patch delta 272 zcmZ2?mSx8UmJLyUoR$n`3_1)73>K3YRvwDLz zqzi*9kmbn`%n$-pZw|yp3csY<&1e9|O6y*+QaAXK#@B^CdH#szLJ3GWwi^>0^Ehm2o z(BXvZom?2CJvl6J3%4oIZjj9u3`Ua~V=O281znhYEzpG9jKKsfZq8sl+3~3-qw(a% r@YKl@I@umjoE_1XtH8};p7Kv_}D?RmO#0} z&iu(2q!cEn1?liAFr+f%F{ChL0?G8rbA#@3n=n`a)fqCFGMG;md}uy-Pw=J54w_P& zW?<6|f#xNC7M&cBX2EDY`C~&evk`;w@A3$@aS9mKh9*48;rz z44Djh49N`nK(ZLfE@miUNCmP>fHFB?xl{&Sh9rg}plBjPHc(!1a-mS@W+$VH5CG;P B8N2`h delta 14 VcmX@t$F!@LX~P%8%^gO^LI5?H2Lu2B diff --git a/language/np3_en_us/dialogs_en_us.rc b/language/np3_en_us/dialogs_en_us.rc index d20f057786e1a4a3e2c2d27c0cd63def26479efa..ef31d673c2af291e3d64c8718553927973731f99 100644 GIT binary patch delta 261 zcmbPmhGo`ymJM5cC+D?rFj`D*JbHL?gWor1Lk7di@*>u{t_=PRJ`BD<(uKhl$nsVK4_`BL)K?2~^2o0i-Q}Iua*oPX6E@Gx2d2wBaB!(h}RE9)` zY=&Y61%`4Us|YCfFi?~`oWYSHh`|qNs^8@G0o&Oj=2=Xh=p#CLL!!!LzW^OhxcW!E*A!x@1P< m$&TUXn_Gf!Y@B|Ik1>JKe0ri1qwMqvT#ORiKd~~(DF6TxB}dl) delta 159 zcmbPro@K%rmJM5cxh)tB7<3pE7|amry1BxL!c=e zKZ#D(i?Cocp4@vV6-aJuFyAZ?dTk@4`SeC*M)Bzal8heA<_w0@6ZsfTCkuq~Z0}-c H6i@&FMXoXO diff --git a/language/np3_en_us/strings_en_us.rc b/language/np3_en_us/strings_en_us.rc index af6ac5682a266254b161617ef22008ad957c027d..593f517e0c3ca52dcd9a19949c0a5395b76811d8 100644 GIT binary patch delta 138 zcmZ25iD}bhrVY;wCMRhsO!hP2%JyXNV{m5h2a>@Ioeg;D- zkd?-e$&dqPWiTW%6az&v8S)sC8S;T-F_2x%Py&?A1Ck0rbs)J^23>|Eh9V%H$dC<` TSDd_%U37ATki%v>!$;u&V%{FG delta 22 ecmdlqnQ6f!rVY;wm=zf8CkqCJZoXjnC>#J}atPc2 diff --git a/language/np3_es_es/dialogs_es_es.rc b/language/np3_es_es/dialogs_es_es.rc index 995f3960ba4765d24d92d388749863b686fca5bf..422ea15884f0f70b9dc021759dc61d87c673ede5 100644 GIT binary patch delta 288 zcmX?gm*vU>mJKlhoR$n`3_1)73>K3&MjhU)5y;0l*-6bx*OkGa!H2;YNV+h%0$H96 z!3-flh2}tP#9#m<4S~=CNLw%%PM+J7Jb9j?QgSdu217nWIncOFhCGI3AUltt7|1SW zC}BtivP*z6IbgX|23>|Eh9aP7B11M%UIC~p5y;O2%ce8vF(?7e_5|AQ%n;8I&fv%p z#NY?y`%P{P-p&cJ--5wxvSWz(W}aXzMs8D}vp|lrU@+S37^2BInJL7C-HgEmBsh7$ ztoWo3GiGB3%gGzBq)%SZ%Qo31%4l;{*pltjd&C(N7|o|&6ks%+TouN*{SY4`hXMe~ C+(O*| delta 144 zcmccefaTO(mJKlh+!hQ53_1)74CV|LlNId_Zq^9oV`Ma){BWV+@Ioeg;D- zkd?-e$&dqPWiTW%6az&v8S)sC8S;T-F_2x%Py&?A1Ck0rbs)J^23>|Eh9V%H$dC<` LSKK_&M z5X=z5pu=De#6}DTK++HhEr7HIgW=>vHR;I;ZX%QUg2Ix688R618Oj+H7&0017?OeP zJceQ*yO^PbAr;6j0m|fnE*+6*(psqw9KMyRM&Y;Jj1T^0h=mKYk zc!qEWM}{B<~9tOlI^k-<%S}!^mk0bQs847LzY}nor&k{A#jIunD^v og9%7tUN*7HPD3MQGDC0O8z0b^rhX delta 119 zcmdmTn`PAvmJPf7xh)tB7<3pE7|a>lx@6DdvFjHysm0%u5P7?+TpiV;u)5#kf%_l2_zM32$CdF*VU@$p5Bbd>6^8So; UAbIhM>GVCkjC`9N!b`3J0M-~Lvj6}9 diff --git a/language/np3_fr_fr/strings_fr_fr.rc b/language/np3_fr_fr/strings_fr_fr.rc index 8695b9ff9257a8023420cb0c8eab19fef0a09501..c349421666479363d888ca324cd730c2b430df6f 100644 GIT binary patch delta 134 zcmdnAoaxvKrVS;glY6uzCjT?$%JyXNV{m5h2a>@Ioeg;D- zkd?-e$&dqPWiTW%6az&v8S)sC8S;T-F_2x%Py&?A1Ck0rbs)J^23>|Eh9V%H$dC<` PSDgG&Ep+oC(+{x#OBWwc delta 14 VcmX@Mf@#xorVS;gn>ozv;s7wk1+oAD diff --git a/language/np3_ja_jp/dialogs_ja_jp.rc b/language/np3_ja_jp/dialogs_ja_jp.rc index 1c11c7f3668f40ec28c79d0b7098255b7c6ea9b8..d343028d3f1152ad617c01ae1d11efa913e97cee 100644 GIT binary patch delta 277 zcmeC%%F?idWr6qPb@d#K7Lx@#4o^PgeTCJK!H~ghvSGL3WQQOQT~`Kw1|J4rAnC&3 z3S@aQ1T%y%=rEWAu@Qp-kOZl>0MZr=hLb<~v?d2LWH972lrtzWWHRJ2Bm>!b48=fp zF+&MMDv(_Ql*s|hr84L;Bry~LMH3maf$|DKU5P+`9#}S=L61QRXs##FW@m^RMEvOopLvOF1r z8A5>S%z@a5!2n1a0-*(vwqP)v{IDx|QWwkQ0wuZRV1^8ae1>wMftd_>49P%t9z!vZ zUCdCzkP2j%0A+H(a;Xfu3`q<{K+!~oY@oaXP*)<5p9hvrXV7C%0vhiLbbvEMJVQ8x zBSR2_ACT`iIXq}PC&URB3}%xVB~2$^kYm~WE>Mn<+Z5>#H!`9qlyt099igXQGLwoGOa?fA-cvqR{ntYQlNlw2Cp*X~ zO-`r~n(XkJh0%EO$M$R>x$(8><_%$+wlbSD7*Bu5&KL`17*00%lJbc E03v8HH2?qr diff --git a/language/np3_nl_nl/strings_nl_nl.rc b/language/np3_nl_nl/strings_nl_nl.rc index a995428216e65f101cc0ca70787ab909c57be007..914e6579846144729c5dfbdf36a8841b1a10090f 100644 GIT binary patch delta 134 zcmZ3tfa%aerVSsACo9-VOrB%JmF>yk$KcH14OgX-47v PuQ*vSGIX<@$%kkF8-E?d delta 22 ecmX@KkZIilrVSsACws8*O-^uk*nG+4Lo@($BnkEa diff --git a/language/np3_zh_cn/dialogs_zh_cn.rc b/language/np3_zh_cn/dialogs_zh_cn.rc index 399ef1538fd60e5ae6f2acc15ba096cb09e31129..a4890cc1be820cef35f0120dbee5063ef52b11c3 100644 GIT binary patch delta 318 zcmZ3sjHPWA%Z3l`oR$n`3_1)73>K3wZaqACkH-l{!^x7$*1E0?{tP}0zChB2!4=5z zWC&&m0je|yVj~6vAZZAM7C_p9!Ekb6P5R^q;&REs3>ggh4CO%cG8yt1l7Z|zhGHPQ zn4yFr7050D%H)9MQWkncCS(@TEx6j{B=C7LFa?|GSVLfm4(U^e-nyy@f^FCQdX6K+$WYe8WSGo$Hd Ih0kmX0K4W;^Z)<= delta 146 zcmZo$#j^5#N?p8B9nEL6(&0rbMfjh7=cw7 z0!j19z4h6X1H6Z0a)pn{WQ8~mW-|uE$p__4C%^IWn*1d+fZGhJ2PCdo p?LGOx`l!hc`&k%`H#hpdT*_?DU_ANb_gElpIN9-|@ushA3IM7zF*g7J diff --git a/language/np3_zh_cn/strings_zh_cn.rc b/language/np3_zh_cn/strings_zh_cn.rc index da04bbbbdc02d5554ae20c32200c31f82765ccc3..2e8055cb4be098a67f6df7e2558a4991273a6c70 100644 GIT binary patch delta 134 zcmdmRoAJmU#tjYfldE(kCI={SWqUICF*q~$1Ib_pPaqCqh-YvG@_m481qLM`KZ79^ z$Vy|#WXJ)tG8hsWih&}T40#O64EaE^7|1SWC;`gm0Z9d*I*?o{gDyi7LlKZpWXJ}} PD^7lBAG-OR{3Blg7r!35 delta 30 mcmX?dhjGJg#tjYflgnJpCI|3IOb$@um@FXAx4A;$j4uGfEDK5i diff --git a/src/Dialogs.c b/src/Dialogs.c index 3ee32ece5..c49c01bbe 100644 --- a/src/Dialogs.c +++ b/src/Dialogs.c @@ -2464,13 +2464,10 @@ bool RecodeDlg(HWND hwnd,int *pidREncoding) // // SelectDefLineEndingDlgProc() // -// Controls: 100 Combo -// IDC_CONSISTENTEOLS -// IDC_AUTOSTRIPBLANKS // INT_PTR CALLBACK SelectDefLineEndingDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam) { - static int *piOption; + static int* piOption; switch(umsg) { @@ -2486,12 +2483,13 @@ INT_PTR CALLBACK SelectDefLineEndingDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LP // Load options for (i = 0; i < 3; i++) { GetLngString(IDS_EOL_WIN+i,wch,COUNTOF(wch)); - SendDlgItemMessage(hwnd,100,CB_ADDSTRING,0,(LPARAM)wch); + SendDlgItemMessage(hwnd, IDC_EOLMODELIST,CB_ADDSTRING,0,(LPARAM)wch); } - SendDlgItemMessage(hwnd,100,CB_SETCURSEL,(WPARAM)*piOption,0); - SendDlgItemMessage(hwnd,100,CB_SETEXTENDEDUI,true,0); + SendDlgItemMessage(hwnd, IDC_EOLMODELIST,CB_SETCURSEL,(WPARAM)*piOption,0); + SendDlgItemMessage(hwnd, IDC_EOLMODELIST,CB_SETEXTENDEDUI,true,0); + CheckDlgButton(hwnd,IDC_WARNINCONSISTENTEOLS, DlgBtnChk(Settings.WarnInconsistEOLs)); CheckDlgButton(hwnd,IDC_CONSISTENTEOLS, DlgBtnChk(Settings.FixLineEndings)); CheckDlgButton(hwnd,IDC_AUTOSTRIPBLANKS, DlgBtnChk(Settings.FixTrailingBlanks)); @@ -2504,7 +2502,8 @@ INT_PTR CALLBACK SelectDefLineEndingDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LP switch(LOWORD(wParam)) { case IDOK: { - *piOption = (int)SendDlgItemMessage(hwnd,100,CB_GETCURSEL,0,0); + *piOption = (int)SendDlgItemMessage(hwnd,IDC_EOLMODELIST,CB_GETCURSEL,0,0); + Settings.WarnInconsistEOLs = (IsDlgButtonChecked(hwnd,IDC_WARNINCONSISTENTEOLS) == BST_CHECKED); Settings.FixLineEndings = (IsDlgButtonChecked(hwnd,IDC_CONSISTENTEOLS) == BST_CHECKED); Settings.FixTrailingBlanks = (IsDlgButtonChecked(hwnd,IDC_AUTOSTRIPBLANKS) == BST_CHECKED); EndDialog(hwnd,IDOK); @@ -2525,20 +2524,15 @@ INT_PTR CALLBACK SelectDefLineEndingDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LP // // SelectDefLineEndingDlg() // -bool SelectDefLineEndingDlg(HWND hwnd,int *iOption) +bool SelectDefLineEndingDlg(HWND hwnd, LPARAM piOption) { + INT_PTR const iResult = ThemedDialogBoxParam(Globals.hLngResContainer, + MAKEINTRESOURCE(IDD_MUI_DEFEOLMODE), + hwnd, + SelectDefLineEndingDlgProc, + piOption); - INT_PTR iResult; - - iResult = ThemedDialogBoxParam( - Globals.hLngResContainer, - MAKEINTRESOURCE(IDD_MUI_DEFEOLMODE), - hwnd, - SelectDefLineEndingDlgProc, - (LPARAM)iOption); - - return (iResult == IDOK) ? true : false; - + return (iResult == IDOK); } @@ -3532,9 +3526,10 @@ DLGTEMPLATE* LoadThemedDialogTemplate(LPCTSTR lpDialogTemplateID, HINSTANCE hIns INT_PTR ThemedDialogBoxParam(HINSTANCE hInstance, LPCTSTR lpTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam) { + INT_PTR ret = IDABORT; DLGTEMPLATE* pDlgTemplate = LoadThemedDialogTemplate(lpTemplate, hInstance); - INT_PTR ret = DialogBoxIndirectParam(hInstance, pDlgTemplate, hWndParent, lpDialogFunc, dwInitParam); if (pDlgTemplate) { + ret = DialogBoxIndirectParam(hInstance, pDlgTemplate, hWndParent, lpDialogFunc, dwInitParam); FreeMem(pDlgTemplate); } return ret; @@ -3543,9 +3538,10 @@ INT_PTR ThemedDialogBoxParam(HINSTANCE hInstance, LPCTSTR lpTemplate, HWND hWndP HWND CreateThemedDialogParam(HINSTANCE hInstance, LPCTSTR lpTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam) { + HWND hwnd = INVALID_HANDLE_VALUE; DLGTEMPLATE* pDlgTemplate = LoadThemedDialogTemplate(lpTemplate, hInstance); - HWND hwnd = CreateDialogIndirectParam(hInstance, pDlgTemplate, hWndParent, lpDialogFunc, dwInitParam); if (pDlgTemplate) { + hwnd = CreateDialogIndirectParam(hInstance, pDlgTemplate, hWndParent, lpDialogFunc, dwInitParam); FreeMem(pDlgTemplate); } return(hwnd); diff --git a/src/Dialogs.h b/src/Dialogs.h index 89b02775a..b552e3ee0 100644 --- a/src/Dialogs.h +++ b/src/Dialogs.h @@ -35,7 +35,7 @@ bool TabSettingsDlg(HWND,UINT,int *); bool SelectDefEncodingDlg(HWND,int *); bool SelectEncodingDlg(HWND,int *); bool RecodeDlg(HWND,int *); -bool SelectDefLineEndingDlg(HWND,int *); +bool SelectDefLineEndingDlg(HWND,LPARAM); bool GetMonitorInfoFromRect(const RECT* rc, MONITORINFO* hMonitorInfo); void WinInfoToScreen(WININFO*); diff --git a/src/Edit.c b/src/Edit.c index 689d299c2..6cc97c6b0 100644 --- a/src/Edit.c +++ b/src/Edit.c @@ -855,36 +855,66 @@ bool EditCopyAppend(HWND hwnd, bool bAppend) //============================================================================= // -// EditDetectEOLMode() - moved here to handle Unicode files correctly +// EditDetectEOLMode() - moved here to handle Unicode files correctly +// by zufuliu (https://github.com/zufuliu/notepad2) // -int EditDetectEOLMode(HWND hwnd, char* lpData) +void EditDetectEOLMode(LPCSTR lpData, DWORD cbData, EditFileIOStatus* status) { - UNUSED(hwnd); int iEOLMode = Settings.DefaultEOLMode; - LPCSTR cp = lpData ? StrPBrkA(lpData, "\r\n") : NULL; - - if (!cp) { - return iEOLMode; + if (cbData == 0) { + status->iEOLMode = iEOLMode; + return; } - if (*cp == '\r') { - if (*(cp + 1) == '\n') { + DocLn linesCount[3] = { 0, 0, 0 }; + + LPCSTR cp = lpData; + LPCSTR const end = cp + cbData; + while (cp < end) { + switch (*cp) { + case '\n': + ++cp; + ++linesCount[SC_EOL_LF]; + break; + case '\r': + ++cp; + if (*cp == '\n') { + ++cp; + ++linesCount[SC_EOL_CRLF]; + } + else { + ++linesCount[SC_EOL_LF]; + } + break; + default: + ++cp; + break; + } + } + + DocLn const linesMax = max_ln(max_ln(linesCount[0], linesCount[1]), linesCount[2]); + + if (linesMax != linesCount[iEOLMode]) { + if (linesMax == linesCount[SC_EOL_CRLF]) { iEOLMode = SC_EOL_CRLF; } + else if (linesMax == linesCount[SC_EOL_LF]) { + iEOLMode = SC_EOL_LF; + } else { iEOLMode = SC_EOL_CR; } } - else { - iEOLMode = SC_EOL_LF; - } - return iEOLMode; + status->iEOLMode = iEOLMode; + status->bInconsistent = ((!!linesCount[0]) + (!!linesCount[1]) + (!!linesCount[2])) > 1; + status->linesCount[SC_EOL_CRLF] = linesCount[SC_EOL_CRLF]; + status->linesCount[SC_EOL_CR] = linesCount[SC_EOL_CR]; + status->linesCount[SC_EOL_LF] = linesCount[SC_EOL_LF]; } - //============================================================================= // // EditLoadFile() @@ -894,18 +924,11 @@ bool EditLoadFile( LPWSTR pszFile, bool bSkipUTFDetection, bool bSkipANSICPDetection, - int* iEncoding, - int* iEOLMode, - bool *pbUnicodeErr, - bool *pbFileTooBig, - bool *pbUnkownExt) + EditFileIOStatus* status) { - if (pbUnicodeErr) - *pbUnicodeErr = false; - if (pbFileTooBig) - *pbFileTooBig = false; - if (pbUnkownExt) - *pbUnkownExt = false; + status->bUnicodeErr = false; + status->bFileTooBig = false; + status->bUnknownExt = false; HANDLE hFile = CreateFile(pszFile, GENERIC_READ, @@ -931,8 +954,7 @@ bool EditLoadFile( if (!Style_HasLexerForExt(lpszExt)) { if (InfoBoxLng(MBYESNO,L"MsgFileUnknownExt",IDS_MUI_WARN_UNKNOWN_EXT,lpszExt) != IDYES) { CloseHandle(hFile); - if (pbUnkownExt) - *pbUnkownExt = true; + status->bUnknownExt = true; Encoding_SrcCmdLn(CPI_NONE); Encoding_SrcWeak(CPI_NONE); return false; @@ -944,8 +966,7 @@ bool EditLoadFile( if ((dwFileSizeLimit != 0) && ((dwFileSizeLimit * 1024 * 1024) < dwFileSize)) { if (InfoBoxLng(MBYESNO,L"MsgFileSizeWarning",IDS_MUI_WARN_LOAD_BIG_FILE) != IDYES) { CloseHandle(hFile); - if (pbFileTooBig) - *pbFileTooBig = true; + status->bFileTooBig = true; Encoding_SrcCmdLn(CPI_NONE); Encoding_SrcWeak(CPI_NONE); return false; @@ -971,8 +992,7 @@ bool EditLoadFile( if (!lpData) { CloseHandle(hFile); - if (pbFileTooBig) - *pbFileTooBig = false; + status->bFileTooBig = true; Encoding_SrcCmdLn(CPI_NONE); Encoding_SrcWeak(CPI_NONE); return false; @@ -985,7 +1005,6 @@ bool EditLoadFile( bool bReadSuccess = ((readFlag & DECRYPT_FATAL_ERROR) || (readFlag & DECRYPT_FREAD_FAILED)) ? false : true; // ((readFlag == DECRYPT_SUCCESS) || (readFlag & DECRYPT_NO_ENCRYPTION)) => true; - if ((readFlag & DECRYPT_CANCELED_NO_PASS) || (readFlag & DECRYPT_WRONG_PASS)) { bReadSuccess = (InfoBoxLng(MBOKCANCEL, L"MsgNoOrWrongPassphrase", IDS_MUI_NOPASS) == IDOK); @@ -1067,10 +1086,11 @@ bool EditLoadFile( if (cbData == 0) { FileVars_Init(NULL,0,&g_fvCurFile); - *iEOLMode = Settings.DefaultEOLMode; - *iEncoding = !Encoding_IsNONE(iForcedEncoding) ? iForcedEncoding : (Settings.LoadASCIIasUTF8 ? CPI_UTF8 : iPreferedEncoding); + status->iEOLMode = Settings.DefaultEOLMode; + status->iEncoding = !Encoding_IsNONE(iForcedEncoding) ? iForcedEncoding : + (Settings.LoadASCIIasUTF8 ? CPI_UTF8 : iPreferedEncoding); EditSetNewText(hwnd,"",0); - SendMessage(hwnd,SCI_SETEOLMODE,Settings.DefaultEOLMode,0); + SciCall_SetEOLMode(Settings.DefaultEOLMode); FreeMem(lpData); } // === UNICODE === @@ -1093,10 +1113,10 @@ bool EditLoadFile( if (bReverse) { _swab(lpData,lpData,cbData); - *iEncoding = (bBOM ? CPI_UNICODEBEBOM : CPI_UNICODEBE); + status->iEncoding = (bBOM ? CPI_UNICODEBEBOM : CPI_UNICODEBE); } else { - *iEncoding = (bBOM ? CPI_UNICODEBOM : CPI_UNICODE); + status->iEncoding = (bBOM ? CPI_UNICODEBOM : CPI_UNICODE); } char* lpDataUTF8 = AllocMem((cbData * 3) + 2, HEAP_ZERO_MEMORY); @@ -1105,8 +1125,7 @@ bool EditLoadFile( (bBOM) ? (cbData)/sizeof(WCHAR) : cbData/sizeof(WCHAR) + 1,lpDataUTF8,(MBWC_DocPos_Cast)SizeOfMem(lpDataUTF8),NULL,NULL); if (convCnt == 0) { - if (pbUnicodeErr) - *pbUnicodeErr = true; + status->bUnicodeErr = true; convCnt = (DWORD)WideCharToMultiByte(CP_ACP,0,(bBOM) ? (LPWSTR)lpData + 1 : (LPWSTR)lpData, (-1),lpDataUTF8,(MBWC_DocPos_Cast)SizeOfMem(lpDataUTF8),NULL,NULL); } @@ -1116,7 +1135,7 @@ bool EditLoadFile( EditSetNewText(hwnd,"",0); FileVars_Init(lpDataUTF8,convCnt - 1,&g_fvCurFile); EditSetNewText(hwnd,lpDataUTF8,convCnt - 1); - *iEOLMode = EditDetectEOLMode(hwnd,lpDataUTF8); + EditDetectEOLMode(lpDataUTF8, convCnt - 1, status); FreeMem(lpDataUTF8); } else { @@ -1148,13 +1167,13 @@ bool EditLoadFile( EditSetNewText(hwnd,"",0); if (bIsUTF8Sig) { EditSetNewText(hwnd,UTF8StringStart(lpData),cbData-3); - *iEncoding = CPI_UTF8SIGN; - *iEOLMode = EditDetectEOLMode(hwnd,UTF8StringStart(lpData)); + status->iEncoding = CPI_UTF8SIGN; + EditDetectEOLMode(UTF8StringStart(lpData), cbData - 3, status); } else { EditSetNewText(hwnd,lpData,cbData); - *iEncoding = CPI_UTF8; - *iEOLMode = EditDetectEOLMode(hwnd,lpData); + status->iEncoding = CPI_UTF8; + EditDetectEOLMode(lpData, cbData, status); } FreeMem(lpData); } @@ -1162,19 +1181,19 @@ bool EditLoadFile( else { // === ALL OTHER === if (!Encoding_IsNONE(iForcedEncoding)) - *iEncoding = iForcedEncoding; + status->iEncoding = iForcedEncoding; else { - *iEncoding = FileVars_GetEncoding(&g_fvCurFile); - if (Encoding_IsNONE(*iEncoding)) + status->iEncoding = FileVars_GetEncoding(&g_fvCurFile); + if (Encoding_IsNONE(status->iEncoding)) { - *iEncoding = ((g_fvCurFile.mask & FV_ENCODING) ? CPI_ANSI_DEFAULT : iPreferedEncoding); + status->iEncoding = ((g_fvCurFile.mask & FV_ENCODING) ? CPI_ANSI_DEFAULT : iPreferedEncoding); } } - if (((Encoding_GetCodePage(*iEncoding) != CP_UTF7) && Encoding_IsEXTERNAL_8BIT(*iEncoding)) || - ((Encoding_GetCodePage(*iEncoding) == CP_UTF7) && IsValidUTF7(lpData,cbData))) { + if (((Encoding_GetCodePage(status->iEncoding) != CP_UTF7) && Encoding_IsEXTERNAL_8BIT(status->iEncoding)) || + ((Encoding_GetCodePage(status->iEncoding) == CP_UTF7) && IsValidUTF7(lpData,cbData))) { - UINT uCodePage = Encoding_GetCodePage(*iEncoding); + UINT uCodePage = Encoding_GetCodePage(status->iEncoding); LPWSTR lpDataWide = AllocMem(cbData * 2 + 16, HEAP_ZERO_MEMORY); int const cbDataWide = MultiByteToWideChar(uCodePage,0,lpData,cbData,lpDataWide,(MBWC_DocPos_Cast)(SizeOfMem(lpDataWide)/sizeof(WCHAR))); @@ -1188,7 +1207,7 @@ bool EditLoadFile( FreeMem(lpDataWide); EditSetNewText(hwnd,"",0); EditSetNewText(hwnd,lpData,cbData); - *iEOLMode = EditDetectEOLMode(hwnd,lpData); + EditDetectEOLMode(lpData, cbData, status); FreeMem(lpData); } else { @@ -1208,10 +1227,10 @@ bool EditLoadFile( } } else { - *iEncoding = Encoding_IsValid(iForcedEncoding) ? iForcedEncoding : iPreferedEncoding; + status->iEncoding = Encoding_IsValid(iForcedEncoding) ? iForcedEncoding : iPreferedEncoding; EditSetNewText(hwnd,"",0); EditSetNewText(hwnd,lpData,cbData); - *iEOLMode = EditDetectEOLMode(hwnd,lpData); + EditDetectEOLMode(lpData, cbData, status); FreeMem(lpData); } } @@ -1231,8 +1250,7 @@ bool EditLoadFile( bool EditSaveFile( HWND hwnd, LPCWSTR pszFile, - int iEncoding, - bool *pbCancelDataLoss, + EditFileIOStatus* status, bool bSaveCopy) { @@ -1243,7 +1261,7 @@ bool EditSaveFile( DWORD cbData; DWORD dwBytesWritten; - *pbCancelDataLoss = false; + status->bCancelDataLoss = false; hFile = CreateFile(pszFile, GENERIC_WRITE, @@ -1277,7 +1295,7 @@ bool EditSaveFile( // ensure consistent line endings if (Settings.FixLineEndings) { - SendMessage(hwnd,SCI_CONVERTEOLS, SciCall_GetEOLMode(),0); + SciCall_ConvertEOLs(SciCall_GetEOLMode()); EditFixPositions(hwnd); } @@ -1320,13 +1338,13 @@ bool EditSaveFile( } }*/ - if (Encoding_IsUNICODE(iEncoding)) + if (Encoding_IsUNICODE(status->iEncoding)) { SetEndOfFile(hFile); LPWSTR lpDataWide = AllocMem(cbData * 2 + 16, HEAP_ZERO_MEMORY); int bomoffset = 0; - if (Encoding_IsUNICODE_BOM(iEncoding)) { + if (Encoding_IsUNICODE_BOM(status->iEncoding)) { const char* bom = "\xFF\xFE"; CopyMemory((char*)lpDataWide, bom, 2); bomoffset = 1; @@ -1334,7 +1352,7 @@ bool EditSaveFile( int const cbDataWide = bomoffset + MultiByteToWideChar(Encoding_SciCP, 0, lpData, cbData, &lpDataWide[bomoffset], (MBWC_DocPos_Cast)((SizeOfMem(lpDataWide) / sizeof(WCHAR)) - bomoffset)); - if (Encoding_IsUNICODE_REVERSE(iEncoding)) { + if (Encoding_IsUNICODE_REVERSE(status->iEncoding)) { _swab((char*)lpDataWide, (char*)lpDataWide, cbDataWide * sizeof(WCHAR)); } bWriteSuccess = EncryptAndWriteFile(hwnd, hFile, (BYTE*)lpDataWide, cbDataWide * sizeof(WCHAR), &dwBytesWritten); @@ -1344,11 +1362,11 @@ bool EditSaveFile( FreeMem(lpData); } - else if (Encoding_IsUTF8(iEncoding)) + else if (Encoding_IsUTF8(status->iEncoding)) { SetEndOfFile(hFile); - if (Encoding_IsUTF8_SIGN(iEncoding)) { + if (Encoding_IsUTF8_SIGN(status->iEncoding)) { const char* bom = "\xEF\xBB\xBF"; DWORD bomoffset = 3; MoveMemory(&lpData[bomoffset], lpData, cbData); @@ -1362,16 +1380,16 @@ bool EditSaveFile( FreeMem(lpData); } - else if (Encoding_IsEXTERNAL_8BIT(iEncoding)) { + else if (Encoding_IsEXTERNAL_8BIT(status->iEncoding)) { BOOL bCancelDataLoss = FALSE; - UINT uCodePage = Encoding_GetCodePage(iEncoding); + UINT uCodePage = Encoding_GetCodePage(status->iEncoding); LPWSTR lpDataWide = AllocMem(cbData * 2 + 16, HEAP_ZERO_MEMORY); int cbDataWide = MultiByteToWideChar(Encoding_SciCP,0,lpData,cbData, lpDataWide,(MBWC_DocPos_Cast)(SizeOfMem(lpDataWide)/sizeof(WCHAR))); - if (Encoding_IsMBCS(iEncoding)) { + if (Encoding_IsMBCS(status->iEncoding)) { FreeMem(lpData); lpData = AllocMem(SizeOfMem(lpDataWide) * 2, HEAP_ZERO_MEMORY); // need more space cbData = WideCharToMultiByte(uCodePage, 0, lpDataWide, cbDataWide, @@ -1396,9 +1414,8 @@ bool EditSaveFile( } else { bWriteSuccess = false; - *pbCancelDataLoss = true; + status->bCancelDataLoss = true; } - FreeMem(lpData); } @@ -5793,8 +5810,9 @@ HWND EditFindReplaceDlg(HWND hwnd,LPCEDITFINDREPLACE lpefr,bool bReplace) EditFindReplaceDlgProcW, (LPARAM) lpefr); - ShowWindow(hDlg,SW_SHOW); - + if (hDlg != INVALID_HANDLE_VALUE) { + ShowWindow(hDlg, SW_SHOW); + } CoUninitialize(); return hDlg; } diff --git a/src/Edit.h b/src/Edit.h index 21d3fdafc..097e92b0a 100644 --- a/src/Edit.h +++ b/src/Edit.h @@ -31,9 +31,9 @@ bool EditSetClipboardText(HWND hwnd, const char* pszText, size_t cchText); bool EditClearClipboard(HWND hwnd); bool EditSwapClipboard(HWND hwnd,bool); bool EditCopyAppend(HWND hwnd,bool); -int EditDetectEOLMode(HWND hwnd,char* lpData); -bool EditLoadFile(HWND hwnd,LPWSTR pszFile,bool,bool,int* iEncoding,int* iEOLMode,bool*,bool*,bool*); -bool EditSaveFile(HWND hwnd,LPCWSTR pszFile,int iEncoding,bool*,bool); +void EditDetectEOLMode(LPCSTR lpData, DWORD cbData, EditFileIOStatus* status); +bool EditLoadFile(HWND hwnd, LPWSTR pszFile, bool, bool, EditFileIOStatus* status); +bool EditSaveFile(HWND hwnd,LPCWSTR pszFile, EditFileIOStatus* status, bool bSaveCopy); void EditInvertCase(HWND hwnd); void EditTitleCase(HWND hwnd); diff --git a/src/Notepad3.c b/src/Notepad3.c index f8a942e35..7dd4dc45c 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -3313,8 +3313,8 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) BeginWaitCursor(NULL); _IGNORE_NOTIFY_CHANGE_; Globals.iEOLMode = (LOWORD(wParam)-IDM_LINEENDINGS_CRLF); // SC_EOL_CRLF(0), SC_EOL_CR(1), SC_EOL_LF(2) - SendMessage(Globals.hwndEdit,SCI_SETEOLMODE,Globals.iEOLMode,0); - SendMessage(Globals.hwndEdit,SCI_CONVERTEOLS,Globals.iEOLMode,0); + SciCall_SetEOLMode(Globals.iEOLMode); + SciCall_ConvertEOLs(Globals.iEOLMode); EditFixPositions(Globals.hwndEdit); _OBSERVE_NOTIFY_CHANGE_; EndWaitCursor(); @@ -3324,7 +3324,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) case IDM_LINEENDINGS_SETDEFAULT: - SelectDefLineEndingDlg(hwnd,&Settings.DefaultEOLMode); + SelectDefLineEndingDlg(hwnd, (LPARAM)&Settings.DefaultEOLMode); break; @@ -6436,7 +6436,7 @@ LRESULT MsgNotify(HWND hwnd, WPARAM wParam, LPARAM lParam) switch (pnmm->dwItemSpec) { case STATUS_EOLMODE: - SendMessage(Globals.hwndEdit,SCI_CONVERTEOLS, SciCall_GetEOLMode(),0); + SciCall_ConvertEOLs(SciCall_GetEOLMode()); EditFixPositions(Globals.hwndEdit); return 1LL; @@ -6843,6 +6843,7 @@ void LoadSettings() GET_BOOL_VALUE_FROM_INISECTION(LoadNFOasOEM, true); GET_BOOL_VALUE_FROM_INISECTION(NoEncodingTags, false); GET_INT_VALUE_FROM_INISECTION(DefaultEOLMode, SC_EOL_CRLF, SC_EOL_CRLF, SC_EOL_LF); Globals.iEOLMode = Settings.DefaultEOLMode; + GET_BOOL_VALUE_FROM_INISECTION(WarnInconsistEOLs, true); GET_BOOL_VALUE_FROM_INISECTION(FixLineEndings, false); GET_BOOL_VALUE_FROM_INISECTION(FixTrailingBlanks, false); GET_INT_VALUE_FROM_INISECTION(PrintHeader, 1, 0, 3); @@ -7201,6 +7202,7 @@ void SaveSettings(bool bSaveSettingsNow) SAVE_VALUE_IF_NOT_EQ_DEFAULT(Bool, LoadNFOasOEM); SAVE_VALUE_IF_NOT_EQ_DEFAULT(Bool, NoEncodingTags); SAVE_VALUE_IF_NOT_EQ_DEFAULT(Int, DefaultEOLMode); + SAVE_VALUE_IF_NOT_EQ_DEFAULT(Bool, WarnInconsistEOLs); SAVE_VALUE_IF_NOT_EQ_DEFAULT(Bool, FixLineEndings); SAVE_VALUE_IF_NOT_EQ_DEFAULT(Bool, FixTrailingBlanks); SAVE_VALUE_IF_NOT_EQ_DEFAULT(Int, PrintHeader); @@ -9137,9 +9139,7 @@ static int _UndoRedoActionMap(int token, UndoRedoSelection_t* selection) // // bool FileIO(bool fLoad,LPWSTR pszFileName,bool bSkipUnicodeDetect,bool bSkipANSICPDetection, - int *ienc,int *ieol, - bool *pbUnicodeErr,bool *pbFileTooBig, bool* pbUnknownExt, - bool *pbCancelDataLoss,bool bSaveCopy) + EditFileIOStatus* status, bool bSaveCopy) { WCHAR tch[MAX_PATH+40]; bool fSuccess; @@ -9150,12 +9150,12 @@ bool FileIO(bool fLoad,LPWSTR pszFileName,bool bSkipUnicodeDetect,bool bSkipANSI BeginWaitCursor(tch); if (fLoad) { - fSuccess = EditLoadFile(Globals.hwndEdit,pszFileName,bSkipUnicodeDetect,bSkipANSICPDetection,ienc,ieol,pbUnicodeErr,pbFileTooBig,pbUnknownExt); + fSuccess = EditLoadFile(Globals.hwndEdit,pszFileName,bSkipUnicodeDetect,bSkipANSICPDetection,status); } else { int idx; if (MRU_FindFile(Globals.pFileMRU,pszFileName,&idx)) { - Globals.pFileMRU->iEncoding[idx] = *ienc; + Globals.pFileMRU->iEncoding[idx] = status->iEncoding; Globals.pFileMRU->iCaretPos[idx] = (Settings.PreserveCaretPos ? SciCall_GetCurrentPos() : 0); WCHAR wchBookMarks[MRU_BMRK_SIZE] = { L'\0' }; EditGetBookmarkList(Globals.hwndEdit, wchBookMarks, COUNTOF(wchBookMarks)); @@ -9163,7 +9163,7 @@ bool FileIO(bool fLoad,LPWSTR pszFileName,bool bSkipUnicodeDetect,bool bSkipANSI LocalFree(Globals.pFileMRU->pszBookMarks[idx]); // StrDup() Globals.pFileMRU->pszBookMarks[idx] = StrDup(wchBookMarks); } - fSuccess = EditSaveFile(Globals.hwndEdit,pszFileName,*ienc,pbCancelDataLoss,bSaveCopy); + fSuccess = EditSaveFile(Globals.hwndEdit,pszFileName, status, bSaveCopy); } dwFileAttributes = GetFileAttributes(pszFileName); @@ -9184,11 +9184,10 @@ bool FileLoad(bool bDontSave, bool bNew, bool bReload, bool bSkipUnicodeDetect, { WCHAR tch[MAX_PATH] = { L'\0' }; WCHAR szFileName[MAX_PATH] = { L'\0' }; - bool bUnicodeErr = false; - bool bFileTooBig = false; - bool bUnknownExt = false; - bool fSuccess; - int fileEncoding = CPI_ANSI_DEFAULT; + bool fSuccess = false; + + EditFileIOStatus fioStatus = INIT_FILEIO_STATUS; + fioStatus.iEOLMode = Globals.iEOLMode; if (bNew || bReload) { if (EditToggleView(Globals.hwndEdit, false)) { @@ -9213,7 +9212,7 @@ bool FileLoad(bool bDontSave, bool bNew, bool bReload, bool bSkipUnicodeDetect, EditSetNewText(Globals.hwndEdit, "", 0); Globals.iEOLMode = Settings.DefaultEOLMode; - SendMessage(Globals.hwndEdit,SCI_SETEOLMODE,Globals.iEOLMode,0); + SciCall_SetEOLMode(Globals.iEOLMode); Encoding_Current(Settings.DefaultEncoding); Encoding_HasChanged(Settings.DefaultEncoding); @@ -9289,11 +9288,11 @@ bool FileLoad(bool bDontSave, bool bNew, bool bReload, bool bSkipUnicodeDetect, EditSetNewText(Globals.hwndEdit,"",0); Style_SetDefaultLexer(Globals.hwndEdit); Globals.iEOLMode = Settings.DefaultEOLMode; - SendMessage(Globals.hwndEdit,SCI_SETEOLMODE,Globals.iEOLMode,0); + SciCall_SetEOLMode(Globals.iEOLMode); if (Encoding_SrcCmdLn(CPI_GET) != CPI_NONE) { - fileEncoding = Encoding_SrcCmdLn(CPI_GET); - Encoding_Current(fileEncoding); - Encoding_HasChanged(fileEncoding); + fioStatus.iEncoding = Encoding_SrcCmdLn(CPI_GET); + Encoding_Current(fioStatus.iEncoding); + Encoding_HasChanged(fioStatus.iEncoding); } else { Encoding_Current(Settings.DefaultEncoding); @@ -9312,16 +9311,18 @@ bool FileLoad(bool bDontSave, bool bNew, bool bReload, bool bSkipUnicodeDetect, else { int idx; if (!bReload && MRU_FindFile(Globals.pFileMRU,szFileName,&idx)) { - fileEncoding = Globals.pFileMRU->iEncoding[idx]; - if (fileEncoding > 0) - Encoding_SrcCmdLn(Encoding_MapUnicode(fileEncoding)); + fioStatus.iEncoding = Globals.pFileMRU->iEncoding[idx]; + if (fioStatus.iEncoding > 0) + Encoding_SrcCmdLn(Encoding_MapUnicode(fioStatus.iEncoding)); } else - fileEncoding = Encoding_Current(CPI_GET); + fioStatus.iEncoding = Encoding_Current(CPI_GET); - fSuccess = FileIO(true,szFileName,bSkipUnicodeDetect,bSkipANSICPDetection,&fileEncoding,&Globals.iEOLMode,&bUnicodeErr,&bFileTooBig,&bUnknownExt,NULL,false); - if (fSuccess) - Encoding_Current(fileEncoding); // load may change encoding + fSuccess = FileIO(true,szFileName,bSkipUnicodeDetect,bSkipANSICPDetection,&fioStatus,false); + if (fSuccess) { + Globals.iEOLMode = fioStatus.iEOLMode; + Encoding_Current(fioStatus.iEncoding); // load may change encoding + } } if (fSuccess) { StringCchCopy(Globals.CurrentFile,COUNTOF(Globals.CurrentFile),szFileName); @@ -9334,9 +9335,9 @@ bool FileLoad(bool bDontSave, bool bNew, bool bReload, bool bSkipUnicodeDetect, if (!s_flagLexerSpecified) // flag will be cleared Style_SetLexerFromFile(Globals.hwndEdit,Globals.CurrentFile); - SendMessage(Globals.hwndEdit,SCI_SETEOLMODE,Globals.iEOLMode,0); - fileEncoding = Encoding_Current(CPI_GET); - Encoding_HasChanged(fileEncoding); + SciCall_SetEOLMode(Globals.iEOLMode); + fioStatus.iEncoding = Encoding_Current(CPI_GET); + Encoding_HasChanged(fioStatus.iEncoding); int idx = 0; DocPos iCaretPos = 0; LPCWSTR pszBookMarks = L""; @@ -9344,7 +9345,7 @@ bool FileLoad(bool bDontSave, bool bNew, bool bReload, bool bSkipUnicodeDetect, iCaretPos = Globals.pFileMRU->iCaretPos[idx]; pszBookMarks = Globals.pFileMRU->pszBookMarks[idx]; } - MRU_AddFile(Globals.pFileMRU,szFileName,Flags.RelativeFileMRU,Flags.PortableMyDocs,fileEncoding,iCaretPos,pszBookMarks); + MRU_AddFile(Globals.pFileMRU,szFileName,Flags.RelativeFileMRU,Flags.PortableMyDocs,fioStatus.iEncoding,iCaretPos,pszBookMarks); EditSetBookmarkList(Globals.hwndEdit, pszBookMarks); SetFindPattern((Globals.pMRUfind ? Globals.pMRUfind->pszItems[0] : L"")); @@ -9398,13 +9399,17 @@ bool FileLoad(bool bDontSave, bool bNew, bool bReload, bool bSkipUnicodeDetect, UpdateSettingsCmds(); // Show warning: Unicode file loaded as ANSI - if (bUnicodeErr) - MsgBoxLng(MBWARN,IDS_MUI_ERR_UNICODE); + if (fioStatus.bUnicodeErr) { + MsgBoxLng(MBWARN, IDS_MUI_ERR_UNICODE); + } + // Show inconsistent line endings warning + if (fioStatus.bInconsistent && Settings.WarnInconsistEOLs) { + MsgBoxLng(MBWARN, IDS_MUI_WARN_INCONSIST_EOLS); + } + } + else if (!(fioStatus.bFileTooBig || fioStatus.bUnknownExt)) { + MsgBoxLng(MBWARN, IDS_MUI_ERR_LOADFILE, szFileName); } - - else if (!(bFileTooBig || bUnknownExt)) - MsgBoxLng(MBWARN,IDS_MUI_ERR_LOADFILE,szFileName); - return(fSuccess); } @@ -9476,7 +9481,10 @@ bool FileSave(bool bSaveAlways,bool bAsk,bool bSaveAs,bool bSaveCopy) WCHAR tchFile[MAX_PATH] = { L'\0' }; WCHAR tchBase[MAX_PATH] = { L'\0' }; bool fSuccess = false; - bool bCancelDataLoss = false; + + EditFileIOStatus fioStatus = INIT_FILEIO_STATUS; + fioStatus.iEncoding = Encoding_Current(CPI_GET); + fioStatus.iEOLMode = Globals.iEOLMode; bool bIsEmptyNewFile = false; if (StringCchLenW(Globals.CurrentFile,COUNTOF(Globals.CurrentFile)) == 0) { @@ -9553,9 +9561,8 @@ bool FileSave(bool bSaveAlways,bool bAsk,bool bSaveAs,bool bSaveCopy) if (SaveFileDlg(Globals.hwndMain,tchFile,COUNTOF(tchFile),tchInitialDir)) { - int fileEncoding = Encoding_Current(CPI_GET); - fSuccess = FileIO(false, tchFile, false, true, &fileEncoding, &Globals.iEOLMode, NULL, NULL, NULL, &bCancelDataLoss, bSaveCopy); - //~if (fSuccess) Encoding_Current(fileEncoding); // save should not change encoding + fSuccess = FileIO(false, tchFile, false, true, &fioStatus, bSaveCopy); + //~if (fSuccess) Encoding_Current(fioStatus.iEncoding); // save should not change encoding if (fSuccess) { if (!bSaveCopy) @@ -9577,9 +9584,8 @@ bool FileSave(bool bSaveAlways,bool bAsk,bool bSaveAs,bool bSaveCopy) return false; } else { - int fileEncoding = Encoding_Current(CPI_GET); - fSuccess = FileIO(false, Globals.CurrentFile, false, true, &fileEncoding, &Globals.iEOLMode, NULL, NULL, NULL, &bCancelDataLoss, false); - //~if (fSuccess) Encoding_Current(fileEncoding); // save should not change encoding + fSuccess = FileIO(false, Globals.CurrentFile, false, true, &fioStatus, false); + //~if (fSuccess) Encoding_Current(fioStatus.iEncoding); // save should not change encoding } if (fSuccess) @@ -9607,7 +9613,7 @@ bool FileSave(bool bSaveAlways,bool bAsk,bool bSaveAs,bool bSaveCopy) InstallFileWatching(Globals.CurrentFile); } } - else if (!bCancelDataLoss) + else if (!fioStatus.bCancelDataLoss) { if (StringCchLenW(Globals.CurrentFile,COUNTOF(Globals.CurrentFile)) > 0) { StringCchCopy(tchFile,COUNTOF(tchFile),Globals.CurrentFile); @@ -9621,9 +9627,8 @@ bool FileSave(bool bSaveAlways,bool bAsk,bool bSaveAs,bool bSaveCopy) if (GetTempPath(MAX_PATH,lpTempPathBuffer) && GetTempFileName(lpTempPathBuffer,TEXT("NP3"),0,szTempFileName)) { - int fileEncoding = Encoding_Current(CPI_GET); - if (FileIO(false,szTempFileName,false,true,&fileEncoding,&Globals.iEOLMode,NULL,NULL,NULL,&bCancelDataLoss,true)) { - //~Encoding_Current(fileEncoding); // save should not change encoding + if (FileIO(false,szTempFileName,false,true,&fioStatus,true)) { + //~Encoding_Current(fioStatus.iEncoding); // save should not change encoding WCHAR szArguments[2048] = { L'\0' }; LPWSTR lpCmdLine = GetCommandLine(); size_t const wlen = StringCchLenW(lpCmdLine,0) + 2; diff --git a/src/Notepad3.h b/src/Notepad3.h index eec325e21..a8ca25712 100644 --- a/src/Notepad3.h +++ b/src/Notepad3.h @@ -160,7 +160,7 @@ void SetFindPatternMB(LPCSTR chFindPattern); void GetFindPattern(LPWSTR wchFindPattern, size_t bufferSize); void GetFindPatternMB(LPSTR chFindPattern, size_t bufferSize); -bool FileIO(bool,LPWSTR pszFileName,bool,bool,int* ienc,int* ieol,bool*,bool*,bool*,bool*,bool); +bool FileIO(bool, LPWSTR pszFileName, bool, bool, EditFileIOStatus* status, bool); bool FileLoad(bool,bool,bool,bool,bool,LPCWSTR lpszFile); bool FileRevert(LPCWSTR szFileName,bool); bool FileSave(bool,bool,bool,bool); diff --git a/src/SciCall.h b/src/SciCall.h index c4d9b40a9..d3f4874ba 100644 --- a/src/SciCall.h +++ b/src/SciCall.h @@ -227,6 +227,8 @@ DeclareSciCallR1(PositionBefore, POSITIONBEFORE, DocPos, DocPos, position) DeclareSciCallR1(PositionAfter, POSITIONAFTER, DocPos, DocPos, position) DeclareSciCallR1(GetCharAt, GETCHARAT, char, DocPos, position) DeclareSciCallR0(GetEOLMode, GETEOLMODE, int) +DeclareSciCallV1(SetEOLMode, SETEOLMODE, int, eolmode) +DeclareSciCallV1(ConvertEOLs, CONVERTEOLS, int, eolmode) DeclareSciCallV0(SetCharsDefault, SETCHARSDEFAULT) DeclareSciCallV01(SetWordChars, SETWORDCHARS, const char*, chrs) diff --git a/src/Styles.c b/src/Styles.c index 340d15514..e34d99f0e 100644 --- a/src/Styles.c +++ b/src/Styles.c @@ -3747,7 +3747,9 @@ HWND Style_CustomizeSchemesDlg(HWND hwnd) GetParent(hwnd), Style_CustomizeSchemesDlgProc, (LPARAM)NULL); - ShowWindow(hDlg, SW_SHOW); + if (hDlg != INVALID_HANDLE_VALUE) { + ShowWindow(hDlg, SW_SHOW); + } return hDlg; } diff --git a/src/TypeDefs.h b/src/TypeDefs.h index 916a58db3..bd5a90471 100644 --- a/src/TypeDefs.h +++ b/src/TypeDefs.h @@ -304,6 +304,7 @@ typedef struct _settings_t bool LoadNFOasOEM; bool NoEncodingTags; int DefaultEOLMode; + bool WarnInconsistEOLs; bool FixLineEndings; bool FixTrailingBlanks; int PrintHeader; @@ -409,7 +410,26 @@ typedef struct _flags_t extern FLAGS_T Flags; +//============================================================================= +typedef struct _editfileiostatus +{ + int iEncoding; + int iEOLMode; + + bool bFileTooBig; + bool bUnicodeErr; + + // inconsistent line endings + bool bInconsistent; + DocLn linesCount[3]; + + bool bCancelDataLoss; + bool bUnknownExt; + +} EditFileIOStatus; + +#define INIT_FILEIO_STATUS { CPI_ANSI_DEFAULT, SC_EOL_CRLF, false, false, false, {0,0,0}, false, false } //============================================================================= From cda4804d011695bdac25bc1149f88ea597fe5ab9 Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Tue, 23 Oct 2018 13:59:28 +0200 Subject: [PATCH 5/5] + enh: option to equalize inconsistent line-breaks after loading --- language/np3_af_za/strings_af_za.rc | Bin 34554 -> 34630 bytes language/np3_de_de/strings_de_de.rc | Bin 38306 -> 38398 bytes language/np3_en_gb/strings_en_gb.rc | Bin 34638 -> 34714 bytes language/np3_en_us/strings_en_us.rc | Bin 35250 -> 35326 bytes language/np3_es_es/strings_es_es.rc | Bin 37620 -> 37696 bytes language/np3_fr_fr/strings_fr_fr.rc | Bin 37958 -> 38034 bytes language/np3_ja_jp/strings_ja_jp.rc | Bin 28940 -> 29016 bytes language/np3_nl_nl/strings_nl_nl.rc | Bin 37058 -> 37134 bytes language/np3_zh_cn/strings_zh_cn.rc | Bin 28228 -> 28304 bytes src/Edit.c | 20 +++++++++----------- src/Notepad3.c | 15 +++++++++++++-- 11 files changed, 22 insertions(+), 13 deletions(-) diff --git a/language/np3_af_za/strings_af_za.rc b/language/np3_af_za/strings_af_za.rc index 64766d2ad7513ee903689c35973bddd3049e0cd3..7ab756338f929632d5369012d6c4a64da75ac56c 100644 GIT binary patch delta 74 zcmey>%XF-dX+w;WVhlqbgDOKY1Beb{NM$Hs$YDriNCvVLfOHN+&SXa;NkIjMB!)_$ Uh&ouUI)nY>_06K23yiu#0J*~v{Qv*} delta 18 ZcmX@s$Mmb0X+wgEPG5Kyp>}EZ)l6U|UJ0Xi1%pC2Uod#KAt_ddq diff --git a/language/np3_es_es/strings_es_es.rc b/language/np3_es_es/strings_es_es.rc index 5d5d519213b05cb605e4ae74bf2274e253153857..629895aa2d81e1f2fea4e97c8a00f9765a57923b 100644 GIT binary patch delta 72 zcmeyelXYk3BRAKWR>T4Tk=hYv delta 14 WcmX@GjOoi#rVVPQn~O}(#R32`y9Sg1 diff --git a/language/np3_fr_fr/strings_fr_fr.rc b/language/np3_fr_fr/strings_fr_fr.rc index c349421666479363d888ca324cd730c2b430df6f..2cc2d93ada60f118490ee626c22e04d6264e5f09 100644 GIT binary patch delta 90 zcmX@Mf@#u9rVUJH-Z2b$45|#p3?Mp)A(f$kA%`K6AsNV00Ma=?r~t&7K-p9VU4|rv cA|Rc}kPXzK0OVByNp-M(bq4#*jApKJ0Gpi>TmS$7 delta 18 acmbQVlIhqArVUJHlRv42Y+hvcAr=5ls0eKU diff --git a/language/np3_ja_jp/strings_ja_jp.rc b/language/np3_ja_jp/strings_ja_jp.rc index 5ae36e01a33defba5c933eb5f5bdd27777a8bd1f..ba1fd8932d2ac3d188babcd39ac61ae8a7ff2272 100644 GIT binary patch delta 75 zcmeBq#CYQo;|3m8#TbS>233Y)1`r*@kjhZNki(G3kPKug0O=ftoXHJ0V_lMjf5Y)(*J;|&1S#u94) delta 22 ecmccdh_UAp;|3np$qS6aCVx;C*?dTKnl}J=RSEn6 diff --git a/language/np3_nl_nl/strings_nl_nl.rc b/language/np3_nl_nl/strings_nl_nl.rc index 914e6579846144729c5dfbdf36a8841b1a10090f..100bb28efc794bcad2310c2e9a0c9fc875adf18a 100644 GIT binary patch delta 98 zcmX@Kkg0DG(}p?|?-+(W233Y)1`r*@kjhZNki(G3kPKug0O=ecQ~=^kplm9GE<+MS l5s*$~$Oh_A0P-qf&P3GNP?FPVIZ1^{6T7N7tC delta 18 acmeBM#B^vO(}p^e$)6%aHp`iQhz0;q+X#IC diff --git a/language/np3_zh_cn/strings_zh_cn.rc b/language/np3_zh_cn/strings_zh_cn.rc index 2e8055cb4be098a67f6df7e2558a4991273a6c70..b7cece68927a9c8939c8d3865c501836314b7f9c 100644 GIT binary patch delta 107 zcmX?dhjGGP#tnQ5J~0e=45|#p3?Mp)A(f$kA%`K6AsNV00Ma=?r~t&7K-p9VU4|rv uA|Rc}kPXzK0OVByNp-M(bq0He$ptPplLPo9CI={SOcs#m+gzb=#uor1Z5QiEOLMode = iEOLMode; diff --git a/src/Notepad3.c b/src/Notepad3.c index 7dd4dc45c..2b3130146 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -9403,8 +9403,19 @@ bool FileLoad(bool bDontSave, bool bNew, bool bReload, bool bSkipUnicodeDetect, MsgBoxLng(MBWARN, IDS_MUI_ERR_UNICODE); } // Show inconsistent line endings warning - if (fioStatus.bInconsistent && Settings.WarnInconsistEOLs) { - MsgBoxLng(MBWARN, IDS_MUI_WARN_INCONSIST_EOLS); + if (fioStatus.bInconsistent && Settings.WarnInconsistEOLs) + { + WCHAR szDefault[32]; + WCHAR szStatistic[80]; + int const eolm = Globals.iEOLMode; //Settings.DefaultEOLMode; + StringCchPrintf(szDefault, COUNTOF(szDefault), L"%s", + ((eolm == SC_EOL_CRLF) ? L"CRLF (\\r\\n)" : ((eolm == SC_EOL_CR) ? L"CR (\\r)" : L"LF (\\n)"))); + StringCchPrintf(szStatistic, COUNTOF(szStatistic), L">>> #CRLF = %i, #CR = %i, #LF = %i <<<", + fioStatus.linesCount[SC_EOL_CRLF], fioStatus.linesCount[SC_EOL_CR], fioStatus.linesCount[SC_EOL_LF]); + int const res = MsgBoxLng(MBYESNOWARN, IDS_MUI_WARN_INCONSIST_EOLS, szStatistic, szDefault); + if (res == IDYES) { + SciCall_ConvertEOLs(eolm); + } } } else if (!(fioStatus.bFileTooBig || fioStatus.bUnknownExt)) {