Hi Mike,
I have applied your patches - *SVN 1806*.
A general problem with the SIGWINCH signal is that it is not emitted
when the apl interpreter
starts up (which make sense because the windows is not resized at that
point in time).
One could think of asking the window manager for the current window size
but even though that
would be possible it is not portable in any way.
The INITIAL-⎕PW is a simple work-around to fix this.
Best Regards,
Jürgen
On 12/23/24 22:47, M.Hall wrote not e:
Yes, I see now the behavior is not quite right, is it? With
INITIAL-⎕PW disabled, the ⎕PW still starts up at 80, ignoring the
window width even with WINCH-SETS-⎕PW. Somehow we would have to
detect if it was set, and use it only then, instead of always setting it.
What I found unexpected was setting the initial width in the
preferences file, and not getting it -- having it overriden by the
current window width.
I thought that if the user set the initial ⎕PW in the preferences
file, AND enabled WINCH-SET-PW, they still ought to get their initial
⎕PW. If they resized the window later, then the ⎕PW would follow the
window width.
It's like using the command line setting "--PW 80" -- it overrides
everything else, which makes sense. Highest priority is the command
line, then the initial ⎕PW in the preferences file (if set), then the
window width (if enabled), finally DEFAULT_Quad_PW.
I was just summarizing what I thought was the priority of the three
settings, and trying to make sense of how they work.
Want 80? Unset both preference settings. Forget they exist. :-)
On Mon, Dec 23, 2024 at 10:46 AM Paul Rockwell <paulrockw...@mac.com>
wrote:
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
--
Mike Hall