Opened 9 years ago

Closed 9 years ago

#5969 closed bug (fixed)

Terminal size is not correct when 2nd tab is added in zoom/fullscreen

Reported by: romain Owned by: jackburton
Priority: normal Milestone: R1
Component: Applications/Terminal Version: R1/alpha2
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: yes Platform: All

Description

  • Start a Terminal
  • Zoom/expand the window
  • add a second tab
  • Select the first tab -> The last line at the bottom of the terminal view is no more visible.

When the terminal window is zoomed or in fullscreen mode, the window size cannot be increased to display the SmartTabView. So the TermView of the first tab is resized to a smaller size. This resize is done while the TermView is detached from the window, so its internal size is changed in BView::_ResizeBy, but the FrameResized hook is not called. When the first tab is selected later it is resized in SmartTabView::Select, but since its size was already changed internaly, this call has no effect.

Enclosed is a partial patch to fix this:

  • Each time a TermView is attached to a window, SetTermSize is called to make the row/column count match the view size.
  • In order to get this working at startup, the TermView size is initialized in its contructor.

However there is another issue I could not fix correctly: Somewhere when initializing the SmartTabView, the TermView is resized to very small values. In the patch, a test is added to prevent resizing the TermView to too small settings.

Attachments (2)

terminal.diff (740 bytes) - added by romain 9 years ago.
terminal2.diff (3.2 KB) - added by romain 9 years ago.

Download all attachments as: .zip

Change History (6)

Changed 9 years ago by romain

Attachment: terminal.diff added

comment:1 Changed 9 years ago by stippi

Thanks for the patch!

  • In the first hunk, a single ResizeToPreferred() should be equivalent to getting the preferred size and resizing to that.
  • The second part looks reasonable to me. However, I would put the declaration of rows and columns directly above the call where they get used. Also, to find out where the view is resized to such small values, you could add a debugger() invokation when you detect the values are unreasonable, and then you get a stack trace and know from where this happens.

comment:2 Changed 9 years ago by romain

Here is another patch.

The small values come from the default size of the TermWindow that is set in the TermApp constructor:

  • TermWindow is created with width/height 50
  • TermView is created with default col/row values
  • TermView is added to TabView -> This resizes the TermView to the size of the TermWindow and attaches it. This is why the first patch changes the terminal size to very small values.
  • TermWindow is resized with the size of the TermView (when adding the first TermView), that is very small size.

This second patch simply resizes the TermWindow before the TermView is added to the window. With this termView::AttachedToWindow is always called with correct bounds.

Changed 9 years ago by romain

Attachment: terminal2.diff added

comment:3 Changed 9 years ago by stippi

Has a Patch: set

comment:4 Changed 9 years ago by stippi

Resolution: fixed
Status: newclosed

Applied in hrev36875. Thanks a lot!

Note: See TracTickets for help on using tickets.