From 1a21165a48ebcc96fa622f600b00a5415ea60046 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Sun, 8 Jul 2012 01:15:00 -0400 Subject: [PATCH] simplify visual line mode selection --- termite.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/termite.c b/termite.c index 7146744..9b0b0c3 100644 --- a/termite.c +++ b/termite.c @@ -103,13 +103,11 @@ static void cursor_moved_cb(VteTerminal *vte, select_info *select) { select->begin_col, select->begin_row, 0, 0); } } else if (select->mode == SELECT_VISUAL_LINE) { - if (begin < end) { - vte_terminal_select_text(vte, 0, select->begin_row, - n_columns - 1, end_row, 0, 0); - } else { - vte_terminal_select_text(vte, 0, end_row, - n_columns - 1, select->begin_row, 0, 0); - } + vte_terminal_select_text(vte, 0, + MIN(select->begin_row, end_row), + n_columns - 1, + MAX(select->begin_row, end_row), + 0, 0); } else if (select->mode == SELECT_VISUAL_BLOCK) { vte_terminal_select_text(vte, MIN(select->begin_col, end_col),