Bug 401463

Summary: bad border rendering in mc inside konsole
Product: [Applications] konsole Reporter: Vadym Krevs <vkrevs>
Component: fontAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED FIXED    
Severity: normal CC: chronobserver, fabian, martin.sandsmark, nate, piotr.mierzwinski, wbauer1
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In: 19.04.0
Sentry Crash Report:
Attachments: Expected rendering of borders in mc inside konsole
Current rendering of borders in mc in konsole
Alsamixer in konsole master

Description Vadym Krevs 2018-11-27 11:16:06 UTC
Created attachment 116531 [details]
Expected rendering of borders in mc inside konsole

SUMMARY

openSUSE Leap 15.0

$ rpm -qa | egrep "konsole-|plasma5-desktop-|plasma5-workspace|mc-" | sort
konsole-18.11.80-lp150.1.1.x86_64
konsole-debuginfo-18.11.80-lp150.1.1.x86_64
konsole-debugsource-18.11.80-lp150.1.1.x86_64
konsole-part-18.11.80-lp150.1.1.x86_64
konsole-part-debuginfo-18.11.80-lp150.1.1.x86_64
konsole-part-lang-18.11.80-lp150.1.1.noarch
mc-4.8.20-lp150.3.3.1.x86_64
mc-lang-4.8.20-lp150.3.3.1.noarch
plasma5-desktop-5.14.3-lp150.337.1.x86_64
plasma5-desktop-lang-5.14.3-lp150.337.1.noarch
plasma5-workspace-5.14.3-lp150.430.1.x86_64
plasma5-workspace-branding-openSUSE-15.0~git20181114T190445~21cb8a6-lp150.337.1.noarch
plasma5-workspace-lang-5.14.3-lp150.430.1.noarch
plasma5-workspace-libs-5.14.3-lp150.430.1.x86_64
plasma5-workspace-wallpapers-5.14.3-lp150.149.1.noarch


STEPS TO REPRODUCE
1. Start konsole
2. Type "mc" to launch Midnight Commander
3. Observe borders in MC interface

OBSERVED RESULT
Borders are not drawn in clear solid lines

EXPECTED RESULT
Borders are drawn in clear solid lines

See attached screenshots for expected and new results.


SOFTWARE/OS VERSIONS
Windows: 
MacOS: 
Linux/KDE Plasma: 5.14.3
(available in About System)
KDE Plasma Version: 5.14.3
KDE Frameworks Version:  5.52.0
Qt Version:  5.11.2 

ADDITIONAL INFORMATION
Comment 1 Vadym Krevs 2018-11-27 11:16:32 UTC
Created attachment 116532 [details]
Current rendering of borders in mc in konsole
Comment 2 Vadym Krevs 2018-11-27 11:17:04 UTC
If I start xterm and run mc inside xterm, then borders are rendered in nice straight lines as before.
Comment 3 Vadym Krevs 2018-11-27 11:20:08 UTC
Same for gnome-terminal - run mc inside gnome-terminal, borders are rendered in nice straight lines as before.
Comment 4 Wolfgang Bauer 2018-11-28 13:00:21 UTC
I can reproduce this here (similar system).

Enabling the option "Use line characters contained in font" in the profile settings ("Appearance") fixes it for me.
Comment 5 Wolfgang Bauer 2018-11-28 13:34:07 UTC
PS: it's caused by https://cgit.kde.org/konsole.git/commit/?id=ed5fa1f855a05ba82fe4f2f6d3ead803aa5eefdb (fix for bug 397985).

Reverting that commit fixes it with "Use line characters contained in font" off, but that causes rounded corners look ugly again of course... :-/
Comment 6 Vadym Krevs 2018-11-28 16:29:44 UTC
Enabling the option "Use line characters contained in font" in the profile settings ("Appearance") fixes only horizontal border lines, vertical border lines still have gaps in them. 

So, IMO, this is not a proper fix.
Comment 7 Wolfgang Bauer 2018-11-28 17:57:21 UTC
(In reply to Vadym Krevs from comment #6)
> Enabling the option "Use line characters contained in font" in the profile
> settings ("Appearance") fixes only horizontal border lines, vertical border
> lines still have gaps in them. 
> 
> So, IMO, this is not a proper fix.

I didn't say it's a proper fix (maybe an acceptable workaround though), but I thought it should help to find where the problem lies. ;-)

If there are gaps in vertical border lines, that's a different problem IMHO, and maybe one of the reasons why konsole actually draws those lines itself by default instead of using the font's characters.

Btw, I don't see those gaps here, but that may have various reasons. (e.g. the font used or its size, screen scaling, ...)
Comment 8 Vadym Krevs 2018-11-29 09:21:16 UTC
I use Ubuntu Mono, size 12 in Konsole. Also, reverting the commit mentioned in comment 5 does restore border lines to expected appearance.
Comment 9 Martin Sandsmark 2018-12-02 04:49:06 UTC
fixed with https://phabricator.kde.org/D16947

and https://phabricator.kde.org/D17294 should make it look even better (well, not the borders).
Comment 10 Kurt Hindenburg 2018-12-06 15:27:09 UTC
Git commit 14b3c8be2c15ed9711b1308b4a991de4aad5802d by Kurt Hindenburg, on behalf of Martin T. H. Sandsmark.
Committed on 06/12/2018 at 15:26.
Pushed by hindenburg into branch 'master'.

fix drawing box chars, avoid storing and saving state all the time

Summary:
to get the box chars to be drawn correctly we need to turn on high
quality antialiasing in qpainter. in addition only turn it on if
antialiasing is enabled.

lastly qpainter.save()/restore() is called very often, so try to avoid
that if it isn't necessary.

Test Plan:
`cat tests/boxes.txt`

old:

{F6428268}

new:

{F6450304}

Reviewers: #konsole, hindenburg

Reviewed By: #konsole, hindenburg

Subscribers: wbauer, konsole-devel, #konsole

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D16947

M  +20   -25   src/TerminalDisplay.cpp

https://commits.kde.org/konsole/14b3c8be2c15ed9711b1308b4a991de4aad5802d
Comment 11 Vadym Krevs 2018-12-09 18:52:36 UTC
Installed updated konsole packages from openSuse's OBS and can confirm the issue is fixed.
Comment 12 Christoph Feck 2018-12-14 20:54:34 UTC
*** Bug 402135 has been marked as a duplicate of this bug. ***
Comment 13 Christoph Feck 2018-12-17 23:05:55 UTC
*** Bug 402230 has been marked as a duplicate of this bug. ***
Comment 14 Kurt Hindenburg 2018-12-21 16:11:41 UTC
Git commit 807ac77061604c2ac7cf84b0a0b29dd949a6c634 by Kurt Hindenburg, on behalf of Martin T. H. Sandsmark.
Committed on 21/12/2018 at 16:05.
Pushed by hindenburg into branch 'Applications/18.12'.

fix drawing box chars, avoid storing and saving state all the time

Summary:
to get the box chars to be drawn correctly we need to turn on high
quality antialiasing in qpainter. in addition only turn it on if
antialiasing is enabled.

lastly qpainter.save()/restore() is called very often, so try to avoid
that if it isn't necessary.

Test Plan:
`cat tests/boxes.txt`

old:

{F6428268}

new:

{F6450304}

Reviewers: #konsole, hindenburg

Reviewed By: #konsole, hindenburg

Subscribers: wbauer, konsole-devel, #konsole

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D16947

(cherry picked from commit 14b3c8be2c15ed9711b1308b4a991de4aad5802d)

M  +20   -25   src/TerminalDisplay.cpp

https://commits.kde.org/konsole/807ac77061604c2ac7cf84b0a0b29dd949a6c634
Comment 15 Fabian Vogt 2019-01-21 08:11:14 UTC
Created attachment 117582 [details]
Alsamixer in konsole master

It looks like the fix is incomplete - it does not work for bold lines, like those visible in alsamixer.
Comment 16 Wolfgang Bauer 2019-01-21 10:25:25 UTC
(In reply to Fabian Vogt from comment #15)
> It looks like the fix is incomplete - it does not work for bold lines, like
> those visible in alsamixer.

That'S already reported as bug#402415 though.
Comment 17 Wolfgang Bauer 2019-01-21 12:29:46 UTC
(In reply to Wolfgang Bauer from comment #16)
> (In reply to Fabian Vogt from comment #15)
> > It looks like the fix is incomplete - it does not work for bold lines, like
> > those visible in alsamixer.
> 
> That'S already reported as bug#402415 though.

Closing as FIXED again therefore.