We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0ed815f commit 5318e89Copy full SHA for 5318e89
crates/ide/src/markdown_remove.rs
@@ -25,7 +25,10 @@ pub(crate) fn remove_markdown(markdown: &str) -> String {
25
}
26
27
28
- if let Some(p) = out.rfind(|c| c != '\n') {
+ if let Some(mut p) = out.rfind(|c| c != '\n') {
29
+ while !out.is_char_boundary(p + 1) {
30
+ p += 1;
31
+ }
32
out.drain(p + 1..);
33
34
@@ -153,4 +156,10 @@ book] or the [Reference].
153
156
154
157
For more information on the various types of functions and how they're used, consult the Rust book or the Reference."#]].assert_eq(&res);
155
158
159
+
160
+ #[test]
161
+ fn on_char_boundary() {
162
+ expect!["a┘"].assert_eq(&remove_markdown("```text\na┘\n```"));
163
+ expect!["وقار"].assert_eq(&remove_markdown("```\nوقار\n```\n"));
164
165
0 commit comments