Open sergio-costas opened 1 year ago
Merging #160 (04c2c41) into main (91c4b88) will increase coverage by
0.04%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## main #160 +/- ##
==========================================
+ Coverage 94.62% 94.66% +0.04%
==========================================
Files 7 7
Lines 1042 1050 +8
Branches 190 193 +3
==========================================
+ Hits 986 994 +8
Misses 53 53
Partials 3 3
Files Changed | Coverage Δ | |
---|---|---|
craft_cli/messages.py | 100.00% <100.00%> (ø) |
|
craft_cli/printer.py | 100.00% <100.00%> (ø) |
Ok, you can use https://github.com/snapcore/snapcraft/pull/4217 to test this.
@tigarmo I forgot to change this from draft to ready. Done.
Thanks. I'll try this out and give you feedback today
I did some experimenting and found a couple of problems:
1) The escape code to set the window title doesn't work on default Konsole. It does work on xterm. Which terminal are you using? I can get it to work on Konsole if I change the "Tab title format" option to %w
:
I wonder if there's a "more portable" way to do this.
2) The last set title persists after Snapcraft exits. See the end of this gif: we should clear that up, ideally restoring the original title but I don't know how feasible that is.
I'm using Terminus, which uses VTE.Terminal class inside. The codes that I use in the patch are the XTerm ones, yes... https://tldp.org/HOWTO/Xterm-Title-3.html
Can you test this?
it seems that it's the ANSI code for Konsole...
About preserving the title... yes, you are right. I didn't implement that because, in my case, it already does that due to a script that I have for GIT, but it should be preserved and restored. I'll try it.
I'll try changing the ANSI command from 2 (set the title) to 0 (set the title and the icon) just in case...
Sent a bug report to KDE about the Konsole problem: https://bugs.kde.org/show_bug.cgi?id=471353
@tigarmo Mmm... odd... in ubuntu there is this line in ~/.bashrc:
It forces the window title to the current folder every time the prompt appears... which makes sense, because not all programs restore the window title.
Fedora has a similar line:
Are you using a ubuntu-derived distro? Which value returns in your system echo $TERM
? (in my case, it returns xterm-256color
).
Because all this seems to point to the konsole bug that delays the title change.
@tigarmo This should be ready for merging. As commented, the konsole bug seems to be a problem in konsole itseld, that doesn't refresh the UI unless there is a change in the terminal itself. Also, it seems to be not possible to read the current title in the terminal (at least in a standard way), since it is set using ANSI commands. And since as soon as a key is pressed, the title is updated in konsole, I think that it's not a true problem.
Also, the linting bug seems to be a thing of setuptools_scm.
This patch allows to set the text in the title of a terminal window. The idea is to allow snapcraft to set in the title which step is currently doing.
This is a first proposal for https://github.com/canonical/craft-cli/issues/159
tox
?