Skip to content

Open the session window for the model's alternate screen (#198) - #199

Merged
coffeemuse merged 3 commits into
mainfrom
claude/issue-198-alternate-size
Oct 2, 2026
Merged

coffeemuse merged 3 commits into
mainfrom
claude/issue-198-alternate-size

Conversation

@coffeemuse

Copy link
Copy Markdown
Owner

Closes #198.

A model 4 starts on its 24x80 default screen, and TSO's logon switches it to the 43x80 alternate one. The session
window stayed a fixed 960x680 and the screen refitted the new grid into the same area, so the text shrank by about a
third, with blank bands on either side, until the window was resized by hand.

What changes

  • The cells fit the model's alternate size, not the screen showing. ScreenSize.AlternateFor(profile) (Core)
    is the profile's oversize geometry when it has one the engine would take, else the model's own size: what b3270
    reports as screen-mode's rows and columns, but known before the engine runs. TerminalScreen.AlternateSize makes
    it a floor on the grid CellGeometry.Fit sees, widened to the snapshot wherever that is larger. An Erase/Write
    Alternate therefore keeps the cell size, and the 24x80 default screen sits at the top left of the same area, as in
    x3270.
  • The window opens sized to that grid. TerminalScreen.MeasureOverride asks for it at PreferredFontSize
    (22, what 80 columns got across the old 960-wide window), or at the largest size that fits. SessionWindow is
    SizeToContent for its first layout only, capped by LimitOpeningSize to the working area of the display the
    user is on (App.OpeningDisplay, SessionWindow.OpeningRoom). Avalonia's own cap is the largest display's
    whole bounds on macOS and X11. Opened sets Manual and drops the cap, so from then on the size is the user's,
    and a bar appearing under the screen takes its room from the screen.
  • KeepsRequestedSize. Avalonia arranges a size-to-content window's content once before showing it, at the
    platform's first client size, and the OIA bar follows the font that arrange settles on. Without this, the bar's
    height came from a bogus size and the window opened a few DIPs short, one font size down. A headless test caught
    it. The screen keeps the size it asked for until Opened.
  • CellGeometry gains At (a given size, placed as Fit places its own) and GridSize (the room a grid takes,
    rounded up). Fit takes a 1e-9 epsilon so that an area GridSize measured fits the same size back.
  • Only a snapshot of a new size invalidates the screen's measure, not every host write.

Visible side effect

A model 2 window now opens snug around its screen, at about 951x610 rather than 960x680, with no bands above and
below.

Tests

  • New: ScreenSizeTests (Core), SessionWindowSizeTests, and the alternate-size, measure and
    KeepsRequestedSize cases in TerminalScreenLayoutTests and CellGeometryTests.
  • SessionWindowTests.Show() and one blink test now settle the layout after Show() or resize through a host.
    The screen is arranged at the window's opening size in the pass after Show, as on any real window before input
    arrives.
  • Full suite green; dotnet build LizTerm.slnx --no-incremental reports 0 warnings.

Hands-on

  • b3270 run as a model 4 against MVS/CE: screen-mode 43x80, then the VTAM screen erases to 24x80.
  • Robert's visual QA on macOS passed: a model 4 profile on MVS/CE opens tall, shows the logon screen at the top,
    and Wally ISPF at 43x80 keeps the same text size.
  • Observation from the same run, for the review: on a 2560x1440-point display, macOS placed the 951x1005 window
    with its top at y=475, so its bottom reached below the Dock. The size was capped correctly, but the placement is
    the platform's (WindowStartupLocation is still Manual). A possible follow-up is to centre the window on, or
    nudge it into, the display's working area once shown.
  • Not yet checked: Linux and Windows.

🤖 Generated with Claude Code

coffeemuse and others added 2 commits October 2, 2026 10:06
A model 4 starts on its 24x80 default screen, and TSO's logon switches it to
the 43x80 alternate one; the window stayed 960x680 and the screen refitted, so
the text shrank by about a third. The cells now fit the profile's alternate
size (or the screen, where larger), so the switch keeps the cell size and the
default screen sits at the top, as in x3270. The window sizes itself to that
grid at 22 pt for its first layout, capped to the display's working area, and
is the user's to resize from then on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- OversizeGeometry.TryFor is the one reading of a profile's oversize, for
  b3270's command line and the window's alternate size alike. A profile
  without the extended data stream has none, as b3270 drops -oversize
  without it, so its window no longer opens for a screen it never gets.
- A profile with a note or tags lays its connect banner out unseen until
  the window opens, so the banner arriving keeps the cell size.
- CellGeometry.GridSize asks for a DIP to spare, so a platform rounding
  the size to device pixels cannot take the font a size down.
- Opened moves the window into the working area its size was capped for.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coffeemuse

Copy link
Copy Markdown
Owner Author

High-effort code review: fixes in 97cdaed

A high-effort review raised six findings. Five are fixed in 97cdaed. One didn't reproduce, so it needed no change.

Fixed

  1. An oversize without the extended data stream sized the window. b3270 drops -oversize when extended is off (x3270 Common/model.c, oversize_init), but ScreenSize.AlternateFor still used it. A model 2 profile with oversize 132x60 and Extended unchecked opened for a 60x132 grid, with its 24x80 screen in one corner.
    • Now ScreenSize.AlternateFor reports the model's own size for such a profile.
    • BuildArguments no longer sends -oversize for it, which b3270 would have ignored anyway.
    • An oversize b3270 would refuse is still refused, extended or not.
  2. The two copies of the oversize rule are now one (reuse). ScreenSize.AlternateFor repeated B3270Session.BuildArguments' model lookup and TryParse step for step. OversizeGeometry.TryFor(profile, …) now serves both, so the engine and the window cannot disagree. Finding 1 arose from that duplication.
  3. The connect banner took the font down. In a window sized snug around its screen, the note/tags banner arriving on connect took its height from the screen: 22 went to 20 in a headless test, and back on the first keystroke.
    • A profile that shows the banner on connect (SessionViewModel.ShowsBannerOnConnect) now lays the banner out unseen until Opened (SessionWindow.ReserveBannerRoom). The window therefore opens with room for it, as the fixed 960x680 window had.
    • The error and Find bars still take their room from the screen, as designed.
  4. Rounding to device pixels could cost a font size. GridSize rounded up to whole DIPs only. At 125%, 951 DIPs is 1188.75 px, and a platform that truncates hands back 950.4 DIPs, under the exact grid width, so Fit floored a size down once KeepsRequestedSize cleared. GridSize now asks for one DIP to spare, and a test checks that an area a device pixel short at 125% still fits back.
  5. The size was capped but the window could still open off the display. This is the hands-on observation in the description: a 951x1005 window placed with its top at y=475 on a 1440-high display.
    • LimitOpeningSize now takes the display's working area.
    • Opened moves the window into it, no further than it has to go (SessionWindow.KeptInside, unit tested, plus a headless window test). The frame is measured as Avalonia's own CenterScreen measures it.
    • This also covers the platform choosing a different display from the one the size was capped for.

No change needed

  1. A capped opening sizing the screen against a 14-pt status bar. A new test opens a model 4 capped to heights from 500 to 900. In every case the screen and the bar settled at one size before the window opened, with the grid inside the screen, because the window's measure runs again against the bar's real height. I kept the test.

Visible effects of the fixes

  • Every session window opens 1 DIP wider and taller than before: a model 2 at about 952x611.
  • A profile with a note or tags opens taller by the banner's height. Once the banner goes, that room is blank space around the screen.

Still to check by hand

  • On macOS, the window being moved into the working area. Placement is the platform's, and the headless tests can't show what macOS does.
  • On Windows, opening at 125% and 150%: the text should open at 22, with no bands.
  • Linux and Windows generally, as before.

Full suite green. dotnet build LizTerm.slnx --no-incremental reports 0 warnings.

The review's first fix had OversizeGeometry.TryFor answer no oversize for a
profile without Extended, since b3270 drops -oversize when the extended data
stream is off. But an unchecked Extended only drops the model's -E, which
b3270 4.5 ignores: the bundled engine still reports extended and a 60x132
screen for -model 3279-2 -oversize 132x60. So that profile lost its oversize
on the command line, and its window opened for the model alone, which is
#198 again. TryFor stays as the one reading of the field, without the rule;
#200 tracks the checkbox, and its fix has to bring the rule back with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coffeemuse

Copy link
Copy Markdown
Owner Author

Review follow-up: fix 1 taken back out in 6023078

Checking 97cdaed turned up a wrong premise in fix 1, "an oversize without the extended data stream sized the
window".

  • The premise. b3270 does drop -oversize when the extended data stream is off (oversize_init). But an
    unchecked Extended data stream only drops the model's -E, and b3270 4.5 ignores that suffix. With the bundled
    engine, -model 3279-2 -oversize 132x60 still reports extended: true and a 60x132 screen, and TerminalName is
    still IBM-3279-2-E.
  • What fix 1 broke. Such a profile lost its oversize from b3270's command line, and its window opened sized for
    the model alone. When the host switched to the oversize screen, the text shrank, which is Session window: size for the model's alternate screen, and keep the text size when the host switches (Discord report) #198 again.
  • The correction. OversizeGeometry.TryFor stays as the one reading of the field (fix 2), without the Extended
    rule. The two tests the review added now expect the oversize to be kept: ScreenSizeTests, and BuildArguments
    in B3270SessionLifecycleTests.
  • The checkbox. It has no effect at all, which is a bug of its own, now Profile editor: the Extended data stream checkbox has no effect #200. Setting
    -set extendedDataStream=false does what the box promises, and b3270 then drops the oversize. So the Profile editor: the Extended data stream checkbox has no effect #200 fix has
    to bring this rule back in the same change. TryFor's summary says so.

Fixes 2 to 5 stand. Fix 5 checked out live on macOS: a model 4 window, 952x1006, opened with its top at y=122 and
its bottom at y=1128, inside a working area that runs from y=30 to y=1404. The earlier run had reached y=1480.

Full suite green. dotnet build LizTerm.slnx --no-incremental reports 0 warnings. Still owed: Windows at 125% and
150%, and Linux.

@coffeemuse
coffeemuse merged commit d5d2dbb into main Oct 2, 2026
6 checks passed
@coffeemuse
coffeemuse deleted the claude/issue-198-alternate-size branch October 2, 2026 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Session window: size for the model's alternate screen, and keep the text size when the host switches (Discord report)

1 participant