Added a command-line option -keepLineBreaksICS true/false to control line joining.
[xboard.git] / winboard / winboard.c
index e6fcb8b..884c85c 100644 (file)
@@ -1392,6 +1392,7 @@ ArgDescriptor argDescriptors[] = {
   { "firstNPS", ArgInt, (LPVOID) &appData.firstNPS, FALSE },\r
   { "secondNPS", ArgInt, (LPVOID) &appData.secondNPS, FALSE },\r
   { "noGUI", ArgTrue, (LPVOID) &appData.noGUI, FALSE },\r
+  { "keepLineBreaksICS", ArgBoolean, (LPVOID) &appData.noJoin, TRUE },\r
 \r
   // [HGM] placement: put all window layouts last in ini file, but man X,Y before all others\r
   { "minX", ArgZ, (LPVOID) &minX, FALSE }, // [HGM] placement: to make suer auxialary windows can be placed\r
@@ -5462,6 +5463,7 @@ void UpdateICSWidth(HWND hText)
        TEXTMETRIC tm;\r
        RECT rc;\r
        HFONT hfont, hold_font;\r
+       LONG old_width, new_width;\r
        \r
        // get the text metrics\r
        hdc = GetDC(hText);\r
@@ -5476,7 +5478,13 @@ void UpdateICSWidth(HWND hText)
        SendMessage(hText, EM_GETRECT, 0, (LPARAM)&rc);\r
 \r
        // update the width\r
-       ics_update_width((rc.right-rc.left) / tm.tmAveCharWidth);\r
+       new_width = (rc.right-rc.left) / tm.tmAveCharWidth;\r
+       old_width = GetWindowLong(hText, GWL_USERDATA);\r
+       if (new_width != old_width)\r
+       {\r
+               ics_update_width(new_width);\r
+               SetWindowLong(hText, GWL_USERDATA, new_width);\r
+       }\r
 }\r
 \r
 VOID\r
@@ -8203,6 +8211,7 @@ ConsoleWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
    wMask = SendMessage(hText, EM_GETEVENTMASK, 0, 0L);\r
    SendMessage(hText, EM_SETEVENTMASK, 0, wMask | ENM_LINK);\r
    SendMessage(hText, EM_AUTOURLDETECT, TRUE, 0L);\r
+   SetWindowLong(hText, GWL_USERDATA, 79); // initialize the text window's width\r
 \r
     return FALSE;\r
 \r
@@ -9534,6 +9543,11 @@ DrawPosition(int fullRedraw, Board board)
   HDCDrawPosition(NULL, (BOOLEAN) fullRedraw, board); \r
 }\r
 \r
+void NotifyFrontendLogin()\r
+{\r
+       if (hwndConsole)\r
+               UpdateICSWidth(GetDlgItem(hwndConsole, OPT_ConsoleText));\r
+}\r
 \r
 VOID\r
 ResetFrontEnd()\r