[arch-general] pacman 6 current/total not displayed on TDE - what does old konsole lack?
All, As mentioned in an earlier thread, the new pacman current/total update scheme causes the old KDE3/TDE konsole output to look jittery instead of updating the multi-line progress bar. I'm trying to track down why so we can patch TDE konsole to fix the problem, but I'm having a difficult time chasing down just exactly what is being written that is causing the problem. I've chased through callback.c: static void dload_progress_event(const char *filename, alpm_download_event_progress_t *data) Where the update is done, https://gitlab.archlinux.org/pacman/pacman/-/blob/master/src/pacman/callback... Either with console_cursor_goto_bar(index) for the current file or console_cursor_move_end() for the total and those are simple ANSI escapes from util.c: /* Moves console cursor `lines` up */ void console_cursor_move_up(unsigned int lines) { printf("\x1B[%dF", lines); } /* Moves console cursor `lines` down */ void console_cursor_move_down(unsigned int lines) { printf("\x1B[%dE", lines); } /* Erases line from the current cursor position till the end of the line */ void console_erase_line(void) { printf("\x1B[K"); } What is it that the new pacman is doing with the multi-line progress bar TDE/konsole lacks? -- David C. Rankin, J.D.,P.E.
Am 12.12.21 um 07:14 schrieb David C. Rankin via arch-general:
[...]
What is it that the new pacman is doing with the multi-line progress bar TDE/konsole lacks?
Hello, You are missing support for two of those escape codes. Upstream Konsole has them since last year: https://git.trinitydesktop.org/cgit/tdebase/tree/konsole/konsole/TEmuVt102.c... https://git.trinitydesktop.org/cgit/tdebase/tree/konsole/doc/More/ansix364.t... https://invent.kde.org/utilities/konsole/-/merge_requests/116 -- Andreas B.
Hi David,
/* Moves console cursor `lines` up */ void console_cursor_move_up(unsigned int lines) { printf("\x1B[%dF", lines); }
It's a shame the code isn't using terminfo(5) so it's portable to different terminals, including older ones, and less misleading in its choice of function names and commentary. By sticking with terminfo's names we have a lingua franca. https://invisible-island.net/xterm/ctlseqs/ctlseqs.pdf is very useful when digging into this kind of thing. It's from Thomas Dickey, xterm(1)'s maintainer. Here's terminfo moving the cursor up N lines, as that function suggests it does. ‘cuu’ is in terminfo(5). $ seq 4; printf 5; tput cuu 3; printf here 1 2here$ 3 4 5 The tput is using Esc '[' N 'A', not 'F' which that function uses. $ tput cuu 3 | od -c 0000000 033 [ 3 A 0000004 ctlseqs describes this on page 8 as ‘Cursor Up Ps Times (default = 1) (CUU)’. console_cursor_move_up()'s 'F' is a few lines down in ctlseqs, described as ‘Cursor Preceding Line Ps Times (default = 1) (CPL)’. terminfo(5) doesn't have ‘cpl’. The ECMA 48 standard, https://www.ecma-international.org/wp-content/uploads/ECMA-48_5th_edition_ju..., does have CUU and CPL, logical pages 37 and 35 respectively, physical 51 and 49. It seems CPL does a CUU and then moves to the first column, as Carriage Return, CR, logical page 35, often does. Here's CUU, and then CPL using ECMA 48's definitions. $ printf '1\n2\n3\n4\n555\x1b[3Ahere' 1 2 here$ 3 4 555 $ printf '1\n2\n3\n4\n555\x1b[3Fhere' 1 here$ 3 4 555 I'm not saying this is the cause of your problems; I just picked on console_cursor_move_up() at random, but it shows the folly of not using terminfo in the time-honoured way and hard-coding escape sequences as if this were MS DOS. Hopefully, it's also provided some resources for you debug more where the problem lies. I suggest testing the sequences you find on your terminal. Also, script(1) may be useful to record what gets output to the terminal by the program which isn't working. -- Cheers, Ralph.
participants (3)
-
Andreas Bosch
-
David C. Rankin
-
Ralph Corderoy