From 2de03f82cfb30a7c16761787b5a70daa57d50586 Mon Sep 17 00:00:00 2001 From: cy384 Date: Sun, 21 Mar 2021 23:00:56 -0400 Subject: [PATCH] fix copying when selection spans lines --- ssheven-console.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ssheven-console.c b/ssheven-console.c index 3c5f6be..683a207 100644 --- a/ssheven-console.c +++ b/ssheven-console.c @@ -354,13 +354,12 @@ size_t get_selection(char** selection) //int end_row = MAX(con.select_start_y, con.select_end_y); //int end_col = MAX(con.select_start_x, con.select_end_x); - VTermPos pos = {.row = 0, .col = 0}; + VTermPos pos = {.row = start_row, .col = start_col-1}; ScreenCell* vtsc = NULL; for(int i = 0; i < len; i++) { - pos.col = (start_col + i) % con.size_x; - pos.row = (start_row + (i / con.size_x)); + next(&pos.col, &pos.row); vtsc = vterm_screen_unsafe_get_cell(con.vts, pos); output[i] = (char)vtsc->chars[0];