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

Does kmscon has any bug in Esc[nE and Esc[nF? #142

Open
viruscamp opened this issue Jan 23, 2022 · 0 comments
Open

Does kmscon has any bug in Esc[nE and Esc[nF? #142

viruscamp opened this issue Jan 23, 2022 · 0 comments

Comments

@viruscamp
Copy link

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;
}
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

No branches or pull requests

1 participant