Bug 386643

Summary: Profile changing escape sequence resets font size changed with a keyboard shortcut
Product: [Applications] konsole Reporter: Bartosz Marcinkowski <bm371613>
Component: generalAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED FIXED    
Severity: normal CC: a.samirh78, bm371613, egmont, gerhard.gappmeier, simonandric5
Priority: NOR    
Version: master   
Target Milestone: ---   
Platform: Manjaro   
OS: Linux   
Latest Commit: Version Fixed In: 18.04
Sentry Crash Report:

Description Bartosz Marcinkowski 2017-11-08 12:10:23 UTC
If you increase font size with a keyboard shortcut and then execute 

    echo -en '\e]50;CursorShape=1\x7'

the font goes back to the original size.
Comment 1 Bartosz Marcinkowski 2017-11-08 12:12:03 UTC
I looked into source code, and the problem seems to be that escape sequences modify font in one place(profile), but the keyboard shortcut modifies it in another object (TerminalDisplay). If you change the profile object with an escape sequence, it will pick the unchanged font in profile and overwrite the changed font in TerminalDisplay. A simple solution would be to make the shortcuts modify font in profile, as it happens if you modify font size with an escape sequence. Would that be ok?
Comment 2 Egmont Koblinger 2017-11-08 13:20:49 UTC
(In reply to Bartosz Marcinkowski from comment #1)

> A simple solution would be to make the
> shortcuts modify font in profile, as it happens if you modify font size with
> an escape sequence. Would that be ok?

It sounds to me that a one-off Ctrl+Plus would permanently change the profile settings, and subsequent windows will all open at the new, increased size? I wouldn't be in favor of this idea.

What is done in VTE is: there's a per-profile font, and a per-terminal zoom factor. The actual font to use is always derived from this two.
Comment 3 Egmont Koblinger 2017-11-08 13:22:25 UTC
(In reply to Bartosz Marcinkowski from comment #1)

> as it happens if you modify font size with
> an escape sequence. Would that be ok?

Hmmm, so an escape sequence emitted in one profile effects all other terminal windows that use the same profile? Doesn't sound good either. Or I fundamentally misunderstand something.
Comment 4 Bartosz Marcinkowski 2017-11-08 14:03:16 UTC
> Hmmm, so an escape sequence emitted in one profile effects all other
> terminal windows that use the same profile? Doesn't sound good either. Or I
> fundamentally misunderstand something.

If you split view to have two views of the same session and type

    echo -en '\e]50;CursorShape=1\x7'

both are changed - so the answer is yes if I understand it right. That's why I figured it would be acceptable for shortcuts to work the same way.
Comment 5 Egmont Koblinger 2017-11-08 14:06:51 UTC
So by "profile" you mean something that's common to all panes of the same terminal during a split (something VTE doesn't have), and _not_ automatically altering the values the user can set under Edit Current Profile. In that case

> Or I fundamentally misunderstand something.

I indeed did. Thanks for the clarification and sorry for the noise!
Comment 6 Bartosz Marcinkowski 2017-11-14 09:31:44 UTC
Another effect of the same mechanism: if you change font size with a shortcut and then, in the profile editing window, hover over another colour scheme, the font size change is lost.
Comment 7 Kurt Hindenburg 2018-02-14 03:25:57 UTC
*** Bug 389459 has been marked as a duplicate of this bug. ***
Comment 8 Ahmad Samir 2018-02-19 05:56:13 UTC
https://phabricator.kde.org/D10650
Comment 9 Ahmad Samir 2018-02-27 10:14:10 UTC
(In reply to Bartosz Marcinkowski from comment #6)
> Another effect of the same mechanism: if you change font size with a
> shortcut and then, in the profile editing window, hover over another colour
> scheme, the font size change is lost.

IMHO this ^ is a different issue; the patch in the review request in phabricator only addresses the original issue in this report, i.e. preserving the zoom font sizes after changing profile properties with an escape sequence (or via the command line option '-p').
Comment 10 Kurt Hindenburg 2018-02-28 04:24:06 UTC
Git commit 18014c75f2c3ecb53f77b27b7b05037584d3872e by Kurt Hindenburg, on behalf of Ahmad Samir.
Committed on 28/02/2018 at 04:23.
Pushed by hindenburg into branch 'master'.

Restore zoom fonts after changing profile with ESC sequences

Summary:
When a profile property is changed via the command line or an ESC sequence
a new temp profile is created and applied, this resets the zoom values in
the views connected to the session.
Save zoom font sizes and restore them after the new profile is applied.
FIXED-IN: 18.04

Reviewers: hindenburg

Reviewed By: hindenburg

Subscribers: ngraham, #konsole

Tags: #konsole

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

M  +20   -0    src/SessionManager.cpp

https://commits.kde.org/konsole/18014c75f2c3ecb53f77b27b7b05037584d3872e