summaryrefslogtreecommitdiffstats
path: root/src/test_helpers/shared/replace_invisibles.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test_helpers/shared/replace_invisibles.rs')
-rw-r--r--src/test_helpers/shared/replace_invisibles.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/test_helpers/shared/replace_invisibles.rs b/src/test_helpers/shared/replace_invisibles.rs
new file mode 100644
index 0000000..ad33cb3
--- /dev/null
+++ b/src/test_helpers/shared/replace_invisibles.rs
@@ -0,0 +1,16 @@
+use bitflags::bitflags;
+
+use crate::{
+ display::DisplayColor,
+ view::{LineSegment, ViewData, ViewLine},
+};
+
+const VISIBLE_SPACE_REPLACEMENT: &str = "\u{b7}"; // "·"
+const VISIBLE_TAB_REPLACEMENT: &str = " \u{2192}"; // " →"
+
+/// Replace invisible characters with visible counterparts
+#[must_use]
+pub(crate) fn replace_invisibles(line: &str) -> String {
+ line.replace(' ', VISIBLE_SPACE_REPLACEMENT)
+ .replace('\t', VISIBLE_TAB_REPLACEMENT)
+}