From b8acdf592f28c1083d1d37fa29a75a19a9564727 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sun, 9 May 2021 08:17:56 -0700 Subject: [PATCH] fix panic when double-click-selection drags across line boundary closes: https://github.com/wez/wezterm/issues/762 --- docs/changelog.md | 1 + wezterm-gui/src/selection.rs | 8 ++------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index f1c331fdd..a5636331f 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -15,6 +15,7 @@ As features stabilize some brief notes about them will accumulate here. * x11: support for [VoidSymbol](config/keys.md#voidsymbol) in key assignments. Thanks to [@digitallyserviced](https://github.com/digitallyserviced)! [#759](https://github.com/wez/wezterm/pull/759) * Fixed: UTF8-encoded-C1 control codes were not always recognized as control codes, and could result in a panic when later attempting to update the line. [#768](https://github.com/wez/wezterm/issues/768) * Fixed: `wezterm cli split-pane` didn't use the current working dir of the source pane. [#766](https://github.com/wez/wezterm/issues/766) +* Fixed: double-click-drag selection could panic when crossing line boundaries [#762](https://github.com/wez/wezterm/issues/762) ### 20210502-154244-3f7122cb diff --git a/wezterm-gui/src/selection.rs b/wezterm-gui/src/selection.rs index e40bdebf1..e154e50ac 100644 --- a/wezterm-gui/src/selection.rs +++ b/wezterm-gui/src/selection.rs @@ -144,7 +144,8 @@ impl SelectionRange { .logical .compute_double_click_range(start_idx, is_double_click_word) { - DoubleClickRange::Range(click_range) => { + DoubleClickRange::RangeWithWrap(click_range) + | DoubleClickRange::Range(click_range) => { let (start_y, start_x) = logical.logical_x_to_physical_coord(click_range.start); let (end_y, end_x) = logical.logical_x_to_physical_coord(click_range.end - 1); Self { @@ -155,11 +156,6 @@ impl SelectionRange { end: SelectionCoordinate { x: end_x, y: end_y }, } } - DoubleClickRange::RangeWithWrap(_) => { - // We're using logical lines to match against, so we should never get - // a RangeWithWrap result here - unreachable!() - } }; }