Ticket #5969: terminal2.diff

File terminal2.diff, 3.2 KB (added by romain, 14 years ago)
  • TermWindow.cpp

     
    805805        session->windowTitle = fInitialTitle;
    806806        fSessions.AddItem(session);
    807807
    808         BTab *tab = new BTab;
    809         fTabView->AddTab(scrollView, tab);
    810         tab->SetLabel(session->name.String());
    811             // TODO: Use a better name. For example, do like MacOS X's Terminal
    812             // and update the title using the last executed command ?
    813             // Or like Gnome's Terminal and use the current path ?
    814         view->SetScrollBar(scrollView->ScrollBar(B_VERTICAL));
    815         view->SetMouseClipboard(gMouseClipboard);
    816         view->SetEncoding(EncodingID(
    817             PrefHandler::Default()->getString(PREF_TEXT_ENCODING)));
    818 
    819         BFont font;
    820         _GetPreferredFont(font);
    821         view->SetTermFont(&font);
    822 
    823         _SetTermColors(containerView);
    824 
    825808        int width, height;
    826809        view->GetFontSize(&width, &height);
    827810
    828811        float minimumHeight = -1;
    829812        if (fMenubar)
    830813            minimumHeight += fMenubar->Bounds().Height() + 1;
    831         if (fTabView && fTabView->CountTabs() > 1)
     814        if (fTabView && fTabView->CountTabs() > 0)
    832815            minimumHeight += fTabView->TabHeight() + 1;
    833816        SetSizeLimits(MIN_COLS * width - 1, MAX_COLS * width - 1,
    834817            minimumHeight + MIN_ROWS * height - 1,
     
    837820            // the terminal can be resized smaller than MIN_ROWS/MIN_COLS!
    838821
    839822        // If it's the first time we're called, setup the window
    840         if (fTabView->CountTabs() == 1) {
     823        if (fTabView->CountTabs() == 0) {
    841824            float viewWidth, viewHeight;
    842825            containerView->GetPreferredSize(&viewWidth, &viewHeight);
    843826
     
    847830                // NOTE: Width is one pixel too small, since the scroll view
    848831                // is one pixel wider than its parent.
    849832        }
     833
     834        BTab *tab = new BTab;
     835        fTabView->AddTab(scrollView, tab);
     836        tab->SetLabel(session->name.String());
     837            // TODO: Use a better name. For example, do like MacOS X's Terminal
     838            // and update the title using the last executed command ?
     839            // Or like Gnome's Terminal and use the current path ?
     840        view->SetScrollBar(scrollView->ScrollBar(B_VERTICAL));
     841        view->SetMouseClipboard(gMouseClipboard);
     842        view->SetEncoding(EncodingID(
     843            PrefHandler::Default()->getString(PREF_TEXT_ENCODING)));
     844
     845        BFont font;
     846        _GetPreferredFont(font);
     847        view->SetTermFont(&font);
     848
     849        _SetTermColors(containerView);
     850
    850851        // TODO: No fTabView->Select(tab); ?
    851852        fTabView->Select(fTabView->CountTabs() - 1);
    852853    } catch (...) {
  • TermView.cpp

     
    208208    if (status != B_OK)
    209209        throw status;
    210210
     211    ResizeToPreferred();
     212
    211213    // TODO: Don't show the dragger, since replicant capabilities
    212214    // don't work very well ATM.
    213215    /*
     
    10261028{
    10271029    fMouseButtons = 0;
    10281030
     1031    // update the terminal size because it may have changed while the TermView
     1032    // was detached from the window. On such conditions FrameResized was not
     1033    // called when the resize occured
     1034    int rows;
     1035    int columns;
     1036    GetTermSizeFromRect(Bounds(), &rows, &columns);
     1037    SetTermSize(rows, columns);
    10291038    MakeFocus(true);
    10301039    if (fScrollBar) {
    10311040        fScrollBar->SetSteps(fFontHeight, fFontHeight * fRows);