[haiku-commits] r36875 - haiku/trunk/src/apps/terminal

  • From: superstippi@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 20 May 2010 14:10:44 +0200 (CEST)

Author: stippi
Date: 2010-05-20 14:10:44 +0200 (Thu, 20 May 2010)
New Revision: 36875
Changeset: http://dev.haiku-os.org/changeset/36875/haiku
Ticket: http://dev.haiku-os.org/ticket/5969

Modified:
   haiku/trunk/src/apps/terminal/TermView.cpp
   haiku/trunk/src/apps/terminal/TermWindow.cpp
Log:
Patch by romain: Fix one particular problem where the terminal buffer area could
go out of sync when switching between tabs. Closes #5969, thanks a lot!


Modified: haiku/trunk/src/apps/terminal/TermView.cpp
===================================================================
--- haiku/trunk/src/apps/terminal/TermView.cpp  2010-05-20 06:50:24 UTC (rev 
36874)
+++ haiku/trunk/src/apps/terminal/TermView.cpp  2010-05-20 12:10:44 UTC (rev 
36875)
@@ -208,6 +208,8 @@
        if (status != B_OK)
                throw status;
 
+       ResizeToPreferred();
+
        // TODO: Don't show the dragger, since replicant capabilities
        // don't work very well ATM.
        /*
@@ -1026,6 +1028,13 @@
 {
        fMouseButtons = 0;
 
+       // update the terminal size because it may have changed while the 
TermView
+       // was detached from the window. On such conditions FrameResized was not
+       // called when the resize occured
+       int rows;
+       int columns;
+       GetTermSizeFromRect(Bounds(), &rows, &columns);
+       SetTermSize(rows, columns);
        MakeFocus(true);
        if (fScrollBar) {
                fScrollBar->SetSteps(fFontHeight, fFontHeight * fRows);

Modified: haiku/trunk/src/apps/terminal/TermWindow.cpp
===================================================================
--- haiku/trunk/src/apps/terminal/TermWindow.cpp        2010-05-20 06:50:24 UTC 
(rev 36874)
+++ haiku/trunk/src/apps/terminal/TermWindow.cpp        2010-05-20 12:10:44 UTC 
(rev 36875)
@@ -805,30 +805,13 @@
                session->windowTitle = fInitialTitle;
                fSessions.AddItem(session);
 
-               BTab *tab = new BTab;
-               fTabView->AddTab(scrollView, tab);
-               tab->SetLabel(session->name.String());
-                       // TODO: Use a better name. For example, do like MacOS 
X's Terminal
-                       // and update the title using the last executed command 
?
-                       // Or like Gnome's Terminal and use the current path ?
-               view->SetScrollBar(scrollView->ScrollBar(B_VERTICAL));
-               view->SetMouseClipboard(gMouseClipboard);
-               view->SetEncoding(EncodingID(
-                       PrefHandler::Default()->getString(PREF_TEXT_ENCODING)));
-
-               BFont font;
-               _GetPreferredFont(font);
-               view->SetTermFont(&font);
-
-               _SetTermColors(containerView);
-
                int width, height;
                view->GetFontSize(&width, &height);
 
                float minimumHeight = -1;
                if (fMenubar)
                        minimumHeight += fMenubar->Bounds().Height() + 1;
-               if (fTabView && fTabView->CountTabs() > 1)
+               if (fTabView && fTabView->CountTabs() > 0)
                        minimumHeight += fTabView->TabHeight() + 1;
                SetSizeLimits(MIN_COLS * width - 1, MAX_COLS * width - 1,
                        minimumHeight + MIN_ROWS * height - 1,
@@ -837,7 +820,7 @@
                        // the terminal can be resized smaller than 
MIN_ROWS/MIN_COLS!
 
                // If it's the first time we're called, setup the window
-               if (fTabView->CountTabs() == 1) {
+               if (fTabView->CountTabs() == 0) {
                        float viewWidth, viewHeight;
                        containerView->GetPreferredSize(&viewWidth, 
&viewHeight);
 
@@ -847,6 +830,24 @@
                                // NOTE: Width is one pixel too small, since 
the scroll view
                                // is one pixel wider than its parent.
                }
+
+               BTab *tab = new BTab;
+               fTabView->AddTab(scrollView, tab);
+               tab->SetLabel(session->name.String());
+                       // TODO: Use a better name. For example, do like MacOS 
X's Terminal
+                       // and update the title using the last executed command 
?
+                       // Or like Gnome's Terminal and use the current path ?
+               view->SetScrollBar(scrollView->ScrollBar(B_VERTICAL));
+               view->SetMouseClipboard(gMouseClipboard);
+               view->SetEncoding(EncodingID(
+                       PrefHandler::Default()->getString(PREF_TEXT_ENCODING)));
+
+               BFont font;
+               _GetPreferredFont(font);
+               view->SetTermFont(&font);
+
+               _SetTermColors(containerView);
+
                // TODO: No fTabView->Select(tab); ?
                fTabView->Select(fTabView->CountTabs() - 1);
        } catch (...) {


Other related posts:

  • » [haiku-commits] r36875 - haiku/trunk/src/apps/terminal - superstippi