Skip to content

Commit

Permalink
Show line number range in Goto dialog.
Browse files Browse the repository at this point in the history
  • Loading branch information
zufuliu committed Nov 2, 2018
1 parent 8b62583 commit e6262d2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
16 changes: 13 additions & 3 deletions src/Edit.c
Original file line number Diff line number Diff line change
Expand Up @@ -5233,11 +5233,21 @@ static INT_PTR CALLBACK EditLineNumDlgProc(HWND hwnd, UINT umsg, WPARAM wParam,
case WM_INITDIALOG: {
const int iCurLine = (int)SendMessage(hwndEdit, SCI_LINEFROMPOSITION,
SendMessage(hwndEdit, SCI_GETCURRENTPOS, 0, 0), 0) + 1;
const int iMaxLine = (int)SendMessage(hwndEdit, SCI_GETLINECOUNT, 0, 0);

SetDlgItemInt(hwnd, IDC_LINENUM, iCurLine, FALSE);
SendDlgItemMessage(hwnd, IDC_LINENUM, EM_LIMITTEXT, 15, 0);

SendDlgItemMessage(hwnd, IDC_COLNUM, EM_LIMITTEXT, 15, 0);
SendDlgItemMessage(hwnd, IDC_LINENUM, EM_LIMITTEXT, 20, 0);
SendDlgItemMessage(hwnd, IDC_COLNUM, EM_LIMITTEXT, 20, 0);

WCHAR tchLn[32];
WCHAR tchLines[64];
WCHAR tchFmt[64];

wsprintf(tchLn, L"%i", iMaxLine);
FormatNumberStr(tchLn);
GetDlgItemText(hwnd, IDC_LINE_RANGE, tchFmt, COUNTOF(tchFmt));
wsprintf(tchLines, tchFmt, tchLn);
SetDlgItemText(hwnd, IDC_LINE_RANGE, tchLines);

CenterDlgInParent(hwnd);
}
Expand Down
14 changes: 7 additions & 7 deletions src/Notepad2.rc
Original file line number Diff line number Diff line change
Expand Up @@ -1025,17 +1025,17 @@ BEGIN
PUSHBUTTON "Cancel",IDCANCEL,139,24,50,14
END

IDD_LINENUM DIALOGEX 0, 0, 186, 47
IDD_LINENUM DIALOGEX 0, 0, 166, 70
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Goto"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
LTEXT "&Line:",IDC_STATIC,7,7,23,8
EDITTEXT IDC_LINENUM,7,24,46,14,ES_AUTOHSCROLL
LTEXT "&Column:",IDC_STATIC,63,7,33,8
EDITTEXT IDC_COLNUM,63,24,46,14,ES_AUTOHSCROLL
DEFPUSHBUTTON "OK",IDOK,129,7,50,14
PUSHBUTTON "Cancel",IDCANCEL,129,24,50,14
LTEXT "&Line (1 - %s):",IDC_LINE_RANGE,7,7,150,8
EDITTEXT IDC_LINENUM,7,18,90,14,ES_AUTOHSCROLL
LTEXT "&Column:",IDC_STATIC,7,37,90,8
EDITTEXT IDC_COLNUM,7,48,90,14,ES_AUTOHSCROLL
DEFPUSHBUTTON "OK",IDOK,109,18,50,14
PUSHBUTTON "Cancel",IDCANCEL,109,48,50,14
END

IDD_FILEMRU DIALOGEX 0, 0, 226, 204
Expand Down
1 change: 1 addition & 0 deletions src/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#define IDB_PREV 102
#define IDI_STYLES 102
#define IDC_ASCIIASUTF8 102
#define IDC_LINE_RANGE 102
#define IDD_DEFENCODING 103
#define IDC_FINDWORD 103
#define IDC_RESIZEGRIP3 103
Expand Down

0 comments on commit e6262d2

Please sign in to comment.