Bug 345403 - "Terminal Size" setting in profile ignored
Summary: "Terminal Size" setting in profile ignored
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: master
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
: 343321 345138 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-03-21 21:21 UTC by Kenneth Graunke
Modified: 2021-06-30 15:29 UTC (History)
28 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Workaround to force the terminal size from the profile (580 bytes, patch)
2015-12-09 13:42 UTC, Daniel Scharrer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kenneth Graunke 2015-03-21 21:21:16 UTC
Konsole is ignoring the "Terminal Size" setting in my shell profile, even with "Use current window size on next startup" unchecked.  Instead, it always uses the last saved window size.  Unchecking that simply makes Konsole stop updating the saved window size.

Specifically:
- My "Terminal Size" setting is 80x70.  I want all new terminals to be that size.
- If I check "Use current window size on next startup", resize the terminal to be 40x30, and then uncheck "Use current window size" again...then all future terminals will be 40x30.
- With it unchecked, I can resize terminals all I want - it remains 40x30.

Reproducible: Always
Comment 1 Kenneth Graunke 2015-04-15 08:27:04 UTC
I think I was wrong in my earlier assessment -sorry for overcomplicating the report.  Here's a much simpler report.

Even with "Use current window size on next startup" unchecked, Konsole simply ignores the profile's preferred window size, and uses some default size.

I built Konsole from source, and verified that
- ~/.local/share/konsole/Shell.profile does contain TerminalRows=75
- ~/.config/konsolerc does not contain any Height/Width lines
- Konsole does read my profile settings, and sets the Session's preferredSize correctly.
- Konsole::Session::updateTerminalSize somehow has the wrong number of rows/columns.

So it looks like the information is getting lost somehow, or overridden...I'm having a hard time following the code to figure out why.
Comment 2 Michał Zając 2015-05-21 00:52:18 UTC
I can confirm this. Running Kubuntu 15.04 and this is definitely broken.
Comment 3 Galen 2015-06-20 23:24:30 UTC
Also confirmed on Fedora 22.
Comment 4 wstrecke 2015-06-23 17:07:59 UTC
Confirmed again on f22
Comment 5 suicidaleggroll 2015-07-23 00:23:50 UTC
Confirmed on OpenSUSE Tumbleweed
Comment 6 Cliff Dyer 2015-08-06 11:52:53 UTC
Konfirmed in Debian stretch/testing.

I have QHD graphics (3840x2160), with "Force Fonts DPI" set to 144, and the text size set to 14pt Oxygen Mono, and the window always opens to a mostly useless 36c x 14r, regardless of how I edit my profile settings.
Comment 7 Rex Dieter 2015-09-16 15:53:48 UTC
I can confirm this one
Comment 8 rubin110 2015-09-17 23:25:40 UTC
Debian Sid amd64
Linux 4.1.3
plasma-desktop 4:5.4.1-1 
konsole 4:15.08.0-1

Confirm this is happening too.
Comment 9 Kenneth Graunke 2015-10-20 06:55:54 UTC
Is anyone looking into this?  This is a regression from KDE 4, it's affecting a lot of people in a core developer application, and is really easy to reproduce - pretty much anyone looking for a fixed-size terminal (say, 80 characters wide) doesn't get one.  I imagine it's a pretty simple fix...
Comment 10 Torsten Römer 2015-10-20 15:18:27 UTC
*** Bug 345138 has been marked as a duplicate of this bug. ***
Comment 11 rubin110 2015-10-25 02:38:46 UTC
Still an issue in Debian Sid...

plasma-desktop                                              4:5.4.2-1
Comment 12 Rex Dieter 2015-11-11 17:27:49 UTC
*** Bug 343321 has been marked as a duplicate of this bug. ***
Comment 13 Ian Pilcher 2015-11-12 07:02:19 UTC
I spent some time poking around with gdb, and I *think* that I might have some idea what the problem is.

TerminalDisplay::setSize(), which does get called with the correct columns/lines, calculates a pixel-based size for the widget and sticks it in TerminalDisplay::_size.  That value will be returned by TerminalDisplay::sizeHint().  It then calls QWidget::updateGeometry(), which would normally update the layout system.

A bit later, TerminalDisplay::calcGeometry() is called to recalculate TerminalDisplay::_contentRect.  It uses the present widget area, as returned by QWidget::contentsRect(), as its starting point.

I suspect that the authors of this code assumed that the call to QWidget::updateGeometry() in TerminalDisplay::setSize() would update the state of the widget, causing the call to QWidget::contentsRect() in TerminalDisplay::calcGeometry() to return a result that reflects the new size.  Unfortunately, this is not the case; in fact, it seems to have no effect at all.

I can't help wondering if this is a change from Qt4 to Qt5.
Comment 14 Ian Pilcher 2015-11-12 17:03:10 UTC
Just for grins I went back to konsole v4.12.19 (commit 232af90a032d0984b0121aa6ea3ad982cdec9635 from 24 March, 2014).

The geometry & resizing code in TerminalDisplay.cpp looks very similar -- possibly even completely unchanged -- and the behavior is almost identical.  The difference is that TerminalDisplay::calcGeometry() is called an additional (2nd) time after TerminalDisplay::setSize().  This time QWidget::contentsRect() does return an update size.  So it looks like my assumption about the way this code is intended to work is likely correct.

Here is the backtrace from the 2nd call call to TerminalDisplay::calcGeometry():

#0  Konsole::TerminalDisplay::calcGeometry (this=this@entry=0x8a06f0) at /home/ipilcher/konsole/src/TerminalDisplay.cpp:1684      
#1  0x00007ffff795f22d in Konsole::TerminalDisplay::makeImage (this=this@entry=0x8a06f0)                                          
    at /home/ipilcher/konsole/src/TerminalDisplay.cpp:1657                                                                        
#2  0x00007ffff7961797 in Konsole::TerminalDisplay::updateImageSize (this=0x8a06f0)                                               
    at /home/ipilcher/konsole/src/TerminalDisplay.cpp:1626                                                                        
#3  0x00007ffff49d4140 in QWidget::event(QEvent*) () from /lib64/libQtGui.so.4                                                    
#4  0x00007ffff796600a in Konsole::TerminalDisplay::event (this=0x8a06f0, event=0x7fffffffce30)                                   
    at /home/ipilcher/konsole/src/TerminalDisplay.cpp:3027                                                                        
#5  0x00007ffff497d93c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /lib64/libQtGui.so.4                      
#6  0x00007ffff4984796 in QApplication::notify(QObject*, QEvent*) () from /lib64/libQtGui.so.4                                    
#7  0x00007ffff680654a in KApplication::notify(QObject*, QEvent*) () from /lib64/libkdeui.so.5                                    
#8  0x00007ffff5af38dd in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /lib64/libQtCore.so.4                       
#9  0x00007ffff4a1be61 in QWidgetPrivate::setGeometry_sys(int, int, int, int, bool) () from /lib64/libQtGui.so.4                  
#10 0x00007ffff49cbb75 in QWidget::setGeometry(QRect const&) () from /lib64/libQtGui.so.4                                         
#11 0x00007ffff49aa36d in QLayoutPrivate::doResize(QSize const&) () from /lib64/libQtGui.so.4                                     
#12 0x00007ffff497d90e in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /lib64/libQtGui.so.4                      
#13 0x00007ffff4984796 in QApplication::notify(QObject*, QEvent*) () from /lib64/libQtGui.so.4                                    
#14 0x00007ffff680654a in KApplication::notify(QObject*, QEvent*) () from /lib64/libkdeui.so.5                                    
#15 0x00007ffff5af38dd in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /lib64/libQtCore.so.4                       
#16 0x00007ffff4a1be61 in QWidgetPrivate::setGeometry_sys(int, int, int, int, bool) () from /lib64/libQtGui.so.4
#17 0x00007ffff49cbb75 in QWidget::setGeometry(QRect const&) () from /lib64/libQtGui.so.4
#18 0x00007ffff49adf5d in QWidgetItem::setGeometry(QRect const&) () from /lib64/libQtGui.so.4
#19 0x00007ffff498cd00 in QBoxLayout::setGeometry(QRect const&) () from /lib64/libQtGui.so.4
#20 0x00007ffff49aa36d in QLayoutPrivate::doResize(QSize const&) () from /lib64/libQtGui.so.4
#21 0x00007ffff49abf40 in QLayout::activate() () from /lib64/libQtGui.so.4
#22 0x00007ffff497d90e in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /lib64/libQtGui.so.4
#23 0x00007ffff4984796 in QApplication::notify(QObject*, QEvent*) () from /lib64/libQtGui.so.4
#24 0x00007ffff680654a in KApplication::notify(QObject*, QEvent*) () from /lib64/libkdeui.so.5
#25 0x00007ffff5af38dd in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /lib64/libQtCore.so.4
#26 0x00007ffff5af6ef6 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /lib64/libQtCore.so.4
#27 0x00007ffff5b23d1e in postEventSourceDispatch(_GSource*, int (*)(void*), void*) () from /lib64/libQtCore.so.4
#28 0x00007fffee41de3a in g_main_dispatch (context=0x6c31f0) at gmain.c:3154
#29 g_main_context_dispatch (context=context@entry=0x6c31f0) at gmain.c:3769
#30 0x00007fffee41e1d0 in g_main_context_iterate (context=context@entry=0x6c31f0, block=block@entry=1, 
    dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3840
#31 0x00007fffee41e27c in g_main_context_iteration (context=0x6c31f0, may_block=1) at gmain.c:3901
#32 0x00007ffff5b23e8e in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /lib64/libQtCore.so.4
#33 0x00007ffff4a263e6 in QGuiEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /lib64/libQtGui.so.4
#34 0x00007ffff5af2151 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQtCore.so.4
#35 0x00007ffff5af24c5 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQtCore.so.4
#36 0x00007ffff5af8069 in QCoreApplication::exec() () from /lib64/libQtCore.so.4
#37 0x00007ffff7bd0eaa in kdemain (argc=3, argv=0x7fffffffde38) at /home/ipilcher/konsole/src/main.cpp:86
#38 0x00007ffff2954580 in __libc_start_main (main=0x400860 <main(int, char**)>, argc=3, argv=0x7fffffffde38, 
    init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffde28) at libc-start.c:289
#39 0x0000000000400899 in _start ()

It looks like it's processing a resize event, but I'm unable to figure out where this event was generated.  Was it explicitly generated elsewhere in the konsole code, or was created automatically by Qt4 because of the earlier QWidget::updateGeometry() call with a new _size?
Comment 15 Éric Brunet 2015-11-19 14:04:15 UTC
I can see this bug in fedora 23. One can get around it by making a windows rule, but it is annoying.
Comment 16 jeremy9856 2015-12-02 13:06:23 UTC
Confirmed on Manjaro
Comment 17 Daniel Scharrer 2015-12-09 13:42:10 UTC
Created attachment 95952 [details]
Workaround to force the terminal size from the profile

I'm not familiar enough with the code to provide a proper fix, but at least this patch makes konsole usable again for me. It breaks the "Use current window size on next startup" option though.
Comment 18 jeremy9856 2015-12-10 10:45:15 UTC
It's a 10 months bug that seems to be an easy one to fix.
Can it be fixed please for the 15.12 release ?
Thank you !
Comment 19 Jean-Christophe Baptiste 2015-12-10 19:08:36 UTC
Same issue here for a long, long time. Yes, it would be nice to finally have a fix. Thanks.
Comment 20 jeremy9856 2015-12-15 13:14:26 UTC
15.12 release is almost here. Maybe for 15.12.1 ?
Comment 21 jeremy9856 2016-01-02 16:12:44 UTC
Nobody seem to care about this little bug.
Comment 22 rapar 2016-01-05 08:31:39 UTC
I confirm that I can't re-size Konsole through the profile.
If this option doesn't work, then I'll never consider switching to Konsole as a default terminal, which is basically the reason why I tried re-sizing it in the first place.
It would be good to see this fixed.
Comment 23 Glenn Holmer 2016-01-14 15:19:18 UTC
It's not good to have non-working configuration options in such a high-profile Plasma app. Won't someone please address this?
Comment 24 Radics Péter 2016-01-15 07:49:15 UTC
Could someone just review the change proposed by Daniel Scharrer? (Just check if it doesn't cause any serious damage, and apply it as a quick-fix until someone can look into the issue deeper).

This issue is really annoying...

 in Comment 17(In reply to Daniel Scharrer from comment #17)
> Created attachment 95952 [details]
> Workaround to force the terminal size from the profile
> 
> I'm not familiar enough with the code to provide a proper fix, but at least
> this patch makes konsole usable again for me. It breaks the "Use current
> window size on next startup" option though.
Comment 25 jeremy9856 2016-01-22 14:00:49 UTC
A reminder for this that need to be fixed.
Comment 26 Terry Barnaby 2016-01-25 19:58:52 UTC
Another reminder that this is causing users pain.
Comment 27 Roman Gilg 2016-01-29 19:39:58 UTC
Hi!

FYI I requested a review for a possible fix: https://git.reviewboard.kde.org/r/126924/
The maintainer Kurt plans to look on the patch in the next few days. But I have not much experience in coding KDE stuff. So don't expect the fix to be perfect. It could also be the case, that it's not acceptable at all.

You can still try it out though if you wish to by downloading the diff and compiling Konsole yourself with the patch (git apply mypatch). In any case, if there is something you want to have changed about the patch, just tell me.
Comment 28 Terry Barnaby 2016-01-30 08:31:43 UTC
Thanks for the patch. I have created an updated kconsole5 rpm with this and am trying it out now.
So far its appears to work fine :)
Comment 29 Kurt Hindenburg 2016-01-30 17:15:07 UTC
Git commit 55f02e5b8e3e2395050940c33c97306311192e18 by Kurt Hindenburg.
Committed on 30/01/2016 at 17:09.
Pushed by hindenburg into branch 'master'.

Allow profile's termainal size to work again

When Konsole Settings -> 'Use current window size on next startup' is
disabled, use the Profile's terminal size for new windows.

Many thanks to Roman Gilg (subdiff gmail com) for research and patch.

If there are no further issues, I'll commit to 15.12 branch (should go
.2 release).

REVIEW: 126924

M  +24   -7    src/Application.cpp
M  +2    -1    src/Application.h

http://commits.kde.org/konsole/55f02e5b8e3e2395050940c33c97306311192e18
Comment 30 jeremy9856 2016-01-30 18:34:05 UTC
Thank you very very much Roman Gilg (subdiff) !
Comment 31 Torsten Römer 2016-01-31 13:56:03 UTC
Cheers Roman and Kurt!
Comment 32 jeremy9856 2016-01-31 13:57:13 UTC
Maybe we should mark it as FIXED ?
Comment 33 Kurt Hindenburg 2016-02-06 15:26:34 UTC
Git commit 1e211482566edb9194f34755b823bd98f15c6f25 by Kurt Hindenburg.
Committed on 06/02/2016 at 15:11.
Pushed by hindenburg into branch 'Applications/15.12'.

Allow profile's termainal size to work again

When Konsole Settings -> 'Use current window size on next startup' is
disabled, use the Profile's terminal size for new windows.

Many thanks to Roman Gilg (subdiff gmail com) for research and patch.

If there are no further issues, I'll commit to 15.12 branch (should go
.2 release).

REVIEW: 126924
(cherry picked from commit 55f02e5b8e3e2395050940c33c97306311192e18)

M  +24   -7    src/Application.cpp
M  +2    -1    src/Application.h

http://commits.kde.org/konsole/1e211482566edb9194f34755b823bd98f15c6f25
Comment 34 Radics Péter 2016-02-18 11:18:08 UTC
The setting works again, but it doesn't take into account if the menu bar is disabled or not (apparently it always assumes that it is enabled and calculates the size based on that).

I have the menu bar disabled, thus I have to set the size to 80x23 to get a 80x25 window.  If I turn the menubar on, I'll get a 80x23 window with menubar (as set in the settings).
Comment 35 Roman Gilg 2016-02-18 11:49:40 UTC
Thanks for feedback. Did I understand correctly that this is only a non critical problem because there is the workaround of just applying some different size (in your case 80x23 instead of 80x25)?

In this case I would ignore that for the moment, because there seems to be some bigger transition going on in the Konsole Source (moving away from KUniqueApplication), which also could affect our fix for this bug.
Comment 36 Radics Péter 2016-02-18 11:52:55 UTC
(In reply to subdiff from comment #35)

Yes, I can use the workaround for now (in fact, I have been using another workaround on my main computer until now ;), just wanted to let you know that the fix is not "perfect" :)
Comment 37 Albert Astals Cid 2016-02-21 15:29:06 UTC
Radics, i suggest opening a new bug with a clearer description for that "ignores menubar" part
Comment 38 Radics Péter 2016-02-22 08:14:23 UTC
(In reply to Albert Astals Cid from comment #37)
> Radics, i suggest opening a new bug with a clearer description for that
> "ignores menubar" part

Done, see bug 359662.