diff options
author | Wilfred Hughes <me@wilfred.me.uk> | 2023-07-08 16:58:06 -0700 |
---|---|---|
committer | Wilfred Hughes <me@wilfred.me.uk> | 2023-07-08 17:16:14 -0700 |
commit | 27f59c0b3ae979d4cea1a7e34e9bd1657cda4809 (patch) | |
tree | 4e8e4906a2794977401f04a46baa9c45ea350c85 | |
parent | 2607d17d730227e04b9ff89c2bc3a4bab0e91295 (diff) |
Don't treat - as a word constituent
This produces slightly better results with some string replacements.
-rw-r--r-- | CHANGELOG.md | 3 | ||||
-rw-r--r-- | sample_files/compare.expected | 6 | ||||
-rw-r--r-- | src/parse/syntax.rs | 2 |
3 files changed, 6 insertions, 5 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index f5c4908023..bbc101a2be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,8 @@ changed, but on average the results are better. ### Display -Improved word highlighting in comments when they contain numbers. +Improved word highlighting in comments when they contain numbers or +hyphens. ### Internals diff --git a/sample_files/compare.expected b/sample_files/compare.expected index 262b11f00d..566680855f 100644 --- a/sample_files/compare.expected +++ b/sample_files/compare.expected @@ -29,7 +29,7 @@ sample_files/comma_before.js sample_files/comma_after.js e615c73ff860651f7749dc13cb3f110f - sample_files/comments_before.rs sample_files/comments_after.rs -9af41b8c280d4ce94a19023f652e46fb - +d5f54a0acc3177939f2720ae5b2679d6 - sample_files/context_before.rs sample_files/context_after.rs eac81f7ca15eff973498a4d8b050ec34 - @@ -65,7 +65,7 @@ sample_files/hare_before.ha sample_files/hare_after.ha 2b3a9433cd692d9ffab872477312e3b8 - sample_files/haskell_before.hs sample_files/haskell_after.hs -5a2c0c5d4a04f79e2f8f32299e6cd364 - +0cefa44fdf56edf504f50506bbcded4e - sample_files/hcl_before.hcl sample_files/hcl_after.hcl 24c6205befd0fd1b44f21dd039cafb48 - @@ -77,7 +77,7 @@ sample_files/helpful_before.el sample_files/helpful_after.el a0f2e0115ea94c46d3650ba89b486f09 - sample_files/html_before.html sample_files/html_after.html -3d10040707b655920988fae2e610c4be - +ed77c9d76eefdc82cf52e089d268ac6c - sample_files/html_simple_before.html sample_files/html_simple_after.html ce3bfa12bc21d0eb5528766e18387e86 - diff --git a/src/parse/syntax.rs b/src/parse/syntax.rs index da5927e1b5..73e3d3e16b 100644 --- a/src/parse/syntax.rs +++ b/src/parse/syntax.rs @@ -661,7 +661,7 @@ pub fn split_words_and_numbers(s: &str) -> Vec<&str> { for (idx, c) in s.char_indices() { match word_start { Some((start, start_c)) => { - if c.is_alphanumeric() || c == '-' || c == '_' { + if c.is_alphanumeric() || c == '_' { // Word character, add to the current word if it's // not a number. if c.is_ascii_digit() == start_c.is_ascii_digit() { |