Skip to content

Commit

Permalink
Support new SC_WRAP_WHITESPACE wrap mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
zufuliu committed Aug 6, 2018
1 parent cfdb8ef commit ece290b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
8 changes: 7 additions & 1 deletion src/Dialogs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1352,6 +1352,7 @@ BOOL ColumnWrapDlg(HWND hwnd, UINT uidDlg, int *iNumber) {
// 202 Text
// 203 Text
//
extern BOOL fWordWrap;
extern int iWordWrapMode;
extern int iWordWrapIndent;
extern int iWordWrapSymbols;
Expand Down Expand Up @@ -1404,7 +1405,12 @@ INT_PTR CALLBACK WordWrapSettingsDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LP
}

iSel = (int)SendDlgItemMessage(hwnd, 103, CB_GETCURSEL, 0, 0);
iWordWrapMode = iSel;
if (iSel == SC_WRAP_NONE) {
fWordWrap = FALSE;
} else {
fWordWrap = TRUE;
iWordWrapMode = iSel;
}
EndDialog(hwnd, IDOK);
}
break;
Expand Down
6 changes: 4 additions & 2 deletions src/Notepad2.c
Original file line number Diff line number Diff line change
Expand Up @@ -3679,6 +3679,8 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam) {
case IDM_VIEW_WORDWRAPSETTINGS:
if (WordWrapSettingsDlg(hwnd, IDD_WORDWRAP, &iWordWrapIndent)) {
SendMessage(hwndEdit, SCI_SETWRAPMODE, (fWordWrap? iWordWrapMode : SC_WRAP_NONE), 0);
fWordWrapG = fWordWrap;
UpdateToolbar();
if (iWordWrapIndent == 5) {
SendMessage(hwndEdit, SCI_SETWRAPINDENTMODE, SC_WRAPINDENT_SAME, 0);
} else if (iWordWrapIndent == 6) {
Expand Down Expand Up @@ -5228,8 +5230,8 @@ void LoadSettings(void) {
fWordWrap = IniSectionGetBool(pIniSection, L"WordWrap", 1);
fWordWrapG = fWordWrap;

iWordWrapMode = IniSectionGetInt(pIniSection, L"WordWrapMode", 0);
iWordWrapMode = clamp_i(iWordWrapMode, 0, 1);
iWordWrapMode = IniSectionGetInt(pIniSection, L"WordWrapMode", SC_WRAP_WORD);
iWordWrapMode = clamp_i(iWordWrapMode, SC_WRAP_WORD, SC_WRAP_WHITESPACE);

iWordWrapIndent = IniSectionGetInt(pIniSection, L"WordWrapIndent", 0);
iWordWrapIndent = clamp_i(iWordWrapIndent, 0, 7);
Expand Down
2 changes: 1 addition & 1 deletion src/Notepad2.rc
Original file line number Diff line number Diff line change
Expand Up @@ -1011,7 +1011,7 @@ BEGIN
LTEXT "No wrap indent|Wrap indent by 1 character|Wrap indent by 2 characters|Wrap indent by 1 level|Wrap indent by 2 levels|Wrap indent as first subline|Wrap indent 1 level more than first subline|Wrap indent 2 levels more than first subline",200,0,0,615,8,NOT WS_VISIBLE
LTEXT "No visual indicators before wrap|Show visual indicators before wrap (near text)|Show visual indicators before wrap (near borders)",201,0,0,418,8,NOT WS_VISIBLE
LTEXT "No visual indicators after wrap|Show visual indicators after wrap (near text)|Show visual indicators after wrap (near borders)",202,0,0,402,8,NOT WS_VISIBLE
LTEXT "Wrap text between words|Wrap text between any glyphs",203,0,0,187,8,NOT WS_VISIBLE
LTEXT "No wrap|Wrap text between words|Wrap text between any characters (preferred for CJK text)|Wrap text on whitespace",203,0,0,187,8,NOT WS_VISIBLE
END

IDD_PAGESETUP DIALOGEX 5, 5, 356, 260
Expand Down

0 comments on commit ece290b

Please sign in to comment.