And add log ability for debugging network drive file status detection issue.
To activate log, user should:
1. Add an empty "nppLogNetworkDriveIssue.xml" file beside of notepad++.exe, or if user has no admin previlege, he/she can add this file into %APPDATA%\Notepad++\.
2. Create "C:\temp\" directory, if it doesn't exist yet.
3. Start notepad++.exe, and wait for the file status (timestamp) detection error from the network drive. If the errors occur, there should be some trace in "C:\temp\nppLogNetworkDriveIssue.log".
People who have had the network drive file status detection issue in #10688, #10753, #10757, #10751 & #10787 are welcome to download the binary and provide the generated log in order to fix this issue.
Fix#10751, fix#10688, fix#10753, fix#10757, fix#10751, fix#10787, close#10847
It's rather a bug of Windows' API than the bug of Notepad++. The visual glitch comes from TreeView (FunctionList, Folder As WorkSpace, Project Panels etc ...) but ListView (ASCII Insertion Panel & Document List) works fine.
I have done some fixes about this issue. However, it's not perfect when use mouse to do the snapshot.
OTOH, once the click done to show Notepad++, it becomes normal.
This is the best fix I can offer for this bug.
Fix#2202, fix#2937, fix#5980, fix#8980, fix#9905, fix#10091
Add all missing date time translations from v8.1.5.
Update 42083 and 42078 to not use the word sort (sortieren) because english.xml doesn't either.
Move items 41025 and 44109 to the same order like in english.xml for more easy diffing.
Delete obsolete/doubled item 42079 (it was there two times in german.xml).
Close#10730
This regression is due to the saving routine's change:
9aa9ecb664
Normally, on each save, buffer's timestamp is updated for the future comparison with the timestamp on the disk, in order to detect the modification from outside.
It seems the new saving routing makes the change (ONLY on network disk) with the timestamp before buffer's timestamp, for unknown reason.
The fix is: if timestamp got directly from the file on disk is earlier than buffer's timestamp, it's an absurd case and we ignore it. The buffer's timestamp will be only updated if the file on disk timestamp is later than buffer's one.
Fix#10688, fix#10753, fix#10757, close#10774
Some users encounter the issue that files cannot be saved sometimes.
It's due to the share parameter in CreateFile() set as 0, which makes sense for preventing other process from accessing to the file being written. However, when Notepad++ tries to write the file, it opens the file for writing. If at that moment the file is already opened by other program and the share flag is zero, then the system is instructed to deny opening the file on share conflict and the open fails.
Setting share parameter to "FILE_SHARE_READ" instead of 0 solve this problem.
Fix#10751, close#10765
Comments styles in stylers.model.xml are inconsistent with Scintilla's states
described in /scintilla/include/SciLexer.h. Moreover, block comments are
highlighted with not the same style as line comments, but with style used for
"COMMENT LINE BANG" in other languages.
I eliminated the "COMMENT LINE" style, which Scintilla does not generate, fixed
the "COMMENT BLOCK" style to be the same as regular "COMMENT", and added a
separate style, "COMMENT LINE BANG", for special comments.
Close#10748
Checkboxes "Transparent" of bg & fg color are added for each styler.
The bg color and/or fg color set in current Styler will be ignored and the dark/light theme's bg/fg color will be used, if the checkbox "Transparent" is checked.
To make generic UDL for all dark themes, user has to enable "Transparent" checkboxes for both bg and fg color in "Default Style", then set all the other styles with bg color transparent, or set both non-transparent, according the need of your token to be colorized.
Fix#10738
The PR fixes the regression due to the saving file API being changecd from POSIX functions to Win32 native API:
The old used function "fopen" using "wbc" as argument, according Microsoft document:
"w" Opens an empty file for writing. If the given file exists, its contents are destroyed.
(https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/fopen-wfopen?view=msvc-160)
so to save a 0 length document, it was unecessary to "write nothing" explicitely on disk, since fopen did it for you.
Whereas our new implementation which uses Win32 native API passes "OPEN_ALWAYS" - that needs to "write nothing" explicitely.
Fix#10699, close#10702
Instead of writting on hard disk little by little all the time,
all data is collected in a string buffer to write once on the disk at the end.
Fix#10678, fix#10674, close#10691
Notepad++ dark mode works fine under Microsft Windows 7, 8, 8.1 & 10.
Under Windows 11 while Notepad++ being switched into dark mode,
the hightlighting (background) of toolbar's hot-track icons remains in light mode.
Hence this workaround to remedy Notepad++ dark mode visual glitchy due to the bug of Windows 11.
Fix#10510, close#10685
When using dark mode with a theme other than DarkModeDefault the background and font color of the theme are not applied to all styles.
This PR fix this bug by adding colorStyle="1" to ignore defined background colour in UDL, and use the default's background colour (theme's one) instead.
Fix#10593, close#10619
This PR make buffer always dirty (with any undo/redo operation) if the editing buffer is unsyncronized with file on disk.
By "unsyncronized", it means:
1. the file is deleted outside but the buffer in Notepad++ is kept.
2. the file is modified by another app but the buffer is not reloaded in Notepad++.
Note that if the buffer is untitled, there's no correspondent file on the disk so the buffer is considered as independent therefore synchronized.
Fix#10401, close#10616
1. Rename CFile to Win32_IO_File (plus some modification in class).
2. Add new method writeStr() in Win32_IO_File class to write "char*" & string.
3. Change method names of Utf8_16_Write class and make writeFile() method return accurate type (boolean).
Close#10612
Uses native Win32 IO API (CreateFile, ReadFile, WriteFile, CloseHandle) instead of POSIX ones (fopen, fread, fwrite, fclose) for remedying NUL file-corruption problem due to system shutting down brutally.
Fix#6133, close#10598
Added translations for these commits:
* Make "Confirm Save All" dialog more clear (deab93f9b5)
* Make Incremental Search panel translatable (e12b161d48)
* Add custom date time insert (84c1505fab)
Close#10477
Notepad_plus_Window was rather huge (megabytes). Now it's small (tens of kilobytes),
but to safeguard against future size increase move its allocation from the stack
into the heap.
By using smart pointer, this PR not only fix open file crash properly,
but also prevent stack from being corrupted in the future.
Fix#10454, close#10531
Default DarkMode theme style for PHP was missing one element (COMPLEX VARIABLE).
Also Make variables in strings bold so they are more distinguishable.
Close#10502
* Enable/disable ext column via the context menu.
* The ext column checkbox is removed from the preferences dialog.
* Cleaned up localization file
Fix#10468, close#10485
LexerStylerArray contains a MAX_LEXER_STYLE-element array (currently 100) of LexerStyler objects. Every one of them in turn via inheritance from StyleArray contains a SCE_STYLE_ARRAY_SIZE-element array (I tested with 99) of Style objects each at least 56 bytes in size. This in my test case requires over 550k of memory, and if LexerStylerArray is allocated on stack, the stack becomes corrupted. (Ref: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/10454#issuecomment-908732786)
Inline arrays are a part of an object and increase its size while std::vector uses memory from the heap and stores internally only a pointer to a chunk of memory, thus the size of an object with a vector is substantially smaller than the one with an inline array. (Ref: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/10454#issuecomment-908780106)
Fix#10454, fix#10206
Follow these commits:
* Substitute "Mark" for "Style" in the menu entries (2576bf884b)
* Update English localization file to v8.1.4 (45831ac050)
Close#10416
When both Windows and Notepad++ use RTL language, the Save/Open button is swapped with Cancel button.
Now take that into account when searching the button.
Fix#10397, close#10400
This PR uses always current buffer's path in Find in Files dialog:
When "Follow current doc." is checked, then use current path first.
If that fails, fallback to the working directory as it was before.
Fix#8045, close#10387
The plugins' toolbar icons can be displayed in both light/dark mode by using their original icons.
Though using new API NPPM_ADDTOOLBARICON_FORDARKMODE to have better look & feel is recommanded.
Fix#9959, fix#10388, fix#9809
There's a security flaw for the un-installation of Notepad++ in Windows Register, the string without quotes:
C:\Program Files\Notepad++\uninstall.exe, whereas it should be "C:\Program Files\Notepad++\uninstall.exe".
The reason is, hacker can create a file called c:\program.exe, then Windows could interpret Files\Notepad++\uninstall.exe as the argument, so the system could run c:\program.exe. Ref:
https://isc.sans.edu/diary/Help+eliminate+unquoted+path+vulnerabilities/14464
Fixed by @ozone10:
Fix#10191, fix#6165, close#10369
Add Markdown UDL of dark mode and the ability to apply it:
After dark mode being swiched in, all files with extension .md will be opened by applying Markdown UDL of dark mode.
When light mode is switched back, the default Markdown UDL (of light mode) will be applied to the new opened .md file.
Please note that all .md files opened before switching to new mode, will remain in the previous mode. User has to close and reopen these files to have the right Markdown UDL applied.
Fix#10196, close#10347
Fix 2 RTL issues:
1. wrong path in tooltip of tab (#8520).
2. the file drag and drop bug (#8730) - now user can drag and drop to the exact view.
Fix#8520, fix#8730, close#10348
Currently, when the shortcut mapper is filtering shortcuts, it doesn't display key conflicts properly. This is due to the indexes of the filtered shortcuts being different (since there are less) than the original list of shortcuts.
Author @jmbockhorst
(the original branch has been deleted)
Fix#5374, close#5453
Pass a pointer to FileDialogEventHandler instance via GWLP_USERDATA
instead of using static variable. This way each window can have its
own pointer.
Fix#10290, close#10303
Rename "Unicode Debug" => "Debug", "Unicode Release" => "Release"
since there is no non-Unicode version.
Also, fix the name in other configs for Git, AppVeyor and in the docs.
Fix#10114, close#10278
1. Add panels' toolbar icons in both dark/light mode for Folder as Workspace panel and function list panel.
2. Add panels' dark/light mode (Fluent UI style) icons for the tab interface.
3. Update doclist icons.
4. Remove not used icon.
Note that these icons cannot be changed dynamically yet while switching between light mode & dark mode.
Fix#10066
1. Make dark colors consistent for panel toolbars.
2. Make dark colors consistent style configurator edit controls.
3. Make dark colors consistent for docking elements.
* BackgroundColor(), BackgroundBrush() – should be used for items which have some interactions, or need to be different from Darker variant.
* DarkerBackgroundColor(), DarkerBackgroundBrush() – should be used for static/top backgrounds.
* SofterBackgroundColor(), SofterBackgroundBrush() – should be used for items , which have interactions, or have focus.
Fix#10242, close#10243
1. Apply dark mode on value dialogs (dialogs created in preference).
2. Change value dialogs border style.
3. Apply dark mode on close button for other views (fullscreen, post-itand distraction free).
Fix#10253, fix#10210, close#10254
Avoid the same window procedure being used for several different edit boxes.
The problem was found on Windows Vista but it can happen in other environment too.
Fix#10238, close#10241
1. Apply dark mode on find in finder dialog.
2. Apply dark mode on progress window (searching in files).
3. Make color more consistent for incremental search.
4. Use different border style for incremental search.
5. Set border for finder for docking panel consistency.
Fix#10233, close#10234
1. Toggle toolbar item and view menu item for Document List Panel.
2. Added standard, filledFluent, darkmode->toolbar->(fluent and filledfluent) icons for the Document List Panel toggle.
3. Working shortcut for the Document List Panel under shortcut mapper.
4. Removed show document panel from the preference menu, kept the extension option.
5. Rename "Doc Switcher" to "Document list".
Fix#3526, fix#9015, close#10214
1. Make color more consistent.
2. Fix bug with trackbar (Transparency option) not changing background, when changing background color.
3. Fix visual glitch.
4. Enhancement to combobox, including DPI fixes.
5. Make listbox of combobox use dark scrollbar.
Fix#10027, fix#10221, close#10220
1. Allow function list search to use dark mode error background.
2. Make combobox more dark and allow to use custom colors (borders, arrow head and background).
3. Use dark listbox in combobox.
Fix#10178, close #10179
Following these commits:
* Improve link to user manual on questionmark menu (27524e1d4d)
* Add a Save all confirm dialog (80c285ee2d)
* Use current file directory in File Rename dialog (a0472fd7f2)
Close#10119
Use User Defined Language to have function list on Unit-tests.
It could reduce regression happening while the code of boost regex or the related code is changed.
And also make build system be aware of unit-test result.
Close#10108
Problem:
After installing Notepad++ v8.1 under an user account (with admin privilege), then switch to another user account (with or without admin privilege), launch Notepad++ and turn dark mode on. The dark theme on edit zone won't be applied.
Solution:
Notepad++ installer copies all theme files in installed directory instead of "%APPDATA%\Notepad++\themes\".
When theme is choosen or modified, it'll be saved in "%APPDATA%\Notepad++\themes\", and the saved theme file will override the original theme in installation directory.
New behaviour of theme:
Any theme selected via Style Configurator will be copied from its installation directory (C:\Program Files\Notepad++\themes\) into "%APPDATA%\Notepad++\themes\".
If the theme exists in "%APPDATA%\Notepad++\themes", the original one in s installation directory (C:\Program Files\Notepad++\themes) will be ignored.
Fix#10076, close#10077
Apply Explorer theme on list- and tree-views.
Allow dynamic change between dark and light mode in these views.
Add border to document switcher for consistency.
Refactor code in TreeView.cpp to make it consistent.
Fix#10055, close#10056
Remove unsupported option /arch:IA32 from x64 & ARM64 Release for Notepad++ project.
Define _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING for
SciLexer project to ignore a specific warning in third-party code.
Now the solution builds without warnings in all configurations.
Fix#10033, close#10034
Now Open dialog shows Open label on the button instead of Save.
Don't change any button labels.
Instead, get the leftmost button when overriding the window procedure.
Fix#9966, close#9973
In some cases, checkbox was found instead of OK button and window procedure was overriden for it. Now, the OK button is identified using style and label checks.
Also, in some cases IFileDialog::GetFileTypeIndex() returns the old value. To fix that, always remember the file type selected.
Fix#9939, close#9945
Resolves issue #4401 "Spanish translation: Search dialog items do not fit (translated texts too long)". Now the text fits the search dialog
Before:
<Item id="1703" name="&. se ajusta a línea nueva"/>
Now:
<Item id="1703" name="&. para nueva línea"/>
Fix#4401, close#9898
As at commit f7a04ca of this repo.
View of shortcuts:
Original: Display all shortcuts in form of `Example(X)`
Now: Display the shortcuts in English word, if any.
i.e. `E&xample`
Originally it is to follow the pattern of Taiwan translation.
However, the previous commit had added a lot of shortcuts.
It is better to adapt new strategy for the UI.
Close#9920
Usage:
void NPPM_ADDTOOLBARICON_FORDARKMODE(UINT funcItem[X]._cmdID, toolbarIconsWithDarkMode iconHandles)
This new API NPPM_ADDTOOLBARICON_FORDARKMODE is for replacing obsolete NPPM_ADDTOOLBARICON which doesn't support the dark mode.
2 formats / 3 icons are needed: 1 * BMP + 2 * ICO
All 3 handles below should be set so the icon will be displayed correctly if toolbar icon sets are changed by users, also in dark mode.
struct toolbarIconsWithDarkMode {
HBITMAP hToolbarBmp;
HICON hToolbarIcon;
HICON hToolbarIconDarkMode;
};
Close#9928
NPPM_ADDTOOLBARICON take structure
struct toolbarIcons {
HBITMAP hToolbarBmp;
HICON hToolbarIcon;
};
as argument, both hToolbarBmp & hToolbarIcon should not be null to take effect.
This reverts commit f249fc5902 due to a regression.
To reproduce the regression:
1. Ctrl+f and set to "Regular expression" as Search mode.
2. Press Shift+Ctrl+f to bring up "Find in Files".
3. Note that "Match whole word only" checkbox is missing, and cannot be made to appear.
Ref: #9766 & #9792