From 6a0b450f55675c76d67bfb026caa2df4b601153b Mon Sep 17 00:00:00 2001 From: Skyler Hawthorne Date: Thu, 20 Oct 2022 20:22:20 -0400 Subject: Fix multi byte auto pairs (#4024) * Fix test::print for Unicode The print function was not generating correct translations when the input has Unicode (non-ASCII) in it. This is due to its use of String::len, which gives the length in bytes, not chars. * Fix multi-code point auto pairs The current code for auto pairs is counting offsets by summing the length of the open and closing chars with char::len_utf8. Unfortunately, this gives back bytes, and the offset needs to be in chars. Additionally, it was discovered that there was a preexisting bug where the selection was not computed correctly in the case that the cursor was: 1. a single grapheme in width 2. this grapheme was more than one char 3. the direction of the cursor is backwards 4. a secondary range In this case, the offset was not being added into the anchor. This was fixed. * migrate auto pairs tests to integration * review comments--- helix-view/src/clipboard.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'helix-view') diff --git a/helix-view/src/clipboard.rs b/helix-view/src/clipboard.rs index f3d94734..ad6f621a 100644 --- a/helix-view/src/clipboard.rs +++ b/helix-view/src/clipboard.rs @@ -17,7 +17,7 @@ pub trait ClipboardProvider: std::fmt::Debug { #[cfg(not(windows))] macro_rules! command_provider { (paste => $get_prg:literal $( , $get_arg:literal )* ; copy => $set_prg:literal $( , $set_arg:literal )* ; ) => {{ - log::info!( + log::debug!( "Using {} to interact with the system clipboard", if $set_prg != $get_prg { format!("{}+{}", $set_prg, $get_prg)} else { $set_prg.to_string() } ); -- cgit v1.2.3-70-g09d2