[kde-freebsd] konsole session title limited to 20 chars in tab bar
Raphael Kubo da Costa
kubito at gmail.com
Wed May 26 15:25:30 CEST 2010
On Wednesday 26 May 2010 06:55:31 Andriy Gapon wrote:
> I know that this is an upstream question, but let me start here.
> Why have
> http://people.freebsd.org/~avg/konsole1.png
> when you can have
> http://people.freebsd.org/~avg/konsole2.png
>
> I like to have many sessions open in one konsole window and I also like
> having meaningful/useful titles for them (set via %w plus shell magic).
> Having a title *always* limited to 20 characters (regardless of number of
> tabs or tab width) really sucks.
>
> The change was trivial, in apps/konsole/src/ViewContainer.cpp first add
> setElideMode() to constructor of ViewContainerTabBar, so that it looks like
> this:
>
> ViewContainerTabBar::ViewContainerTabBar(QWidget*
> parent,TabbedViewContainer* container)
>
> : KTabBar(parent)
>
> , _container(container)
> , _dropIndicator(0)
> , _dropIndicatorIndex(-1)
> , _drawIndicatorDisabled(false)
> {
> setElideMode(Qt::ElideLeft);
> }
>
> And then drop the stupid limiting code:
> void TabbedViewContainer::updateTitle(ViewProperties* item)
> {
> // prevent tab titles from becoming overly-long as this limits the
> number // of tabs which can fit in the tab bar.
> //
> // if the view's title is overly long then trim it and select the
> // right-most 20 characters (assuming they contain the most useful
> // information) and insert an elide at the front
> const int MAX_TAB_TEXT_LENGTH = 20;
>
> QListIterator<QWidget*> iter(widgetsForItem(item));
> while ( iter.hasNext() )
> {
> const int index = _stackWidget->indexOf( iter.next() );
>
> QString tabText = item->title();
> #if 0
> if (tabText.count() > MAX_TAB_TEXT_LENGTH)
> tabText = tabText.right(MAX_TAB_TEXT_LENGTH).prepend("...");
> #endif
> _tabBar->setTabText( index , tabText );
> }
> }
>
>
> Proper diff is coming later ;-)
Hmm, as you've said, even with a proper diff I don't think it'd be good to
keep a patch like this in our tree -- I strongly suggest filing a review
request for Konsole on reviewboard.kde.org for that.
More information about the kde-freebsd
mailing list