fix copying when selection spans lines

This commit is contained in:
cy384 2021-03-21 23:00:56 -04:00
parent c80e888697
commit 2de03f82cf

View file

@ -354,13 +354,12 @@ size_t get_selection(char** selection)
//int end_row = MAX(con.select_start_y, con.select_end_y); //int end_row = MAX(con.select_start_y, con.select_end_y);
//int end_col = MAX(con.select_start_x, con.select_end_x); //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; ScreenCell* vtsc = NULL;
for(int i = 0; i < len; i++) for(int i = 0; i < len; i++)
{ {
pos.col = (start_col + i) % con.size_x; next(&pos.col, &pos.row);
pos.row = (start_row + (i / con.size_x));
vtsc = vterm_screen_unsafe_get_cell(con.vts, pos); vtsc = vterm_screen_unsafe_get_cell(con.vts, pos);
output[i] = (char)vtsc->chars[0]; output[i] = (char)vtsc->chars[0];