Paul Rockwell writes:

> There may be a side effect, though. With the option set and Mike's code
inserted, ⎕PW will be set to whatever the current terminal width is, not
the IBM APL2 default of 80.

Yes. There are three settings that interact:
  - command line "--PW xx"
  - preferences "INITIAL-⎕PW  xx"
  - preferences "WINCH-SETS-⎕PW"

The command line setting overrides all others. This makes sense to me.

INITIAL-⎕PW is active when WINCH-SETS-⎕PW is off.  Also, good.

When WINCH-SETS-⎕PW is enabled, the code bypasses the INITIAL-⎕PW setup.
Hmmm.

I think the user's INITIAL-⎕PW should be used at startup, even when
WINCH-SETS-⎕PW is enabled.

So the startup priority would be (high to low):
 - command line
 - INITIAL-⎕PW
 - then WINCH
 - then default 80 columns

Here's a patch for that, if you want (applied against the previous patch):

$ diff -u src/main-orig.cc src/main.cc
--- src/main-orig.cc    2024-12-19 13:20:04.000000000 -0600
+++ src/main.cc 2024-12-22 10:11:42.000000000 -0600
@@ -449,10 +452,8 @@
         sigaction(SIGWINCH, &new_WINCH_action, &old_WINCH_action);
         signal_WINCH_handler(0);   // pretend window size change
       }
-   else
-      {
-        Workspace::set_PW(UserPreferences::uprefs.initial_pw, LOC);
-      }
+   // honor the user's initial PW preference, even if WINCH is enabled
+   Workspace::set_PW(UserPreferences::uprefs.initial_pw, LOC);

 #if PARALLEL_ENABLED
    memset(&new_control_BSL_action, 0, sizeof(struct sigaction));


-- 
Mike Hall

Reply via email to