Closed ProgerXP closed 6 years ago
Additional notes regarding files in Extension.
IsSelectionModeValid
which will produce a MsgBox.
>Done. In addition IsSelectionModeValid
became to n2e_ShowPromptIfSelectionModeIsRectangle
to make the code clear.extern
s and inclusions in *.h or they were just copy pasted?
>Finished with a cleanup for includes/extern references.Escape HTML
should preserve selection unless original selection was empty.
>Doneelse
missing between }
and {
? If not then why a block is needed here?
if (skipcl)
{
int ti = 0;
for (; ti < skipcl; ++ti)
{
if (tchl - _left_braces == skipl[ti])
{
N2E_TRACE("Skipped braces pair found '%c'", *tchl);
skipl[ti] = -1;
goto NEXT;
}
}
} <<
{ <<
N2E_TRACE("Left bracket found '%c'", lch);
break;
}
>No, there is no missing else
-statement. Removed excess brackets.
//single word matches
//multiple words matches selection, all are visible on current page
// "selection edit"-mode, Ctrl+Tab to activate
total count '
- why apostrophe?
> Count-postfix added to corresponding variable name, useless comment removed.icase_compare
used anywhere?
>Removed.to_lower
uses hardcoded Russian char references? Why cannot it use a Unicode function?
>Removed useless to_lower
.if (VK_RETURN == key && GetKeyState(VK_SHIFT) >= 0)
>Shift-specific code was already removed during bug fixing for "new line"-commands.
n2e_SelectionInit
? iHighlightLineIfWindowInactive
, iWordNavigationMode
do not belong here.
SendMessage(hwndEdit, SCI_SETCARETLINEVISIBLEALWAYS, iHighlightLineIfWindowInactive, 0);
SendMessage(hwndEdit, SCI_SETWORDNAVIGATIONMODE, iWordNavigationMode, 0);
>n2e_SelectionInit
renamed to n2e_EditInit
to change its sense.
n2e_SelectionInit
.
>Done. Added n2e_EditSelectionInit()-subroutine.then we must don't check next matches
Anyhow HL_SELECT_INDICATOR must be there ?!?!
>Removed useless comments.
?!?!
and ???????
with !
.
>Done.Write unit tests that:
Write same tests for upcoming Base64 (#122) and QP (#124). >Done.
n2e_SelEditTimerProc
for?
>Already removedn2e_EnumProc
, instead of searching window title for substring (!!!) check its class as in EnumWndProc
.
>Done. Notepad2e windows are searched by window class prefix since different execution types (e.g. elevated, pasteboarded) affects the classname postfix.HWM_RELOAD_SETTINGS
to WM_N2E_RELOAD_SETTINGS
.
>Done.HWM_RELOAD_SETTINGS
to WM_USER + 0xFF
and of N2E_WHEEL_TIMER_ID
to 0xFF
.
>Done.isspace
be iswspace
instead (same with strchr/wcschr, etc.)?
>Fixed.
Additionally, n2e_IsSpace
is defined but used in just 1 place; calls to common functions like these should be normalized.
>Done.n2e_OFNHookProc
, why return/break are positioned so weirdly?
>Fixed.NULL != StrChr(L"_", ch)
instead of simple comparison?
>Done.SetWindowTitle
; they need to be moved into a short function that will collect arguments itself. This will also remove the need for ugly SaveWindowTitleParams and UpdateWindowTitle.
>Done. n2e_UpdateWindowTitle()-calls are used everywhere.Why/Do we need lexlink.js, Notepad2.vcproj/vcxproj/vcxproj.filters, Notepad2e.vcxproj, Notepad2e_vs2015.sln, vs2015_notepad2e.vssettings, wdkbuild\?
1. lexlink.js came from original sources. There is a description in the Readme.txt that this file can be used as a part of updating process of the set of supported lexer schemes (mentioned as LinkLex.js). Retained. 2. Removed vcxproj.filters. 3. Notepad2e.vcxproj - is a VS2015 project file. Retained. 4. Removed Notepad2e_vs2015.sln. 5. vs2015_notepad2e.vssettings - contains approved text formatting settings, should be used to adjust VS2015 text editor when starting work with project sources. Retained. 6. wdkbuild\ folder came from original sources. Readme.txt states wdkbuild's scripts can be used to build compact executable program file using Windows Driver Kit tools. Retained.
Please see my comments >inline.
Please see my comments >inline.
Comments where?
Understood.
- Why some 2e-specific functions don't have prefixes? In
EditHelper.h
and elsewhere.Done. The point here was to rename the functions which are directly called from the N2-code.
All functions and other symbols that are exported (in .h) should have the prefix. Symbols only used inside .c/pp don't have to have the prefix. >Done.
LVS_EX_FULLROWSELECT for FavoritesDlgProc, FileMRUDlgProc, SelectEncodingDlgProc
Yes, this feels definitely better than without full row select. What other listviews we have that don't have this style? > Added the same style to: 1. OpenWithDlgProc, "Open with..." dialog, Alt+L 2. Style_SelectLexerDlgProc, "Syntax Scheme" dialog, F12
Replace tabs with spaces everywhere.
Tabs are still left in many c/h files for alignment. Please replace them with spaces.
> Fixed.
Ensure all text files (any extension) end with a new line (as in POSIX).
Add to Notepad2.ver and to printtime.bat too.
> Fixed.
Rename "hilite" to "highlight" everywhere in the original code (no need to [2e]-comment this).
I can see IDM_VIEW_HILITECURRENTLINE in resource.h but I cannot find where it's used. Is it unused?
> Removed unused identifiers.
Move autoclosing tag handling to a 2e function (
// Auto close tags
) and reuse it in Edit.c'sEditInsertTagDlgProc
instead of the serious code duplication.
Didn't help at all. At least let's move checking for tags that shouldn't be closed into a separate function (currently it tests for 2 different sets of tags even though logically these sets must be the same).
> Done. n2e_IsValidClosingTagA/n2e_IsValidClosingTagW functions implemented.
In the about dialog, remove version from the first label (
Notepad 2e 4.2.25
) and insert a new label (same style as the copyright) sayingBased on Notepad2 4.2.25
and shift down other labels.
The first label should have a space before "2e":
LTEXT "Notepad2e",IDC_VERSION,42,7,174,8
> Fixed.
Notepad2 doesn't and won't have code folding, what this code block is for?
The code was added back in 2013 (a03ee65). I've found no difference after removing the block in my local tests and see no reason to preserve it.
I agree.
The first block should be partially removed (// Code folding
until /2e
) - let's keep SCLEX_NSIS and SCLEX_CSS branches.
The second block about folding should be removed entirely (// set folding style
until /2e
).
> Done.
Write same tests for upcoming Base64 (#122) and QP (#124).
Done.
Were Base64 and QP implemented already or only test cases are available at the moment? If not how much time they will take (they should have libraries already, both are standard algorithms)? **> 1. Only test cases were implemented for these encoding types.
There is another option for Base64: we can use one of the next available open source implementations:
http://web.mit.edu/freebsd/head/contrib/wpa/src/utils/base64.c
https://opensource.apple.com/source/QuickTimeStreamingServer/QuickTimeStreamingServer-452/CommonUtilitiesLib/base64.c
http://libb64.sourceforge.net/
These were listed here: https://stackoverflow.com/questions/342409/how-do-i-base64-encode-decode-in-c
Please check if license types are appropriate for this project and confirm we can use one of these implementations.
Do we need to proceed on implements for these encodings in the current phase?
Were any bugs uncovered by the tests for str2hex and back? > The only bug was found when using small buffer size (provided by test case) within encoding procedure for utf-8 text. This buffer transition problem was fixed.
1.
Done. In addition IsSelectionModeValid became to n2e_ShowPromptIfSelectionModeIsRectangle to make the code clear.
In Edit.c, previously there were lines line this:
void EditChar2Hex(HWND hwnd) {
if (!IsSelectionModeValid(hwnd))
return;
Now the function call was removed and it's like this:
void EditChar2Hex(HWND hwnd) {
if (SC_SEL_RECTANGLE != SendMessage(hwnd, SCI_GETSELECTIONMODE, 0, 0))
...
else
MsgBox(MBINFO, IDS_SELRECT);
}
It seems the old Notepad2 code was restored, why?
This is what the new n2e_ShowPromptIfSelectionModeIsRectangle
function is supposed to do.
> Fixed. All original selection mode checks with MsgBox for non-rectangle selection were replaced with n2e_ShowPromptIfSelectionModeIsRectangle()-calls. While primary thought was to keep as much of original code as possible.
EditModifyLines
?// old
iPos = (int)SendMessage(hwnd, SCI_POSITIONFROMLINE, (WPARAM)iLine, 0);
// new
iPos = (int)SendMessage(hwnd, SCI_GETLINEENDPOSITION, (WPARAM)iLine, 0);
> Fixed. Rollback was applied for this change. The bug was introduced during code cleanup (looks like misspelling or copy-paste).
// [2e]: Save/Save To - file extension #17
However, in some places you have forgotten the colon which needs to be corrected. Example:
// [2e] Edit initialization subroutine
Or the colon should be removed from anywhere. Make it uniform.
> Fixed. Now "[2e]:"-prefix is applying everywhere.
INT_PTR CALLBACK EditInsertTagDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) {
...
};
> Fixed. Removed useless semicolon.
break;
// Newline with toggled auto indent setting
case CMD_CTRLENTER:
> Fixed.
// StrToHex.h
#include <WTypes.h>
> Recent check allowed to get rid of this include from StrToHex.h
.
There is no case sensitivity when including header files in Windows. But usually include filename came from MSDN documentation where CamelCase is used, e.g.: https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx
#define N2E_TRACE_TR(OBJ) n2e_Trace ... , #OBJ , OBJ.chrg.cpMin ,OBJ.chrg.cpMax ,OBJ.lpstrText );
> Fixed.
[2e]
comments from:ID_FILE_OPEN_...
> Fixed.
in IDM_EDIT_UNDO (if..else branch), blocks IDM_EDIT_STRING2HEX
/IDM_EDIT_HEX2STRING
should have 2e
-comments (like IDM_EDIT_STRIP_HTML_TAGS
/ID_SPECIAL_ESCAPEHTML
and others)
> Fixed. case IDC_LINENUM:
if (EN_CHANGE == HIWORD(wParam))
{
}
break;
case IDC_COLNUM:
if (EN_CHANGE == HIWORD(wParam))
{
}
break;
case IDC_POSNUM:
if (EN_CHANGE == HIWORD(wParam))
{
}
break;
> Removed useless code.
[2e]
comment blocks can be merged then. // [2e]: Edit highlighted word #18
case WM_ACTIVATEAPP:
if (!wParam)
n2e_SelectionEditStop(SES_APPLY);
break;
// [/2e]
case WM_KEYDOWN: <<<
break; <<<
// [2e]: Edit highlighted word #18
case WM_MOUSEACTIVATE:
n2e_SelectionEditStop(SES_APPLY);
return DefWindowProc(hwnd, umsg, wParam, lParam);
// [/2e]
> Fixed.
// [2e]: "Recall previous" command
case ID_FILE_OPENPREVIOUS:
if (MRU_Enum(pFileMRU, 0, NULL, 0) > 0)
if (FileSave(FALSE, TRUE, FALSE, FALSE, FALSE))
WCHAR tchFile[MAX_PATH];
if (n2e_OpenMRULast(tchFile))
_FileLoad(TRUE, FALSE, FALSE, FALSE, tchFile, TRUE);
break;
// [/2e] <<<
case IDM_FILE_EXIT:
> Fixed.
Please answer the questions marked as "TODO".
Tabs are still left in many c/h files for alignment. Please replace them with spaces.
Still present in Notepad2eTests/TextEncodingTests.cpp.
> Fixed.
There is another option for Base64: we can use one of the next available open source implementations: http://web.mit.edu/freebsd/head/contrib/wpa/src/utils/base64.c http://libb64.sourceforge.net/
First uses BSD, same kind of license as Notepad2, second is in public domain. We can take any of the two that you think is better.
Do we need to proceed on implements for these encodings in the current phase?
Yes.
> Base64 implemented.
Dialogs.c: WM_INITDIALOG (simply put a line at the beginning of the case)
TODO: Please clarify this point.
INT_PTR CALLBACK AboutDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
static HFONT hFontTitle;
switch (umsg)
// [2e]: Updated with Notepad 2e info <<<
case WM_INITDIALOG:
> Fixed.
Notepad2eTests
to test
and place all 2e-specific tests under a subfolder (test\Extension
). Place test data (txt) into test\data\Extension\[StrToHex]
.
> Done.test\data\Extension\
.Notepad2.sln
.dev
is ready for merge. I'd like you to fix a possible bug in #124 before doing this, then merge dev into master and delete dev.
At last we did it.
It seems I was too fast to close this issue.
src/Extension/Utils.c
, why some IniSetInt lines are using literal strings while others are using constants (there are consts for these strings as well)? Correct it please.
> Done.mEncoding
array into Externals.c from Edit.c? Try reusing it.
> The proper way to prevent code duplication for mEncoding
array is to move it out to a separate module which can be used in both projects (Notepad2e
and Notepad2eTests
) simultaneously. Current implementation does not allow to reference to an instance within Edit.c because this module is heavily attached to Notepad2e
project internals and can't be directly included in Notepad2eTests
project.
Here are some points regarding the current implementation:
Edit.c
has no sensible changes related to module reorganization or variable movement.mEncoding
array contains a set of specific parameters which are required for text recoding procs only (within Notepad2eTests
project).mEncoding
array within Notepad2eTests
project can be required only when new tests will be implemented related to specific encoding types.
Please confirm if we still need to get rid of specified code duplication. this colon - v
Additionally, no file name starting with this string exists in this folder:
> Done.
Changes to mEncoding array within Notepad2eTests project can be required only when new tests will be implemented related to specific encoding types.
I didn't notice #ifdef N2E_TESTING
. Then it's not necessary but please add a comment to Externals.c linking to my comment (https://github.com/ProgerXP/Notepad2e/issues/118#issuecomment-353869333) in case of future questions.
/// End of Foo.c \\\
,// End of Foo.c
).>Done
printtime.bat
used anywhere? >The bat-file is used to generate _version.h which contains build time shown in the About dialog.EditHelper.h
and elsewhere. >Done. The point here was to rename the functions which are directly called from the N2-code.EditHelperEx.cpp
? >Yes. There are just few cases where C++ code is urgently needed: COM for showing system context menu, regex-validation function. Some other functions may be added in order to avoid duplication of code.ExtSelection.c
have 50+ space characters? >Donenn2e_SelectionNotificationHandler
- "nn"? >DoneDialogs.c
Why does
_version.h
contain a date of12-May-16 10:54:02.01
? The UI shows correct date. Is it unused? >printtime.bat
file is automatically executed when building the project to generate _version.h which contains actual build time shown in the About dialog._version.h
file removed from the sources.It seems
IDC_EMAIL
was renamed toIDC_MAIL
(AboutDlgProc
) - if so then why? >DoneThere were
LVS_EX_FULLROWSELECT
commented out inFavoritesDlgProc
,FileMRUDlgProc
,SelectEncodingDlgProc
- bring it back, I want to try them. >DoneDo you know what
SetExplorerTheme(GetDlgItem(hwnd,IDC_FILEMRU));
was supposed to do? > There was some kind of Explorer-like visual customization. Here are some details on it: https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/1e861d81-c15e-4453-a907-ddce96e8b313/using-setwindowtheme-to-customize-the-look-of-an-application-explorer-theme-is-widely-discussed?forum=windowsuidevelopmentWhat this commented out block was supposed to do?
>It looks like MRU's list control was originally developed as a virtual one with providing of the item's icons using this code. Absolutely the same code is now used in FileMRUIconThread().
Why
n2e_OpenMRULast
is inDialogs.c
, not inside Extended\? It doesn't seem to use any internal fields. >DoneEdit.c
Do you know why encodings such as JIS, EUC, GC2312 were commented out and removed? >N/A
Can you remind me why do we need new
adjustNewLines
parameter forEditGetClipboardText
? >RemovedadjustNewLines
parameter during code cleanup. Retrieving of the clipboard text without adjustments is no longer required.You haven't removed one
WARN()
call (you have removed others). >Doneremove_char
andFindEditWndProc
should be in 2e-specific helpers? >DoneMost of
IDACC_BACK
handling (between Dlg functions) can and should be moved into a 2e function. >DoneMost of
WM_COMMAND
handling inEditInsertTagDlgProc
should be moved into a 2e function. >DoneWhy would Flo need
SciThemedWndProc
and other removed functions at the end of Edit.c? >N/A. There was some kind of Explorer-like visual customization. Here are some details on it: https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/1e861d81-c15e-4453-a907-ddce96e8b313/using-setwindowtheme-to-customize-the-look-of-an-application-explorer-theme-is-widely-discussed?forum=windowsuidevelopmentInsert short info comments of form
// [2e]
(or/*
likewise) before changes from the original code. It should tell the feature's name (e.g.Edit > Go to last change
) and/or description of the code change/purpose and/or the #issue number (e.g. for directory lock issue). No need to insert comments before: commented out blocks that you have removed, non-functional changes (NULL
->L""
, replacing a call with an equivalent 2e function, 'if' -> '?:', etc.), code that was replaced with a single call to a function starting withn2e_
orN2E_
(this is because the modification is clear), new declarations in*.h
and #inclusions in h/c that start withn2e_
prefix, minor edits (e.g. added parameter(s) to a modified function). If more than one line was changed, then the block should be closed off with[/2e]
comment. To determine changed blocks you can use my normalized sources. >Donemay be i need to
doesn't read like proper English. >RemovedNotepad2.c
OnPaneSizeClick
: is it possible to get rid of the timer and use right-click instead of double-click for copy-to-clipboard? >Donen2e_MsgCreate
which is almost identical to the original make a new function withinNotepad2.c
like you did withFileLoad
<->_FileLoad
so it doesn't break the diff. >DoneGetCurrentShowTitleMenuID
andGetCurrentLanguageIndicatorMenuID
are not in 2e utils? >Done[2e]
-comment this). >DoneID_BLOCK_UNWRAPQUOTESATCURSOR
is complimentingID_BLOCK_UNWRAPSELECTION
, no need to add "ATCURSOR". >Done>There should be a system beep(instead of save) when clicking on a toolbar button 'Save settings on Exit' if application was executed without ini-file. The case is not available now because this toolbar button is disabled when 'save settings'-command is forbidden.
// Auto close tags
) and reuse it in Edit.c'sEditInsertTagDlgProc
instead of the serious code duplication. >DoneSSM_REGULAR
toSSM_ALL
since it really saves all settings. >DoneIsExpressionEvaluationEnabled
andGetExpressionTextRange
? >Doneint2bin
and two functions after it should be moved to 2e utils. >DoneUpdateStatusbar
should be made a 2e function. >Donenid.szTip
withWC_NOTEPAD2
. >DoneNotepad2.rc
Wrap &Selection Unwrap Bra&ckets Unwrap &Quotes
Str&ip HTML Tags Escape HTML Ta&gs St&ring To Hex Hex To Stri&ng
Highlight Curren&t Word
Evaluate Math E&xpressions
&Ctrl+Arrow Navigation &Ctrl+Wheel Scroll
>The code was added back in 2013 (https://github.com/ProgerXP/Notepad2e/commit/a03ee65020565029df463072c689625c7d687aca). I've found no difference after removing the block in my local tests and see no reason to preserve it.