Jürgen, It's macOS that's the problem as Mike states. I've confirmed with a small C program that the ioctl TIOCGWINSZ has a different value on macOS than on Linux. WINCH-SETS-⎕PW works without the patch on Linux. With Mike's first patch, it works the same way on both platforms.
I'm a little ambivalent about out the second patch to provide a "priority". I like the way WINCH-SETS-⎕PW works as it's currently implemented. I tried using Mike's second patch but it didn't seem to work as I would have thought. So I backed it out. I would think there would be some additonal work to make it work as Mike wants. Personally having WINCH-SETS-⎕PW (which sets ⎕PW to the window size) is the ultimate override - you get what you're console column width is set for. Want 80? Set the console to 80. - paul > On Dec 23, 2024, at 10:26 AM, M.Hall <mgha1...@gmail.com> wrote: > > WINCH-SETS-⎕PW did not originally work, on macOS Sonoma 14.7.2. > Because macOS does not use the same TIOCGWINSZ magic number that was > hard-coded. > With the first patch, WINCH-SETS-⎕PW does now work on macOS. > > From my original email: > > I noticed that quad-pw wasn't changing with window resizes on macOS (Sonoma > > 14.7.2). > > Here's a patch; there's probably a better way to do it. > > On Mon, Dec 23, 2024 at 6:12 AM Dr. Jürgen Sauermann > <mail@jürgen-sauermann.de <mailto:mail@j%C3%BCrgen-sauermann.de>> wrote: >> Hi, >> >> I am still not clear about whether the WINCH-SETS-⎕PW preference >> works or does not work on Mike's platform (which ?). Could someone >> please test that? >> >> Thanks, >> Jürgen >> >> >> On 12/22/24 20:03, M.Hall wrote: >>> 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 >>> >>> >> > > > > -- > Mike Hall > >