pnedev / compareplus Goto Github PK
View Code? Open in Web Editor NEWCompare plugin for Notepad++
License: GNU General Public License v3.0
Compare plugin for Notepad++
License: GNU General Public License v3.0
STR:
Result:
Compare results are cleared.
Originally opened in:
jsleroy/compare-plugin#7
Hello Pavel,
STR:
Compare.
Move to Other View.
Result:
The Diff Marks are not cleared in the other file.
I wonder why. Isn't a Close message sent when "Move to Other View" is executed?
Thank you.
BR
CP c1989be
NPP 6.9.1
Win7 SP1 [64]
After closing NavBar and then switching focus to other view, NavBar re-opens.
Reproduce 1:
NavBar re-opens
Reproduce 2:
NavBar re-opens
Hello Pavel,
As of now the Progress Bar doesn't work properly.
Personally I'd remove it and go for this (in the future :) ).
What do you think?
I've removed the relevant code in Compare.cpp, the Progress folder and modified some more files.
BR.
Hello Pavel,
I've tried to zoom in a bit (i.e. I've taken a second look at some parts of Compare.cpp) and found that Reset() is called if the user selects to close both compared-matched files.
It seems that some parts of Reset() are irrelevant in this case.
(Actually , this is true even if the files do not match and the user closes one or both).
I assume you've already noticed that. Just in case. :)
Thank you very much.
Best regards.
BR,
Pavel
Originally opened in:
jsleroy/compare-plugin#16
Hello Pavel,
After testing the new version (and briefly looking at the re-written Compare.cpp) I'm just beginning to appreciate your remarkable accomplishment.
When we first discussed the concept of Multiple Compares I thought it would take you at least a few months. :) Amazing.
The design and structure are simply beautiful.
On behalf of myself and thousands of future happy users: Thank you!
As you have mentioned this is the first draft and naturally it has some issues.
With some minor adjustments and fine-tuning Compare Plugin v2.0 (yes, this should be the new version) would be a masterpiece.
I know you you don't like opened issues. You can close this one. :)
Best regards.
I think it's good to have a reference to this issue.
Hello Pavel,
How about providing icons for Compare and Clear Current Compare?
If you want to be really sophisticated you might get the "ScintillaViewsSplitter"
setting from config.xml and accordingly use either Compare Horizontal.bmp or Compare Vertical.bmp.
But on a more serious note, it wouldn't be difficult to offer a version with Horizontal icons and another with Vertical ones.
When disabled, 16bpp and 32bpp images look differently on the toolbar.
I have converted the navigation icons to 32bpp for consistency.
Thank you.
Best regards.
New Images.zip
Thank you. :)
Hello Pavel,
If the Customize Toolbar plugin is not installed, the Compare's toolbar buttons are always enabled.
I think it's important to address this issue (especially now that you enable/disable the commands much more frequently).
If the Customize Toolbar plugin IS installed, there's a problem which is probably related to that plugin.
Still, please have a look.
STR:
Open three files.
Compare.
Activate the third not-compared file.
Activate the compared file at bottom.
Result:
The Compare's toolbar buttons are disabled.
NOTE: If you open a menu and move to another one (e.g. press File and move to Edit), the buttons' state is updated.
Thank you.
BR
Close Progress, re-enable N++ and free resources accordingly.
Hi all,
This is not an issue but rather a place where we can discuss ideas, suggestions, ask help and talk about whatever else concerning Compare plugin.
Feel free to post :)
BR,
Pavel
CP 1d3e95a
NPP 6.9.1
Win7SP1[64]
Result: diff marks are cleared and B is closed in the main view: (A | B)
Expected: diff marks are cleared and no further action: (A B | B)
No big deal, as I would normally close B in the sub view (I can now move B to the main view instead), but I thought I should mention it anyway.
Hello Pavel,
In order to remove the following warning
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(1193,5): warning MSB8012: TargetPath(C:\Users---\Documents\Visual Studio 2013\Projects\ComparePlugin.v1.5.6.8\projects\2013....\Notepad++\plugins\Compare.dll) does not match the Linker's OutputFile property value (C:\Users---\Documents\Visual Studio 2013\Projects\ComparePlugin.v1.5.6.8\Notepad++\plugins\ComparePlugin.dll). This may cause your project to build incorrectly. To correct this, please make sure that
$(OutDir), $ (TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile).
I've changed the Target Name to ComparePlugin.
Project -> Properties...
Configuration Properties
Change Target Name to ComparePlugin.
Good idea?
Thank you.
STR:
Open the files in Test.zip.
Activate compatibility.ini and Compare.
Delete line 3.
Result:
Line 3 has both "Deleted" and "Different" images.
** Even if line 4 was not "Different", the diff marks from line 3 shouldn't be moved but removed.
** I don't expect Compare Plugin to dynamically re-compare, but it would be good to fix this issue if possible.
STR:
Open two files.
Change anything in one file (do not save).
Compare to last Save.
Clear Results.
Result:
The temp file is not discarded.
Originally opened in:
jsleroy/compare-plugin#18
Hello Pavel,
STR:
Have two files in the top view and two others in the bottom view.
Compare.
Activate a not-compared file.
Activate the not-compared file in the other view.
Result:
The compared files are activated.
Thank you.
BR
Those are marked as if they differ even if they don't.
CP 1d3e95a
NPP 6.9.1
Win7SP1[64]
I see this often, as I always keep the Find dialogue open (maximum transparency on losing focus).
This is just one of many ways to reproduce:
Result: B-A Compare is performed, subsequently focus is set to Find dialogue.
Expected: B-A Compare is performed, subsequently focus is set to B.
[Preferred: A-B Compare is performed, afterwards focus is set to A. But that's a different issue ;) ]
No big deal, as pressing Win+Tab
will return focus to B, but it's a bit unusual, and most likely not intentional behaviour. :)
Hello Pavel,
A minor issue:
Truncating the file names in the Progress Bar is necessary.
In a MessageBox, however, Windows can handle the untruncated names and I think it would look more professional if they were fully displayed.
Do you think it's worth the extra code and overhead?
Thank you very much.
BR
In single view the order of files is changed after "Clear Compare". This behaviour is rather annoying. ๐
It would be desirable to restore the original file order after compare.
Example 1:
Alt+F
Alt+D
Alt+Shift+D
(back to single view)The file order has changed to A, B, D, C (from left to right).
Example 2:
Alt+F
Alt+D
Alt+Shift+D
(back to single view)The file order has changed to A, C, D, B.
[originally inappropriately reported in this comment]
Start NPP.
Open 2 new empty files.
Compare.
Result:
The second file is closed.
A new extra Status Bar for Compare could be useful.
It should have the following segments:
Total diffs.
No. of added lines.
No. of removed lines.
No. of not equal lines.
No. of moved lines.
Various messages: "No files to compare.", "Can not locate Git." etc.
A small Progress Bar.
Pressing "Clear Results" should terminate the process and close the status bar.
Originally opened in:
jsleroy/compare-plugin#9
Hello Pavel,
STR:
Start NPP.
Open two files.
Open NPP Function List.
Compare.
Result:
Mouse-Scroll over either view doesn't work until pressing somewhere in the editor.
NOTE:
It seems the problem only occurs after the first Compare.
It works properly if you Clear Results and compare again.
Thank you.
Replace
:MessageBox(nppData._nppHandle, TEXT("No file to open"), TEXT("error"), MB_OK);
with
::MessageBox(nppData._nppHandle, TEXT("No file to open."), TEXT("Compare Plugin"), MB_OK);
Replace
MessageBox(nppData._nppHandle, L"Can't locate SVN information", L"ComparePlugin", MB_OK);
with
MessageBox(nppData._nppHandle, L"Can not locate SVN information.", L"Compare Plugin", MB_OK);
Replace
MessageBox(nppData._nppHandle, L"Can't locate GIT information", L"ComparePlugin", MB_OK);
with
MessageBox(nppData._nppHandle, L"Can not locate GIT information.", L"Compare Plugin", MB_OK);
Replace
::MessageBox(nppData._nppHandle, TEXT("Nothing to compare!"), TEXT("Error"), MB_OK);
with
::MessageBox(nppData._nppHandle, TEXT("No files to compare."), TEXT("Compare Plugin"), MB_OK);
Thank you.
Hello Pavel,
Continued from #10 (comment).
If I understand "Select first" correctly, you want to give the user another option besides "Compare current to previous".
This can be very useful if you have multiple files open in Single-View mode. Great!
So why not implement it as "Compare current to last active" instead of "Select first" which is less intuitive and clear? (No offense please :) ).
Compare: Compare current to previous (Single-View) or Compare current to the active file in the other view.
Compare current to last active: should only be available in Single-View mode.
What do you think?
Anyway, I think you should add a Help item opening a window (a long message box) briefly describing the various options.
Thank you.
Best regards.
STR:
Open two files.
Activate the left file and change anything in it (do not save).
Compare to last Save.
Result:
The existing files are compared and the changes are "undone".
Hello Pavel,
Continued from #27 (comment).
This makes sense.
However, and with your permission, there's a difference between Match and Cancel:
In the first case we have to display a message box anyway; so why not offer an option to close the files?
In the second case the message box is not necessary.
Good modern applications avoid using message boxes (interrupting the workflow and forcing the user to press OK) if possible.
I hope you agree. :)
Thank you.
BR
I've removed the three blocks starting with
::EnableMenuItem(hMenu, funcItem[CMD_PREV]._cmdID
Other commands are not enabled/disabled. Why those?
Thank you.
STR:
Open two files.
Compare.
Reopen a file from the Recently Closed Files list.
Switch back to the compared files.
Result:
Some (or all) Diff Marks are cleared.
Hello Pavel,
I never use the NavBar. Do you?
I also don't use "Compare to Git" and "Compare to SVN".
IMO, "Use old symbols" (in Options) can be removed.
What do you think about a Lite Compare version without those components?
(Some day in the future when the more urgent tasks have been accomplished). :)
Best regards.
STR:
Open two files.
Compare.
Reopen a file from the Recently Closed Files list.
Clear All Compares
Result:
Temporarily empty lines are not removed.
STR:
Result:
We're still in Two-Views mode.
Originally opened in:
jsleroy/compare-plugin#15
Hello Pavel,
When multiple Compares are not disabled.
STR:
Open four files.
Place two in the top view and two in the bottom view.
Compare the two files on the left.
Switch to the other two files.
Compare.
Switch back to the files on the left.
Press Clear Results.
Switch to the other two files.
Result:
The views are not synced.
Related: #13
Best regards.
When comparing In One-View mode, the current file and the previous file should be compared.
Also, the current file should always get the top (or left) view.
NOTE:
This fix (current at top) does not address "Compare to last Save".
I've never used "Compare to Git".
Replace
if(!IsWindowVisible(nppData._scintillaMainHandle) || !IsWindowVisible(nppData._scintillaSecondHandle))
{
skipAutoReset = true;
SendMessage(nppData._nppHandle, WM_COMMAND, IDM_VIEW_GOTO_ANOTHER_VIEW, 0);
skipAutoReset = false;
panelsOpened = true;
}
with
if(!IsWindowVisible(nppData._scintillaMainHandle) || !IsWindowVisible(nppData._scintillaSecondHandle)) // Yaron - One-View mode.
{
skipAutoReset = true;
// Yaron - In One-View mode, the current view can be 0 or 1.
// In Two-Views mode, the top (or left) view is ALWAYS 0, and the bottom view is ALWAYS 1.
int currentView = SendMessage(nppData._nppHandle, NPPM_GETCURRENTVIEW, 0, 0);
LRESULT bufferID = SendMessage(nppData._nppHandle, NPPM_GETCURRENTBUFFERID, 0, 0);
// Yaron - If the current view is 0, we want the prev file to be moved to the bottom; if the current view is 1, we still need to activate it and make sure it's compared to the current file.
SendMessage(nppData._nppHandle, WM_COMMAND, IDM_VIEW_TAB_PREV, 0);
if(currentView == 1)
{
bufferID = SendMessage(nppData._nppHandle, NPPM_GETCURRENTBUFFERID, 0, 0);
SendMessage(nppData._nppHandle, WM_COMMAND, IDM_VIEW_TAB_NEXT, 0); // Yaron - Switch back to current file.
}
SendMessage(nppData._nppHandle, WM_COMMAND, IDM_VIEW_GOTO_ANOTHER_VIEW, 0); // Yaron - Current file is ALWAYS at top, and prev file is ALWAYS at bottom.
activateBufferID(bufferID, currentView); // Yaron - If the current view is 0, activate current file at top; if the current view is 1, activate prev file at bottom (possibly multiple files there).
if (currentView == 1)
SendMessage(nppData._nppHandle, WM_COMMAND, IDM_VIEW_SWITCHTO_OTHER_VIEW, 0); // Yaron - Activate current file at top.
skipAutoReset = false;
panelsOpened = true;
}
and add the following function
void activateBufferID(LRESULT bufferID, int view)
{
LRESULT index = SendMessage(nppData._nppHandle, NPPM_GETPOSFROMBUFFERID, bufferID, view);
index = index & 0x3FFFFFFF;
SendMessage(nppData._nppHandle, NPPM_ACTIVATEDOC, view, index);
}
Thank you.
After the line
FlashWindowEx(&flashInfo);
add
MessageBeep(MB_OK); // Yaron - Sound notification.
Thank you.
Replace
funcItem[CMD_COMPARE_LAST_SAVE]._pFunc = compareLocal;
lstrcpy(funcItem[CMD_COMPARE_LAST_SAVE]._itemName, TEXT("Compare to last save"));
funcItem[CMD_COMPARE_LAST_SAVE]._pShKey = new ShortcutKey;
funcItem[CMD_COMPARE_LAST_SAVE]._pShKey->_isAlt = true;
funcItem[CMD_COMPARE_LAST_SAVE]._pShKey->_isCtrl = false;
funcItem[CMD_COMPARE_LAST_SAVE]._pShKey->_isShift = false;
funcItem[CMD_COMPARE_LAST_SAVE]._pShKey->_key = 'S';
funcItem[CMD_COMPARE_LAST_SAVE]._init2Check = false;
funcItem[CMD_COMPARE_SVN_BASE]._pFunc = compareSvnBase;
lstrcpy(funcItem[CMD_COMPARE_SVN_BASE]._itemName, TEXT("Compare against SVN base"));
funcItem[CMD_COMPARE_SVN_BASE]._pShKey = new ShortcutKey;
funcItem[CMD_COMPARE_SVN_BASE]._pShKey->_isAlt = true;
funcItem[CMD_COMPARE_SVN_BASE]._pShKey->_isCtrl = false;
funcItem[CMD_COMPARE_SVN_BASE]._pShKey->_isShift = false;
funcItem[CMD_COMPARE_SVN_BASE]._pShKey->_key = 'B';
funcItem[CMD_COMPARE_SVN_BASE]._init2Check = false;
funcItem[CMD_COMPARE_GIT_BASE]._pFunc = compareGitBase;
lstrcpy(funcItem[CMD_COMPARE_GIT_BASE]._itemName, TEXT("Compare against GIT base"));
funcItem[CMD_COMPARE_GIT_BASE]._pShKey = new ShortcutKey;
funcItem[CMD_COMPARE_GIT_BASE]._pShKey->_isAlt = true;
funcItem[CMD_COMPARE_GIT_BASE]._pShKey->_isCtrl = true;
funcItem[CMD_COMPARE_GIT_BASE]._pShKey->_isShift = false;
funcItem[CMD_COMPARE_GIT_BASE]._pShKey->_key = 'B';
funcItem[CMD_COMPARE_GIT_BASE]._init2Check = false;
funcItem[CMD_SEPARATOR_2]._pFunc = NULL;
lstrcpy(funcItem[CMD_SEPARATOR_2]._itemName, TEXT("------------"));
funcItem[CMD_SEPARATOR_2]._pShKey = NULL;
funcItem[CMD_ALIGN_MATCHES]._pFunc = alignMatches;
lstrcpy(funcItem[CMD_ALIGN_MATCHES]._itemName, TEXT("Align Matches"));
funcItem[CMD_ALIGN_MATCHES]._pShKey = NULL;
funcItem[CMD_ALIGN_MATCHES]._init2Check = false;
funcItem[CMD_IGNORE_SPACING]._pFunc = includeSpacing;
lstrcpy(funcItem[CMD_IGNORE_SPACING]._itemName, TEXT("Ignore Spacing"));
funcItem[CMD_IGNORE_SPACING]._pShKey = NULL;
funcItem[CMD_IGNORE_SPACING]._init2Check = false;
funcItem[CMD_DETECT_MOVES]._pFunc = detectMoves;
lstrcpy(funcItem[CMD_DETECT_MOVES]._itemName, TEXT("Detect Moves"));
funcItem[CMD_DETECT_MOVES]._pShKey = NULL;
funcItem[CMD_DETECT_MOVES]._init2Check = false;
funcItem[CMD_USE_NAV_BAR]._pFunc = ViewNavigationBar;
lstrcpy(funcItem[CMD_USE_NAV_BAR]._itemName, TEXT("Navigation bar"));
funcItem[CMD_USE_NAV_BAR]._pShKey = NULL;
funcItem[CMD_USE_NAV_BAR]._init2Check = false;
funcItem[CMD_SEPARATOR_3]._pFunc = NULL;
lstrcpy(funcItem[CMD_SEPARATOR_3]._itemName, TEXT("-----------"));
funcItem[CMD_SEPARATOR_3]._pShKey = NULL;
funcItem[CMD_PREV]._pFunc = Prev;
lstrcpy(funcItem[CMD_PREV]._itemName, TEXT("Previous"));
funcItem[CMD_PREV]._pShKey = new ShortcutKey;
funcItem[CMD_PREV]._pShKey->_isAlt = false;
funcItem[CMD_PREV]._pShKey->_isCtrl = true;
funcItem[CMD_PREV]._pShKey->_isShift = false;
funcItem[CMD_PREV]._pShKey->_key = VK_PRIOR;
funcItem[CMD_PREV]._init2Check = false;
funcItem[CMD_NEXT]._pFunc = Next;
lstrcpy(funcItem[CMD_NEXT]._itemName, TEXT("Next"));
funcItem[CMD_NEXT]._pShKey = new ShortcutKey;
funcItem[CMD_NEXT]._pShKey->_isAlt = false;
funcItem[CMD_NEXT]._pShKey->_isCtrl = true;
funcItem[CMD_NEXT]._pShKey->_isShift = false;
funcItem[CMD_NEXT]._pShKey->_key = VK_NEXT;
funcItem[CMD_NEXT]._init2Check = false;
funcItem[CMD_FIRST]._pFunc = First;
lstrcpy(funcItem[CMD_FIRST]._itemName, TEXT("First"));
funcItem[CMD_FIRST]._pShKey = new ShortcutKey;
funcItem[CMD_FIRST]._pShKey->_isAlt = false;
funcItem[CMD_FIRST]._pShKey->_isCtrl = true;
funcItem[CMD_FIRST]._pShKey->_isShift = true;
funcItem[CMD_FIRST]._pShKey->_key = VK_PRIOR;
funcItem[CMD_FIRST]._init2Check = false;
funcItem[CMD_LAST]._pFunc = Last;
lstrcpy(funcItem[CMD_LAST]._itemName, TEXT("Last"));
funcItem[CMD_LAST]._pShKey = new ShortcutKey;
funcItem[CMD_LAST]._pShKey->_isAlt = false;
funcItem[CMD_LAST]._pShKey->_isCtrl = true;
funcItem[CMD_LAST]._pShKey->_isShift = true;
funcItem[CMD_LAST]._pShKey->_key = VK_NEXT;
funcItem[CMD_LAST]._init2Check = false;
funcItem[CMD_SEPARATOR_4]._pFunc = NULL;
lstrcpy(funcItem[CMD_SEPARATOR_4]._itemName, TEXT("-----------"));
funcItem[CMD_SEPARATOR_4]._pShKey = NULL;
funcItem[CMD_OPTION]._pFunc = openOptionDlg;
lstrcpy(funcItem[CMD_OPTION]._itemName, TEXT("Option"));
funcItem[CMD_OPTION]._pShKey = NULL;
funcItem[CMD_OPTION]._init2Check = false;
with
funcItem[CMD_COMPARE_LAST_SAVE]._pFunc = compareLocal;
lstrcpy(funcItem[CMD_COMPARE_LAST_SAVE]._itemName, TEXT("Compare to last Save"));
funcItem[CMD_COMPARE_LAST_SAVE]._pShKey = new ShortcutKey;
funcItem[CMD_COMPARE_LAST_SAVE]._pShKey->_isAlt = true;
funcItem[CMD_COMPARE_LAST_SAVE]._pShKey->_isCtrl = false;
funcItem[CMD_COMPARE_LAST_SAVE]._pShKey->_isShift = false;
funcItem[CMD_COMPARE_LAST_SAVE]._pShKey->_key = 'S';
funcItem[CMD_COMPARE_LAST_SAVE]._init2Check = false;
funcItem[CMD_COMPARE_SVN_BASE]._pFunc = compareSvnBase;
lstrcpy(funcItem[CMD_COMPARE_SVN_BASE]._itemName, TEXT("Compare to SVN base"));
funcItem[CMD_COMPARE_SVN_BASE]._pShKey = new ShortcutKey;
funcItem[CMD_COMPARE_SVN_BASE]._pShKey->_isAlt = true;
funcItem[CMD_COMPARE_SVN_BASE]._pShKey->_isCtrl = false;
funcItem[CMD_COMPARE_SVN_BASE]._pShKey->_isShift = false;
funcItem[CMD_COMPARE_SVN_BASE]._pShKey->_key = 'B';
funcItem[CMD_COMPARE_SVN_BASE]._init2Check = false;
funcItem[CMD_COMPARE_GIT_BASE]._pFunc = compareGitBase;
lstrcpy(funcItem[CMD_COMPARE_GIT_BASE]._itemName, TEXT("Compare to GIT base"));
funcItem[CMD_COMPARE_GIT_BASE]._pShKey = new ShortcutKey;
funcItem[CMD_COMPARE_GIT_BASE]._pShKey->_isAlt = true;
funcItem[CMD_COMPARE_GIT_BASE]._pShKey->_isCtrl = true;
funcItem[CMD_COMPARE_GIT_BASE]._pShKey->_isShift = false;
funcItem[CMD_COMPARE_GIT_BASE]._pShKey->_key = 'G'; // Yaron
funcItem[CMD_COMPARE_GIT_BASE]._init2Check = false;
funcItem[CMD_SEPARATOR_2]._pFunc = NULL;
lstrcpy(funcItem[CMD_SEPARATOR_2]._itemName, TEXT("------------"));
funcItem[CMD_SEPARATOR_2]._pShKey = NULL;
funcItem[CMD_ALIGN_MATCHES]._pFunc = alignMatches;
lstrcpy(funcItem[CMD_ALIGN_MATCHES]._itemName, TEXT("Align Matches"));
funcItem[CMD_ALIGN_MATCHES]._pShKey = NULL;
funcItem[CMD_ALIGN_MATCHES]._init2Check = false;
funcItem[CMD_IGNORE_SPACING]._pFunc = includeSpacing;
lstrcpy(funcItem[CMD_IGNORE_SPACING]._itemName, TEXT("Ignore Spacing"));
funcItem[CMD_IGNORE_SPACING]._pShKey = NULL;
funcItem[CMD_IGNORE_SPACING]._init2Check = false;
funcItem[CMD_DETECT_MOVES]._pFunc = detectMoves;
lstrcpy(funcItem[CMD_DETECT_MOVES]._itemName, TEXT("Detect Moves"));
funcItem[CMD_DETECT_MOVES]._pShKey = NULL;
funcItem[CMD_DETECT_MOVES]._init2Check = false;
funcItem[CMD_USE_NAV_BAR]._pFunc = ViewNavigationBar;
lstrcpy(funcItem[CMD_USE_NAV_BAR]._itemName, TEXT("Navigation Bar"));
funcItem[CMD_USE_NAV_BAR]._pShKey = NULL;
funcItem[CMD_USE_NAV_BAR]._init2Check = false;
funcItem[CMD_SEPARATOR_3]._pFunc = NULL;
lstrcpy(funcItem[CMD_SEPARATOR_3]._itemName, TEXT("-----------"));
funcItem[CMD_SEPARATOR_3]._pShKey = NULL;
funcItem[CMD_PREV]._pFunc = Prev;
lstrcpy(funcItem[CMD_PREV]._itemName, TEXT("Previous"));
funcItem[CMD_PREV]._pShKey = new ShortcutKey;
funcItem[CMD_PREV]._pShKey->_isAlt = true; // Yaron
funcItem[CMD_PREV]._pShKey->_isCtrl = false;
funcItem[CMD_PREV]._pShKey->_isShift = false;
funcItem[CMD_PREV]._pShKey->_key = VK_PRIOR;
funcItem[CMD_PREV]._init2Check = false;
funcItem[CMD_NEXT]._pFunc = Next;
lstrcpy(funcItem[CMD_NEXT]._itemName, TEXT("Next"));
funcItem[CMD_NEXT]._pShKey = new ShortcutKey;
funcItem[CMD_NEXT]._pShKey->_isAlt = true; // Yaron
funcItem[CMD_NEXT]._pShKey->_isCtrl = false;
funcItem[CMD_NEXT]._pShKey->_isShift = false;
funcItem[CMD_NEXT]._pShKey->_key = VK_NEXT;
funcItem[CMD_NEXT]._init2Check = false;
funcItem[CMD_FIRST]._pFunc = First;
lstrcpy(funcItem[CMD_FIRST]._itemName, TEXT("First"));
funcItem[CMD_FIRST]._pShKey = new ShortcutKey;
funcItem[CMD_FIRST]._pShKey->_isAlt = true; // Yaron
funcItem[CMD_FIRST]._pShKey->_isCtrl = true;
funcItem[CMD_FIRST]._pShKey->_isShift = false;
funcItem[CMD_FIRST]._pShKey->_key = VK_PRIOR;
funcItem[CMD_FIRST]._init2Check = false;
funcItem[CMD_LAST]._pFunc = Last;
lstrcpy(funcItem[CMD_LAST]._itemName, TEXT("Last"));
funcItem[CMD_LAST]._pShKey = new ShortcutKey;
funcItem[CMD_LAST]._pShKey->_isAlt = true; // Yaron
funcItem[CMD_LAST]._pShKey->_isCtrl = true;
funcItem[CMD_LAST]._pShKey->_isShift = false;
funcItem[CMD_LAST]._pShKey->_key = VK_NEXT;
funcItem[CMD_LAST]._init2Check = false;
funcItem[CMD_SEPARATOR_4]._pFunc = NULL;
lstrcpy(funcItem[CMD_SEPARATOR_4]._itemName, TEXT("-----------"));
funcItem[CMD_SEPARATOR_4]._pShKey = NULL;
funcItem[CMD_OPTION]._pFunc = openOptionDlg;
lstrcpy(funcItem[CMD_OPTION]._itemName, TEXT("Options")); // Yaron
funcItem[CMD_OPTION]._pShKey = NULL;
funcItem[CMD_OPTION]._init2Check = false;
Thank you.
In AboutDialog.cpp replace
_urlNppPlugins.create(::GetDlgItem(_hSelf, IDC_NPP_PLUGINS_URL), _T("http://sourceforge.net/projects/npp-plugins/"));
with
_urlNppPlugins.create(::GetDlgItem(_hSelf, IDC_NPP_PLUGINS_URL), _T("https://github.com/pnedev/compare-plugin"));
What do you think?
Replace
if(!different)
{
::MessageBox(nppData._nppHandle, TEXT("Files Match"), TEXT("Results :"), MB_OK);
return true;
}
with
if (!different)
{
if (::MessageBox(nppData._nppHandle, TEXT("Files match.\n\nClose compared files?"), TEXT("Compare Plugin"), MB_YESNO | MB_ICONQUESTION/* | MB_DEFBUTTON2 */) == IDYES) // Yaron - An option to close compared files.
{
SendMessage(nppData._nppHandle, WM_COMMAND, IDM_FILE_CLOSE, 0);
SendMessage(nppData._nppHandle, WM_COMMAND, IDM_VIEW_SWITCHTO_OTHER_VIEW, 0);
SendMessage(nppData._nppHandle, WM_COMMAND, IDM_FILE_CLOSE, 0);
SendMessage(nppData._nppHandle, WM_COMMAND, IDM_VIEW_SWITCHTO_OTHER_VIEW, 0);
}
return true;
}
Personally I prefer "Yes" to be the default button.
Uncomment | MB_DEFBUTTON2
if you think "No" should be default.
Thank you.
Hello Pavel,
Continued from #29 (comment).
That sounds reasonable. Anyway, I'll prompt (with default to 'yes' - re-compare) if the re-compare was deliberate just in case you triggered it by mistake (some files may need much time to compare).
Allow me to suggest a different view:
Personally and based on previous experience I'd rather not have any prompt in this case.
I often make some changes in the files while Compare is active and then I want to re-compare them.
I believe that this would be more common (than accidentally pressing Compare again) for other users as well.
What do you think?
Thank you.
BR
Hello Pavel,
Implementing bcfcea5 (the current-file-at-top part), the active file when returning to One-View mode is not the originally active one but rather the other file.
It can be annoying and I think it should be addressed.
Unfortunately, and unlike you, I've never tried to learn how the various parts of the code interact (not even in Compare.cpp).
I believe that while re-writing the code you may find a better way to achieve that.
(Use an existing variable or some other way).
Add a global LRESULT originallyActiveBufferID;
Replace
LRESULT bufferID = SendMessage(nppData._nppHandle, NPPM_GETCURRENTBUFFERID, 0, 0);
with
LRESULT bufferID = originallyActiveBufferID = SendMessage(nppData._nppHandle, NPPM_GETCURRENTBUFFERID, 0, 0);
and replace
if (panelsOpened && (closingWin == -1))
{
::SendMessage(nppData._scintillaSecondHandle, SCI_GRABFOCUS, 0, (LPARAM)0);
skipAutoReset = true;
SendMessage(nppData._nppHandle, WM_COMMAND, IDM_VIEW_GOTO_ANOTHER_VIEW, 0);
skipAutoReset = false;
}
with
if (panelsOpened && (closingWin == -1))
{
::SendMessage(nppData._scintillaSecondHandle, SCI_GRABFOCUS, 0, (LPARAM)0);
skipAutoReset = true;
SendMessage(nppData._nppHandle, WM_COMMAND, IDM_VIEW_GOTO_ANOTHER_VIEW, 0);
// Yaron - We could use "::SendMessage(nppData._scintillaMainHandle, SCI_GRABFOCUS, 0, (LPARAM)0);"
// and thus have the original file activated (and avoid the following activateBufferID); but I think it's better to have
// currentView == 0 when switching to Onw-View mode (currentView == 0 is the start/normal state;
// if multiple files are open, most would remain in the top view when comparing).
activateBufferID(originallyActiveBufferID, 0);
skipAutoReset = false;
}
Thank you very much. I really appreciate your work.
Best regards.
STR:
Result:
"NUL" is added to the files.
Originally opened in:
jsleroy/compare-plugin#8
See also:
https://notepad-plus-plus.org/community/topic/11307/plug-in-compare-bug/7
STR:
Single-View and view's ID is SUB_VIEW.
Open three files.
Compare.
Result:
Diff marks are not cleared in one file.
If you compare again, current and next are compared.
Thank you.
Replace
/* sync pannels */
HMENU hMenu = ::GetMenu(nppData._nppHandle);
syncScrollVwasChecked = (::GetMenuState(hMenu, IDM_VIEW_SYNSCROLLV, MF_BYCOMMAND) & MF_CHECKED) != 0;
syncScrollHwasChecked = (::GetMenuState(hMenu, IDM_VIEW_SYNSCROLLH, MF_BYCOMMAND) & MF_CHECKED) != 0;
if (syncScrollVwasChecked)
::SendMessage(nppData._nppHandle, WM_COMMAND, MAKELONG(IDM_VIEW_SYNSCROLLV, 0), 0);
if (syncScrollHwasChecked)
::SendMessage(nppData._nppHandle, WM_COMMAND, MAKELONG(IDM_VIEW_SYNSCROLLH, 0), 0);
// let the second view inherit the zoom level of the main view
int mainZoomLevel = SendMessage(nppData._scintillaMainHandle, SCI_GETZOOM, 0, 0);
SendMessage(nppData._scintillaSecondHandle, SCI_SETZOOM, mainZoomLevel, 0);
::SendMessageA(nppData._scintillaMainHandle, SCI_GOTOPOS, 1, 0);
::SendMessageA(nppData._scintillaSecondHandle, SCI_GOTOPOS, 1, 0);
::SendMessage(nppData._nppHandle, WM_COMMAND, MAKELONG(IDM_VIEW_SYNSCROLLH, 0), 0);
::SendMessageA(nppData._scintillaMainHandle, SCI_SETUNDOCOLLECTION, FALSE, 0);
::SendMessageA(nppData._scintillaSecondHandle, SCI_SETUNDOCOLLECTION, FALSE, 0);
with
// Yaron - Change code location.
::SendMessageA(nppData._scintillaMainHandle, SCI_GOTOPOS, 0, 0); // Yaron - pos 0, 0. Why 1, 0?
::SendMessageA(nppData._scintillaSecondHandle, SCI_GOTOPOS, 0, 0);
//::SendMessage(nppData._nppHandle, WM_COMMAND, MAKELONG(IDM_VIEW_SYNSCROLLV, 0), 0); // Yaron - Not nedded.
::SendMessageA(nppData._scintillaMainHandle, SCI_SETUNDOCOLLECTION, FALSE, 0);
::SendMessageA(nppData._scintillaSecondHandle, SCI_SETUNDOCOLLECTION, FALSE, 0);
/* sync pannels */
HMENU hMenu = ::GetMenu(nppData._nppHandle);
syncScrollVwasChecked = (::GetMenuState(hMenu, IDM_VIEW_SYNSCROLLV, MF_BYCOMMAND) & MF_CHECKED) != 0;
syncScrollHwasChecked = (::GetMenuState(hMenu, IDM_VIEW_SYNSCROLLH, MF_BYCOMMAND) & MF_CHECKED) != 0;
if (syncScrollVwasChecked) // Yaron - Disable vertical scroll sync. Use "case SCN_UPDATEUI:".
::SendMessage(nppData._nppHandle, WM_COMMAND, MAKELONG(IDM_VIEW_SYNSCROLLV, 0), 0);
if (!syncScrollHwasChecked) // Yaron - Enable horizontal scroll sync.
::SendMessage(nppData._nppHandle, WM_COMMAND, MAKELONG(IDM_VIEW_SYNSCROLLH, 0), 0);
// let the second view inherit the zoom level of the main view
int mainZoomLevel = SendMessage(nppData._scintillaMainHandle, SCI_GETZOOM, 0, 0);
SendMessage(nppData._scintillaSecondHandle, SCI_SETZOOM, mainZoomLevel, 0);
Why call
if (syncScrollHwasChecked)
::SendMessage(nppData._nppHandle, WM_COMMAND, MAKELONG(IDM_VIEW_SYNSCROLLH, 0), 0);
and then again
::SendMessage(nppData._nppHandle, WM_COMMAND, MAKELONG(IDM_VIEW_SYNSCROLLH, 0), 0);
? - Do it once.
NOTE: I've also changed SCI_GOTOPOS, 1, 0);
to SCI_GOTOPOS, 0, 0);
.
What do you think?
Thank you.
Hello Pavel,
STR:
Compare.
Close one of the compared files.
Or:
Compare.
Files match. Close? - Yes.
Result:
Compare margin is not removed.
Thank you.
BR
Hello Pavel,
The file at top is considered the old version and is compared to the new one at bottom (i.e. the "Line deleted" marks are always at top, and the "Line added" marks are at bottom).
Obviously the correct arrangement is up to the user and we can't control it.
However, in "Compare to last Save" we know that the original file is the new version.
I think, therefor, that if we start in One-View mode we should make sure that the original file is always placed at bottom.
That means checking if "currentView == 1" and make the appropriate adjustments.
Thank you.
Best regards.
Hello Pavel,
Existing in previous versions as well.
STR:
Single-View and view's ID is SUB_VIEW.
Open two files.
Compare.
Open a third file at top.
Clear Compare (or All Compares).
Result:
We're still in Two-Views mode.
I think we should activate the moved file before returning to Single-View.
Thank you.
BR
Hello Pavel,
This NPP bug is quite a problem for Compare users.
See jsleroy/compare-plugin#6.
Some simple changes in three NPP source files seem to solve this annoying issue.
In Notepad_plus.h replace
void doClose(BufferID, int whichOne, bool doDeleteBackup = false);
with
void doClose(BufferID, int whichOne, bool doDeleteBackup = false, bool addToClosedList = true);
In Notepad_plus.cpp replace
//just close the activate document, since thats the one we moved (no search)
doClose(_pEditView->getCurrentBufferID(), currentView());
with
//just close the activate document, since thats the one we moved (no search)
doClose(_pEditView->getCurrentBufferID(), currentView(), false, false);
In NppIO.cpp replace
void Notepad_plus::doClose(BufferID id, int whichOne, bool doDeleteBackup)
with
void Notepad_plus::doClose(BufferID id, int whichOne, bool doDeleteBackup, bool addToClosedList)
and also replace
if (PathFileExists(buf->getFullPathName()))
with
if (PathFileExists(buf->getFullPathName()) && addToClosedList)
If you don't find a problem in those modifications, could you please open a PR?
There's a chance Don might accept it. :).
Thank you. I appreciate your time.
Best regards.
Hello Pavel,
If you Compare when multiple files are open in Single-View mode, the original view's ID affects the following behavior:
If it's MAIN_VIEW most of the files are in the top view.
If it's SUB_VIEW most of the files are in the bottom view.
Most users don't know how NPP's "Move to Other View" is handled and might wonder about this inconsistency.
I think we should do whatever possible not to change the default view's ID in Single-View mode.
Currently after closing matched files, the view's ID is SUB_VIEW.
And therefore I think we should replace
::SendMessage(nppData._nppHandle, NPPM_MENUCOMMAND, 0, IDM_FILE_CLOSE);
::SendMessage(nppData._nppHandle, NPPM_MENUCOMMAND, 0, IDM_VIEW_SWITCHTO_OTHER_VIEW);
::SendMessage(nppData._nppHandle, NPPM_MENUCOMMAND, 0, IDM_FILE_CLOSE);
::SendMessage(nppData._nppHandle, NPPM_MENUCOMMAND, 0, IDM_VIEW_SWITCHTO_OTHER_VIEW);
with
HWND focusedView = ::GetFocus();
::SetFocus(nppData._scintillaSecondHandle);
::SendMessage(nppData._nppHandle, NPPM_MENUCOMMAND, 0, IDM_FILE_CLOSE);
::SendMessage(nppData._nppHandle, NPPM_MENUCOMMAND, 0, IDM_VIEW_SWITCHTO_OTHER_VIEW);
::SendMessage(nppData._nppHandle, NPPM_MENUCOMMAND, 0, IDM_FILE_CLOSE);
if (IsWindowVisible(focusedView))
::SetFocus(focusedView);
Thank you.
BR
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.