diff options
author | Christian Duerr <chrisduerr@users.noreply.github.com> | 2019-03-23 11:56:46 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-23 11:56:46 +0000 |
commit | d8272662db4a4dc1ef58b8379dc88162066a3241 (patch) | |
tree | 8a2fbbac88d867252fd825e3959f470abb89517f /src/term/mod.rs | |
parent | d29c30900743f3e7f864f7951edf34c7423accd8 (diff) | |
download | alacritty-d8272662db4a4dc1ef58b8379dc88162066a3241.tar.gz alacritty-d8272662db4a4dc1ef58b8379dc88162066a3241.zip |
Fix URL parsing with double-width characters
Since double-width characters are followed by an empty cell containing
only the `WIDE_CELL_SPACER` flag, the URL parser would stop once
encountering the cell after a double-width character.
By skipping cells that contain the `WIDE_CELL_SPACER` flag and
incrementing the URL length by unicode width of the character instead of
cell count, this can be resolved for both URL launching and URL
highlighting.
Fixes #2158.
Diffstat (limited to 'src/term/mod.rs')
-rw-r--r-- | src/term/mod.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/term/mod.rs b/src/term/mod.rs index a99098bd..ac5a9a5f 100644 --- a/src/term/mod.rs +++ b/src/term/mod.rs @@ -120,14 +120,14 @@ impl Search for Term { let mut url_parser = UrlParser::new(); while let Some(cell) = iterb.prev() { if (iterb.cur().col == last_col && !cell.flags.contains(cell::Flags::WRAPLINE)) - || url_parser.advance_left(cell.c) + || url_parser.advance_left(cell) { break; } } while let Some(cell) = iterf.next() { - if url_parser.advance_right(cell.c) + if url_parser.advance_right(cell) || (iterf.cur().col == last_col && !cell.flags.contains(cell::Flags::WRAPLINE)) { break; |