Bug 471353 - Using ANSI codes to set the title has a delay of one title
Summary: Using ANSI codes to set the title has a delay of one title
Status: REPORTED
Alias: None
Product: konsole
Classification: Applications
Component: emulation (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-22 18:58 UTC by sergio.costas@canonical.com
Modified: 2023-06-22 19:13 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sergio.costas@canonical.com 2023-06-22 18:58:54 UTC
SUMMARY
***
When using ANSI codes to set the window title, there is a delay of one title. This is: setting once the title doesn't change it; setting it twice shows the first title, not the second; setting it three times shows the second title, not the third one.
***


STEPS TO REPRODUCE
1. Enable showing the terminal title in the window bar (in the settings)
2. Run in Konsole: echo -en "\033]2;New terminal title 1\007"
3. Run in Konsole: echo -en "\033]2;New terminal title 2\007"

OBSERVED RESULT
After running the first echo command, the window title won't change. After running the second command, the title from the first command ("New terminal title 1") will be shown in the window title.

EXPECTED RESULT
After running the first echo command, the window title should change to "New terminal title 1". After running the second echo command, the window title should change to "New terminal title 2".

SOFTWARE/OS VERSIONS
Ubuntu Linux; Konsole 4:22.12.3-0ubuntu1; libqt=5.15.8
ADDITIONAL INFORMATION
Comment 1 sergio.costas@canonical.com 2023-06-22 19:06:50 UTC
Running this script also shows the bug:

    #!/bin/sh

    echo -n "\033]2;New terminal title1\007"
    sleep 2
    echo -n "\033]2;New terminal title2\007"
    sleep 2
    echo -n "\033]2;New terminal title3\007"
    sleep 2

When launching it, the title changes to "New terminal title1", and after six seconds, it changes to "New terminal title3" when it ends and returns to the command line. The "New terminal title2" title is never shown.
Comment 2 sergio.costas@canonical.com 2023-06-22 19:13:56 UTC
This python3 program also reproduces the problem:

    #!/usr/bin/env python3

    import time

    print("\033]2;Window title 1\007", flush=True, end="")
    time.sleep(2)
    print("\033]2;Window title 2\007", flush=True, end="")
    time.sleep(2)
    print("\033]2;Window title 3\007", flush=True, end="")
    time.sleep(2)