Skip to content

Commit

Permalink
Add new selection mode "Old Visual Studio", issue #761.
Browse files Browse the repository at this point in the history
  • Loading branch information
zufuliu committed Feb 3, 2024
1 parent 5aa08ed commit ce5a15e
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 6 deletions.
1 change: 1 addition & 0 deletions locale/de/Notepad2.rc
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ BEGIN
BEGIN
MENUITEM "&None", IDM_LINE_SELECTION_MODE_NONE
MENUITEM "&Visual Studio", IDM_LINE_SELECTION_MODE_VS
MENUITEM "&Old Visual Studio", IDM_LINE_SELECTION_MODE_OLDVS
MENUITEM "Nor&mal", IDM_LINE_SELECTION_MODE_NORMAL
END
END
Expand Down
1 change: 1 addition & 0 deletions locale/fr-FR/Notepad2.rc
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ BEGIN
BEGIN
MENUITEM "Aucun", IDM_LINE_SELECTION_MODE_NONE
MENUITEM "&Visual Studio", IDM_LINE_SELECTION_MODE_VS
MENUITEM "&Old Visual Studio", IDM_LINE_SELECTION_MODE_OLDVS
MENUITEM "Nor&mal", IDM_LINE_SELECTION_MODE_NORMAL
END
END
Expand Down
1 change: 1 addition & 0 deletions locale/it/Notepad2.rc
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ BEGIN
BEGIN
MENUITEM "&Nessuna", IDM_LINE_SELECTION_MODE_NONE
MENUITEM "&Visual Studio", IDM_LINE_SELECTION_MODE_VS
MENUITEM "&Old Visual Studio", IDM_LINE_SELECTION_MODE_OLDVS
MENUITEM "Nor&male", IDM_LINE_SELECTION_MODE_NORMAL
END
END
Expand Down
1 change: 1 addition & 0 deletions locale/ja/Notepad2.rc
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ BEGIN
BEGIN
MENUITEM "なし(&N)", IDM_LINE_SELECTION_MODE_NONE
MENUITEM "Visual Studio(&V)", IDM_LINE_SELECTION_MODE_VS
MENUITEM "&Old Visual Studio", IDM_LINE_SELECTION_MODE_OLDVS
MENUITEM "通常(&M)", IDM_LINE_SELECTION_MODE_NORMAL
END
END
Expand Down
1 change: 1 addition & 0 deletions locale/ko/Notepad2.rc
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ BEGIN
BEGIN
MENUITEM "없음(&N)", IDM_LINE_SELECTION_MODE_NONE
MENUITEM "Visual Studio(&V)", IDM_LINE_SELECTION_MODE_VS
MENUITEM "&Old Visual Studio", IDM_LINE_SELECTION_MODE_OLDVS
MENUITEM "일반(&M)", IDM_LINE_SELECTION_MODE_NORMAL
END
END
Expand Down
1 change: 1 addition & 0 deletions locale/pt-BR/Notepad2.rc
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ BEGIN
BEGIN
MENUITEM "&None", IDM_LINE_SELECTION_MODE_NONE
MENUITEM "&Visual Studio", IDM_LINE_SELECTION_MODE_VS
MENUITEM "&Old Visual Studio", IDM_LINE_SELECTION_MODE_OLDVS
MENUITEM "Nor&mal", IDM_LINE_SELECTION_MODE_NORMAL
END
END
Expand Down
1 change: 1 addition & 0 deletions locale/zh-Hans/Notepad2.rc
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ BEGIN
BEGIN
MENUITEM "无(&N)", IDM_LINE_SELECTION_MODE_NONE
MENUITEM "&Visual Studio", IDM_LINE_SELECTION_MODE_VS
MENUITEM "旧版 Visual Studio(&O)", IDM_LINE_SELECTION_MODE_OLDVS
MENUITEM "正常(&M)", IDM_LINE_SELECTION_MODE_NORMAL
END
END
Expand Down
1 change: 1 addition & 0 deletions locale/zh-Hant/Notepad2.rc
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ BEGIN
BEGIN
MENUITEM "無(&N)", IDM_LINE_SELECTION_MODE_NONE
MENUITEM "&Visual Studio", IDM_LINE_SELECTION_MODE_VS
MENUITEM "舊版 Visual Studio(&O)", IDM_LINE_SELECTION_MODE_OLDVS
MENUITEM "正常(&M)", IDM_LINE_SELECTION_MODE_NORMAL
END
END
Expand Down
1 change: 1 addition & 0 deletions src/Edit.h
Original file line number Diff line number Diff line change
Expand Up @@ -648,4 +648,5 @@ enum LineSelectionMode {
LineSelectionMode_None,
LineSelectionMode_VisualStudio,
LineSelectionMode_Normal,
LineSelectionMode_OldVisualStudio,
};
8 changes: 5 additions & 3 deletions src/Notepad2.c
Original file line number Diff line number Diff line change
Expand Up @@ -2621,7 +2621,7 @@ void MsgInitMenu(HWND hwnd, WPARAM wParam, LPARAM lParam) {
CheckCmd(hmenu, IDM_SET_SELECTIONASFINDTEXT, iSelectOption & SelectOption_CopySelectionAsFindText);
CheckCmd(hmenu, IDM_SET_PASTEBUFFERASFINDTEXT, iSelectOption & SelectOption_CopyPasteBufferAsFindText);
i = IDM_LINE_SELECTION_MODE_NONE + iLineSelectionMode;
CheckMenuRadioItem(hmenu, IDM_LINE_SELECTION_MODE_NONE, IDM_LINE_SELECTION_MODE_NORMAL, i, MF_BYCOMMAND);
CheckMenuRadioItem(hmenu, IDM_LINE_SELECTION_MODE_NONE, IDM_LINE_SELECTION_MODE_OLDVS, i, MF_BYCOMMAND);

UncheckCmd(hmenu, IDM_VIEW_MARKOCCURRENCES_OFF, bMarkOccurrences);
CheckCmd(hmenu, IDM_VIEW_MARKOCCURRENCES_CASE, bMarkOccurrencesMatchCase);
Expand Down Expand Up @@ -3138,12 +3138,13 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam) {
bLastCopyFromMe = true;
}
if (SciCall_IsSelectionEmpty() && iLineSelectionMode != LineSelectionMode_None) {
const int mode = iLineSelectionMode;
Sci_Position iCurrentPos = SciCall_GetCurrentPos();
const Sci_Position iCol = SciCall_GetColumn(iCurrentPos) + 1;
SciCall_LineCut(iLineSelectionMode & LineSelectionMode_VisualStudio);
SciCall_LineCut(mode & LineSelectionMode_VisualStudio);
iCurrentPos = SciCall_GetCurrentPos();
const Sci_Line iCurLine = SciCall_LineFromPosition(iCurrentPos);
EditJumpTo(iCurLine + 1, iCol);
EditJumpTo(iCurLine + (mode != LineSelectionMode_OldVisualStudio), iCol);
} else {
SciCall_Cut(false);
}
Expand Down Expand Up @@ -4114,6 +4115,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam) {
case IDM_LINE_SELECTION_MODE_NONE:
case IDM_LINE_SELECTION_MODE_VS:
case IDM_LINE_SELECTION_MODE_NORMAL:
case IDM_LINE_SELECTION_MODE_OLDVS:
iLineSelectionMode = LOWORD(wParam) - IDM_LINE_SELECTION_MODE_NONE;
if (iLineSelectionMode == LineSelectionMode_None) {
SciCall_SetSelectionMode(SC_SEL_STREAM);
Expand Down
1 change: 1 addition & 0 deletions src/Notepad2.rc
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ BEGIN
BEGIN
MENUITEM "&None", IDM_LINE_SELECTION_MODE_NONE
MENUITEM "&Visual Studio", IDM_LINE_SELECTION_MODE_VS
MENUITEM "&Old Visual Studio", IDM_LINE_SELECTION_MODE_OLDVS
MENUITEM "Nor&mal", IDM_LINE_SELECTION_MODE_NORMAL
END
END
Expand Down
7 changes: 4 additions & 3 deletions src/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -494,9 +494,10 @@
#define IDM_LINE_SELECTION_MODE_NONE 40076
#define IDM_LINE_SELECTION_MODE_VS 40077
#define IDM_LINE_SELECTION_MODE_NORMAL 40078
#define IDM_SET_MULTIPLE_SELECTION 40079
#define IDM_SET_SELECTIONASFINDTEXT 40080
#define IDM_SET_PASTEBUFFERASFINDTEXT 40081
#define IDM_LINE_SELECTION_MODE_OLDVS 40079
#define IDM_SET_MULTIPLE_SELECTION 40080
#define IDM_SET_SELECTIONASFINDTEXT 40081
#define IDM_SET_PASTEBUFFERASFINDTEXT 40082

#define IDM_ENCODING_ANSI 40100
#define IDM_ENCODING_UNICODE 40101
Expand Down

0 comments on commit ce5a15e

Please sign in to comment.