Trivial bug with the function-key radio buttons
[u/mdw/putty] / windlg.c
index 914559a..4ef37d9 100644 (file)
--- a/windlg.c
+++ b/windlg.c
@@ -1047,9 +1047,6 @@ static void init_dlg_ctrls(HWND hwnd) {
     SetDlgItemText (hwnd, IDC_HOST, cfg.host);
     SetDlgItemText (hwnd, IDC_SESSEDIT, savedsession);
     SetDlgItemInt (hwnd, IDC_PORT, cfg.port, FALSE);
-    for (i = 0; i < nsessions; i++)
-       SendDlgItemMessage (hwnd, IDC_SESSLIST, LB_ADDSTRING,
-                           0, (LPARAM) (sessions[i]));
     CheckRadioButton (hwnd, IDC_PROTRAW, IDC_PROTSSH,
                      cfg.protocol==PROT_SSH ? IDC_PROTSSH :
                      cfg.protocol==PROT_TELNET ? IDC_PROTTELNET : IDC_PROTRAW );
@@ -1059,7 +1056,7 @@ static void init_dlg_ctrls(HWND hwnd) {
                      cfg.bksp_is_delete ? IDC_DEL127 : IDC_DEL008);
     CheckRadioButton (hwnd, IDC_HOMETILDE, IDC_HOMERXVT,
                      cfg.rxvt_homeend ? IDC_HOMERXVT : IDC_HOMETILDE);
-    CheckRadioButton (hwnd, IDC_FUNCTILDE, IDC_FUNCXTERM,
+    CheckRadioButton (hwnd, IDC_FUNCTILDE, IDC_FUNCVT400,
                       cfg.funky_type == 0 ? IDC_FUNCTILDE :
                       cfg.funky_type == 1 ? IDC_FUNCLINUX :
                       cfg.funky_type == 2 ? IDC_FUNCXTERM :
@@ -1367,7 +1364,7 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg,
                      "&Standard", IDC_HOMETILDE,
                      "&rxvt", IDC_HOMERXVT, NULL);
            radioline(&cp, "The Function keys and keypad", IDC_FUNCSTATIC, 4,
-                     "&VT400", IDC_FUNCTILDE,
+                     "ESC[n&~", IDC_FUNCTILDE,
                      "&Linux", IDC_FUNCLINUX,
                      "&Xterm R6", IDC_FUNCXTERM,
                       "&VT400", IDC_FUNCVT400, NULL);
@@ -1585,6 +1582,9 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg,
        }
 
        init_dlg_ctrls(hwnd);
+        for (i = 0; i < nsessions; i++)
+            SendDlgItemMessage (hwnd, IDC_SESSLIST, LB_ADDSTRING,
+                                0, (LPARAM) (sessions[i]));
 
         /*
          * Hide all the controls to start with.
@@ -1743,14 +1743,16 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg,
            {
                int n = SendDlgItemMessage (hwnd, IDC_SESSLIST,
                                            LB_GETCURSEL, 0, 0);
+                int isdef;
                if (n == LB_ERR) {
                    MessageBeep(0);
                    break;
                }
-               load_settings (sessions[n],
-                              !!strcmp(sessions[n], "Default Settings"),
-                               &cfg);
+                isdef = !strcmp(sessions[n], "Default Settings");
+               load_settings (sessions[n], !isdef, &cfg);
                init_dlg_ctrls(hwnd);
+                if (!isdef)
+                    SetDlgItemText(hwnd, IDC_SESSEDIT, sessions[n]);
            }
            if (LOWORD(wParam) == IDC_SESSLIST) {
                /*