mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-11 21:03:05 +08:00
+ fix: wrong shortcut in menu on word navigation (Ctrl+LEFT/RIGHT)
+ add: toggle option for accelerated word navigation (Ctrl+LEFT/RIGHT) according to issue #27 (https://github.com/rizonesoft/Notepad3/issues/27) - [Settings2] parameter "ExtendedWhiteSpaceChars=" defines a set of chars to be ignored (handled as whitespaces) to find the next beginning of a word if "Accelerated word navigation" is switched ON
This commit is contained in:
parent
f6f1c5ad0d
commit
accbcdcb2e
@ -67,6 +67,10 @@ extern BOOL bLoadNFOasOEM;
|
||||
extern int iSrcEncoding;
|
||||
extern int iWeakSrcEncoding;
|
||||
|
||||
extern BOOL bAccelWordNavigation;
|
||||
extern char* chExtendedWhiteSpaceChars;
|
||||
|
||||
|
||||
int g_DOSEncoding;
|
||||
|
||||
// Supported Encodings
|
||||
@ -265,6 +269,11 @@ HWND EditCreate(HWND hwndParent)
|
||||
SendMessage(hwnd,SCI_ASSIGNCMDKEY,(SCK_HOME + (SCMOD_SHIFT << 16)),SCI_VCHOMEWRAPEXTEND);
|
||||
SendMessage(hwnd,SCI_ASSIGNCMDKEY,(SCK_END + (SCMOD_SHIFT << 16)),SCI_LINEENDWRAPEXTEND);
|
||||
|
||||
if (bAccelWordNavigation)
|
||||
SendMessage(hwnd, SCI_SETWHITESPACECHARS, 0, (LPARAM)chExtendedWhiteSpaceChars);
|
||||
else
|
||||
SendMessage(hwnd, SCI_SETCHARSDEFAULT, 0, 0);
|
||||
|
||||
// Init default values for printing
|
||||
EditPrintInit();
|
||||
|
||||
|
||||
@ -109,6 +109,9 @@ WCHAR tchToolbarButtons[512] = { L'\0' };
|
||||
WCHAR tchToolbarBitmap[MAX_PATH] = { L'\0' };
|
||||
WCHAR tchToolbarBitmapHot[MAX_PATH] = { L'\0' };
|
||||
WCHAR tchToolbarBitmapDisabled[MAX_PATH] = { L'\0' };
|
||||
|
||||
char chExtendedWhiteSpaceChars[256] = { '\0' };
|
||||
|
||||
int iPathNameFormat;
|
||||
BOOL fWordWrap;
|
||||
BOOL fWordWrapG;
|
||||
@ -141,6 +144,7 @@ int iMarkOccurrences;
|
||||
BOOL bMarkOccurrencesMatchCase;
|
||||
BOOL bMarkOccurrencesMatchWords;
|
||||
BOOL bAutoCompleteWords;
|
||||
BOOL bAccelWordNavigation;
|
||||
BOOL bShowCodeFolding;
|
||||
BOOL bViewWhiteSpace;
|
||||
BOOL bViewEOLs;
|
||||
@ -297,9 +301,9 @@ WCHAR g_wchWorkingDirectory[MAX_PATH] = L"";
|
||||
|
||||
|
||||
|
||||
//Graphics for bookmark indicator
|
||||
/* XPM */
|
||||
static char * bookmark_pixmap[] = {
|
||||
//Graphics for bookmark indicator
|
||||
/* XPM */
|
||||
static char * bookmark_pixmap[] = {
|
||||
"11 11 44 1",
|
||||
" c #EBE9ED",
|
||||
". c #E5E3E7",
|
||||
@ -355,9 +359,8 @@ WCHAR g_wchWorkingDirectory[MAX_PATH] = L"";
|
||||
" 23~~~~;4+ ",
|
||||
" 56=|7890 ",
|
||||
" a2bc}de ",
|
||||
" "};
|
||||
|
||||
|
||||
" "
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
@ -2297,6 +2300,7 @@ void MsgInitMenu(HWND hwnd,WPARAM wParam,LPARAM lParam)
|
||||
|
||||
EnableCmd(hmenu,IDM_EDIT_COMPLETEWORD,i);
|
||||
CheckCmd(hmenu,IDM_VIEW_AUTOCOMPLETEWORDS,bAutoCompleteWords);
|
||||
CheckCmd(hmenu,IDM_VIEW_ACCELWORDNAV,bAccelWordNavigation);
|
||||
|
||||
switch (iMarkOccurrences)
|
||||
{
|
||||
@ -4071,14 +4075,17 @@ LRESULT MsgCommand(HWND hwnd,WPARAM wParam,LPARAM lParam)
|
||||
break;
|
||||
|
||||
case IDM_VIEW_AUTOCOMPLETEWORDS:
|
||||
if (bAutoCompleteWords) {
|
||||
// close the autocompletion list
|
||||
SendMessage(hwndEdit, SCI_AUTOCCANCEL, 0, 0);
|
||||
bAutoCompleteWords = FALSE;
|
||||
}
|
||||
else {
|
||||
bAutoCompleteWords = TRUE;
|
||||
}
|
||||
bAutoCompleteWords = (bAutoCompleteWords) ? FALSE : TRUE; // toggle
|
||||
if (!bAutoCompleteWords)
|
||||
SendMessage(hwndEdit, SCI_AUTOCCANCEL, 0, 0); // close the auto completion list
|
||||
break;
|
||||
|
||||
case IDM_VIEW_ACCELWORDNAV:
|
||||
bAccelWordNavigation = (bAccelWordNavigation) ? FALSE : TRUE; // toggle
|
||||
if (bAccelWordNavigation)
|
||||
SendMessage(hwndEdit, SCI_SETWHITESPACECHARS, 0, (LPARAM)chExtendedWhiteSpaceChars);
|
||||
else
|
||||
SendMessage(hwndEdit, SCI_SETCHARSDEFAULT, 0, 0);
|
||||
break;
|
||||
|
||||
case IDM_VIEW_MARKOCCURRENCES_OFF:
|
||||
@ -4500,6 +4507,16 @@ LRESULT MsgCommand(HWND hwnd,WPARAM wParam,LPARAM lParam)
|
||||
break;
|
||||
|
||||
|
||||
case CMD_CTRLLEFT:
|
||||
SendMessage(hwndEdit, SCI_WORDLEFT, 0, 0);
|
||||
break;
|
||||
|
||||
|
||||
case CMD_CTRLRIGHT:
|
||||
SendMessage(hwndEdit, SCI_WORDRIGHT, 0, 0);
|
||||
break;
|
||||
|
||||
|
||||
case CMD_CTRLBACK:
|
||||
{
|
||||
int iPos = (int)SendMessage(hwndEdit,SCI_GETCURRENTPOS,0,0);
|
||||
@ -5687,6 +5704,9 @@ void LoadSettings()
|
||||
bAutoCompleteWords = IniSectionGetInt(pIniSection,L"AutoCompleteWords",0);
|
||||
if (bAutoCompleteWords) bAutoCompleteWords = 1;
|
||||
|
||||
bAccelWordNavigation = IniSectionGetInt(pIniSection, L"AccelWordNavigation", 0);
|
||||
if (bAccelWordNavigation) bAccelWordNavigation = 1;
|
||||
|
||||
bShowIndentGuides = IniSectionGetInt(pIniSection,L"ShowIndentGuides",0);
|
||||
if (bShowIndentGuides) bShowIndentGuides = 1;
|
||||
|
||||
@ -5866,6 +5886,7 @@ void LoadSettings()
|
||||
iSciFontQuality = IniSectionGetInt(pIniSection,L"SciFontQuality",-1);
|
||||
iSciFontQuality = max(min(iSciFontQuality,3),-1);
|
||||
|
||||
|
||||
LoadIniSection(L"Settings2",pIniSection,cchIniSection);
|
||||
|
||||
bStickyWinPos = IniSectionGetInt(pIniSection,L"StickyWindowPosition",0);
|
||||
@ -5885,6 +5906,13 @@ void LoadSettings()
|
||||
dwFileCheckInverval = IniSectionGetInt(pIniSection,L"FileCheckInverval",2000);
|
||||
dwAutoReloadTimeout = IniSectionGetInt(pIniSection,L"AutoReloadTimeout",2000);
|
||||
|
||||
WCHAR buffer[256];
|
||||
const WCHAR defextwsc[] = L".,;:|/-+$%&<>(){}[]=?#'*";
|
||||
IniSectionGetString(pIniSection, L"ExtendedWhiteSpaceChars", defextwsc, buffer, COUNTOF(buffer));
|
||||
if (!lstrlen(buffer)) lstrcpyn(buffer, defextwsc, COUNTOF(buffer));
|
||||
WideCharToMultiByte(CP_ACP, 0, buffer, -1, chExtendedWhiteSpaceChars, COUNTOF(chExtendedWhiteSpaceChars), NULL, NULL);
|
||||
|
||||
|
||||
LoadIniSection(L"Toolbar Images",pIniSection,cchIniSection);
|
||||
|
||||
IniSectionGetString(pIniSection,L"BitmapDefault",L"",
|
||||
@ -6002,6 +6030,7 @@ void SaveSettings(BOOL bSaveSettingsNow) {
|
||||
IniSectionSetInt(pIniSection, L"HighlightCurrentLine", bHiliteCurrentLine);
|
||||
IniSectionSetInt(pIniSection, L"AutoIndent", bAutoIndent);
|
||||
IniSectionSetInt(pIniSection, L"AutoCompleteWords", bAutoCompleteWords);
|
||||
IniSectionSetInt(pIniSection, L"AccelWordNavigation", bAccelWordNavigation);
|
||||
IniSectionSetInt(pIniSection, L"ShowIndentGuides", bShowIndentGuides);
|
||||
IniSectionSetInt(pIniSection, L"TabsAsSpaces", bTabsAsSpacesG);
|
||||
IniSectionSetInt(pIniSection, L"TabIndents", bTabIndentsG);
|
||||
|
||||
BIN
src/Notepad3.rc
BIN
src/Notepad3.rc
Binary file not shown.
@ -171,41 +171,43 @@
|
||||
#define CMD_ESCAPE 20000
|
||||
#define CMD_SHIFTESC 20001
|
||||
#define CMD_CTRLENTER 20002
|
||||
#define CMD_BACK 20003
|
||||
#define CMD_CTRLBACK 20004
|
||||
#define CMD_DEL 20005
|
||||
#define CMD_CTRLDEL 20006
|
||||
#define CMD_CTRLTAB 20007
|
||||
#define CMD_RECODEDEFAULT 20008
|
||||
#define CMD_RECODEANSI 20009
|
||||
#define CMD_RECODEOEM 20010
|
||||
#define CMD_RELOADASCIIASUTF8 20011
|
||||
#define CMD_RELOADNOFILEVARS 20012
|
||||
#define CMD_LEXDEFAULT 20013
|
||||
#define CMD_LEXHTML 20014
|
||||
#define CMD_LEXXML 20015
|
||||
#define CMD_TIMESTAMPS 20016
|
||||
#define CMD_WEBACTION1 20017
|
||||
#define CMD_WEBACTION2 20018
|
||||
#define CMD_FINDNEXTSEL 20019
|
||||
#define CMD_FINDPREVSEL 20020
|
||||
#define CMD_INCLINELIMIT 20021
|
||||
#define CMD_DECLINELIMIT 20022
|
||||
#define CMD_STRINGIFY 20023
|
||||
#define CMD_STRINGIFY2 20024
|
||||
#define CMD_EMBRACE 20025
|
||||
#define CMD_EMBRACE2 20026
|
||||
#define CMD_EMBRACE3 20027
|
||||
#define CMD_EMBRACE4 20028
|
||||
#define CMD_INCREASENUM 20029
|
||||
#define CMD_DECREASENUM 20030
|
||||
#define CMD_TOGGLETITLE 20031
|
||||
#define CMD_JUMP2SELSTART 20032
|
||||
#define CMD_JUMP2SELEND 20033
|
||||
#define CMD_COPYPATHNAME 20034
|
||||
#define CMD_COPYWINPOS 20035
|
||||
#define CMD_DEFAULTWINPOS 20036
|
||||
#define CMD_OPENINIFILE 20037
|
||||
#define CMD_CTRLLEFT 20003
|
||||
#define CMD_CTRLRIGHT 20004
|
||||
#define CMD_BACK 20005
|
||||
#define CMD_CTRLBACK 20006
|
||||
#define CMD_DEL 20007
|
||||
#define CMD_CTRLDEL 20008
|
||||
#define CMD_CTRLTAB 20009
|
||||
#define CMD_RECODEDEFAULT 20010
|
||||
#define CMD_RECODEANSI 20011
|
||||
#define CMD_RECODEOEM 20012
|
||||
#define CMD_RELOADASCIIASUTF8 20013
|
||||
#define CMD_RELOADNOFILEVARS 20014
|
||||
#define CMD_LEXDEFAULT 20015
|
||||
#define CMD_LEXHTML 20016
|
||||
#define CMD_LEXXML 20017
|
||||
#define CMD_TIMESTAMPS 20018
|
||||
#define CMD_WEBACTION1 20019
|
||||
#define CMD_WEBACTION2 20020
|
||||
#define CMD_FINDNEXTSEL 20021
|
||||
#define CMD_FINDPREVSEL 20022
|
||||
#define CMD_INCLINELIMIT 20023
|
||||
#define CMD_DECLINELIMIT 20024
|
||||
#define CMD_STRINGIFY 20025
|
||||
#define CMD_STRINGIFY2 20026
|
||||
#define CMD_EMBRACE 20027
|
||||
#define CMD_EMBRACE2 20028
|
||||
#define CMD_EMBRACE3 20029
|
||||
#define CMD_EMBRACE4 20030
|
||||
#define CMD_INCREASENUM 20031
|
||||
#define CMD_DECREASENUM 20032
|
||||
#define CMD_TOGGLETITLE 20033
|
||||
#define CMD_JUMP2SELSTART 20034
|
||||
#define CMD_JUMP2SELEND 20035
|
||||
#define CMD_COPYPATHNAME 20036
|
||||
#define CMD_COPYWINPOS 20037
|
||||
#define CMD_DEFAULTWINPOS 20038
|
||||
#define CMD_OPENINIFILE 20039
|
||||
#define IDM_FILE_NEW 40000
|
||||
#define IDM_FILE_OPEN 40001
|
||||
#define IDM_FILE_REVERT 40002
|
||||
@ -376,6 +378,7 @@
|
||||
#define IDM_VIEW_MARKOCCURRENCES_CASE 40451
|
||||
#define IDM_VIEW_MARKOCCURRENCES_WORD 40452
|
||||
#define IDM_VIEW_AUTOCOMPLETEWORDS 40453
|
||||
#define IDM_VIEW_ACCELWORDNAV 40454
|
||||
#define IDM_HELP_ABOUT 40500
|
||||
#define IDM_HELP_CMD 40501
|
||||
#define IDM_TRAY_RESTORE 40600
|
||||
|
||||
Loading…
Reference in New Issue
Block a user