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

Cursor position report should be 1-based #123

Open
xiaq opened this issue Jan 29, 2016 · 1 comment
Open

Cursor position report should be 1-based #123

xiaq opened this issue Jan 29, 2016 · 1 comment

Comments

@xiaq
Copy link

xiaq commented Jan 29, 2016

The following prints ^[[1;1R on xterm, the linux console, libvte-based terminals:

clear
echo '\033[6n'
read | cat -v

But it prints ^[[0;0R on kmscon.

@xiaq
Copy link
Author

xiaq commented Jan 29, 2016

This patch to libtsm should fix this issue:

diff --git a/src/tsm/tsm-vte.c b/src/tsm/tsm-vte.c
index ec8a936..d2d4776 100644
--- a/src/tsm/tsm-vte.c
+++ b/src/tsm/tsm-vte.c
@@ -1513,7 +1513,8 @@ static void csi_dsr(struct tsm_vte *vte)
    } else if (vte->csi_argv[0] == 6) {
        x = tsm_screen_get_cursor_x(vte->con);
        y = tsm_screen_get_cursor_y(vte->con);
-       len = snprintf(buf, sizeof(buf), "\e[%u;%uR", x, y);
+       /* CSI DSR uses 1-based coordinates */
+       len = snprintf(buf, sizeof(buf), "\e[%u;%uR", x+1, y+1);
        if (len >= sizeof(buf))
            vte_write(vte, "\e[0;0R", 6);
        else

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