Skip to content

Fix the first lines of a file hiding behind its tab bar - #605

Merged
hannesa2 merged 1 commit into
gitx:masterfrom
goneng:fix-file-view-under-the-type-bar
Sep 12, 2026
Merged

hannesa2 merged 1 commit into
gitx:masterfrom
goneng:fix-file-view-under-the-type-bar

Conversation

@goneng

@goneng goneng commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Fixes #598.

The Source, Blame and History bar shares its pane with the file viewer:
the bar sits in the top 25 points, the viewer fills the rest. Ending a
live window resize threw that away:

- (void)windowDidEndLiveResizeWithNotification:(NSNotification *)theNotification
{
    self.view.autoresizingMask = ...;
    self.view.frame = self.view.superview.bounds;   // the whole pane
}

The viewer then covered the bar's 25 points too, and since the bar is the
later sibling it is drawn on top, hiding the first line and a half of
every file from then on. That is why it looks like a per-repository
problem: it is per-window, and it starts the first time that window is
resized.

PBWebController now asks itself which frame its web view is to occupy,
which for every other web view in GitX is still the whole superview, and
GLFileView answers with the room below the bar.

Test plan

  • New GLFileViewLayoutTests: 3 tests, all failing on master, covering
    the viewer's frame at two pane heights and with a bar laid out taller
    than the nib reserved for it
  • make unit-test: 52 tests, 0 failures
  • Traced the real thing: with a file open in the tree view, the viewer
    sits at y=546, below the bar at 521..546. Dragging the window edge on
    master moves it to y=521, under the bar; with this change it stays at
    546 across repeated resizes
  • Checked the commit view's diff, which shares the base class, still
    fills its own pane after a resize

@goneng
goneng marked this pull request as ready for review September 11, 2026 23:37
@goneng
goneng force-pushed the fix-file-view-under-the-type-bar branch 2 times, most recently from 1a3e2e1 to 52ec66d Compare September 12, 2026 09:36
@hannesa2

Copy link
Copy Markdown
Contributor

Just as hint: Somethimes a before/after-picture tells more about the desired change.

Resizing a window left the file viewer stretched over the whole pane it
shares with the Source, Blame and History bar, and the bar, drawn after
it, covered the top of the file from then on.

* Ask the controller which frame its web view is to occupy when a live
  resize ends, rather than handing it the whole pane
* Answer that in the file view by stopping the viewer where the bar
  starts, so a bar laid out taller than the nib reserved for it takes
  the room from the viewer rather than from the file
@goneng
goneng force-pushed the fix-file-view-under-the-type-bar branch from 52ec66d to fb425f5 Compare September 12, 2026 15:27
@goneng goneng added the bugfix label Sep 12, 2026
@goneng
goneng requested a review from hannesa2 September 12, 2026 18:35
@goneng

goneng commented Sep 12, 2026 •

Copy link
Copy Markdown
Collaborator Author

Just as hint: Somethimes a before/after-picture tells more about the desired change.

"A picture is worth a thousand words"...

When opening GitX and switching to the Tree-view view, the file-content windows is sized correctly and the content of any file is shown starting at line 1 of that file:

GitX_fix-file-view-under-the-type-bar_before-resize

 

After that, if we resize the main GitX window - and it doesn't matter in which direction - the size of the file-content windows is recalculated (the wrong way) and the content of any file is shown starting at line 2.5 of that file:

GitX_fix-file-view-under-the-type-bar_after-resize

 

Before this fix, the only "workaround" I found was to close GitX and reopen it...

@hannesa2
hannesa2 merged commit 8fa8dee into gitx:master Sep 12, 2026
3 checks passed
@goneng
goneng deleted the fix-file-view-under-the-type-bar branch September 13, 2026 04:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: File source in tree view

2 participants