Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugs of Esc[nE and Esc[nF #78

Closed
viruscamp opened this issue Dec 11, 2023 · 3 comments · Fixed by Aetf/libtsm#39
Closed

Bugs of Esc[nE and Esc[nF #78

viruscamp opened this issue Dec 11, 2023 · 3 comments · Fixed by Aetf/libtsm#39

Comments

@viruscamp
Copy link

From dvdhrm#142

When I am using pacman , I found:
Error output in kmscon:

[]$ sudo pacman -Sy
:: Synchronizing package databases…
 core
 extra
 core is up to date extra is up to date[]$

Correct output in getty, xterm, qterminal, konsole, etc

[]$ sudo pacman -Sy
:: Synchronizing package databases...
 core is up to date
 extra is up to date
[]$ 

I wrote a sample code to simulate it, and got the same outputs:

#include <stdio.h>
#include <unistd.h>

// from pacman-6.0.1/src/pacman/util.c: 1835
/* 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");
}

int main()
{
    printf(":: Synchronizing package databases...\n");
    printf(" %s\n", "core");
    printf(" %s\n", "extra");
    sleep(1);
    
    console_cursor_move_up(2);
    printf(" %s is up to date", "core");
    console_erase_line();
    
    console_cursor_move_down(1);
    printf(" %s is up to date", "extra");
    console_erase_line();
    
    printf("\n");

    return 0;
}
@viruscamp
Copy link
Author

That's a shell script which do the same:

echo -e ":: Synchronizing package databases..."
echo -e "core"
echo -e "extra"

sleep 1
echo -ne "\E[2F"
echo -ne " core is up to date"
echo -ne "\E[K"

sleep 1
echo -ne "\E[1E"
echo -ne " extra is up to date"
echo -ne "\E[K"

echo

@viruscamp
Copy link
Author

I have tested in wlterm which also use libtsm as kmscon, and found the same bug.

So, it should be the bug of libtsm.

@viruscamp
Copy link
Author

According to https://www.man7.org/linux/man-pages/man4/console_codes.4.html , 'ECMA-48 CSI sequences' parts, the do_csi function in https://github.com/Aetf/libtsm/blob/check-null/src/tsm/tsm-vte.c#L1749C16-L1749C16 lacks

       E   CNL       Move cursor down the indicated # of rows, to column 1.
       F   CPL       Move cursor up the indicated # of rows, to column 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant