Move omission of SSH protocol setting in PuTTYtel into windlg.c and
[sgt/putty] / windlg.c
index bdd2d2f..faa7199 100644 (file)
--- a/windlg.c
+++ b/windlg.c
@@ -354,6 +354,11 @@ static int CALLBACK LogProc (HWND hwnd, UINT msg,
                     char *clipdata;
                     static unsigned char sel_nl[] = SEL_NL;
 
+                    if (count == 0) {  /* can't copy zero stuff */
+                        MessageBeep(0);
+                        break;
+                    }
+
                     size = 0;
                     for (i = 0; i < count; i++)
                         size += strlen(events[selitems[i]]) + sizeof(sel_nl);
@@ -369,11 +374,14 @@ static int CALLBACK LogProc (HWND hwnd, UINT msg,
                             memcpy(p, sel_nl, sizeof(sel_nl));
                             p += sizeof(sel_nl);
                         }
-                        write_clip(clipdata, size);
-                        term_deselect();
+                        write_clip(clipdata, size, TRUE);
                         free(clipdata);
                     }
                     free(selitems);
+
+                    for (i = 0; i < nevents; i++)
+                        SendDlgItemMessage(hwnd, IDN_LIST, LB_SETSEL,
+                                           FALSE, i);
                 }
             }
             return 0;
@@ -795,7 +803,7 @@ static void sesssaver(struct ctlpos *cp, char *text,
     doctl(cp, r, "EDIT",
           WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL,
           WS_EX_CLIENTEDGE,
-          "", staticid);
+          "", editid);
 
     /*
      * The buttons (we should hold off on the list box until we
@@ -1083,15 +1091,22 @@ static int CALLBACK ConnectionProc (HWND hwnd, UINT msg,
         multiedit(&cp,
                   "Host &Name", IDC_HOSTSTATIC, IDC_HOST, 75,
                   "&Port", IDC_PORTSTATIC, IDC_PORT, 25, NULL);
-        radioline(&cp, "Protocol:", IDC_PROTSTATIC, 3,
-                  "&Raw", IDC_PROTRAW,
-                  "&Telnet", IDC_PROTTELNET,
+        if (backends[2].backend == NULL) {
+            /* this is PuTTYtel, so only two protocols available */
+            radioline(&cp, "Protocol:", IDC_PROTSTATIC, 3,
+                      "&Raw", IDC_PROTRAW,
+                      "&Telnet", IDC_PROTTELNET, NULL);
+        } else {
+            radioline(&cp, "Protocol:", IDC_PROTSTATIC, 3,
+                      "&Raw", IDC_PROTRAW,
+                      "&Telnet", IDC_PROTTELNET,
 #ifdef FWHACK
-                  "SS&H/hack",
+                      "SS&H/hack",
 #else
-                  "SS&H",
+                      "SS&H",
 #endif
-                  IDC_PROTSSH, NULL);
+                      IDC_PROTSSH, NULL);
+        }
         sesssaver(&cp, "Stor&ed Sessions",
                   IDC_SESSSTATIC, IDC_SESSEDIT, IDC_SESSLIST,
                   "&Load", IDC_SESSLOAD,