summaryrefslogtreecommitdiffstats
path: root/contrib/replxx/src/util.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/replxx/src/util.hxx')
-rw-r--r--contrib/replxx/src/util.hxx21
1 files changed, 21 insertions, 0 deletions
diff --git a/contrib/replxx/src/util.hxx b/contrib/replxx/src/util.hxx
new file mode 100644
index 000000000..8afa0fa96
--- /dev/null
+++ b/contrib/replxx/src/util.hxx
@@ -0,0 +1,21 @@
+#ifndef REPLXX_UTIL_HXX_INCLUDED
+#define REPLXX_UTIL_HXX_INCLUDED 1
+
+#include "replxx.hxx"
+
+namespace replxx {
+
+inline bool is_control_code(char32_t testChar) {
+ return (testChar < ' ') || // C0 controls
+ (testChar >= 0x7F && testChar <= 0x9F); // DEL and C1 controls
+}
+
+void recompute_character_widths( char32_t const* text, char* widths, int charCount );
+void calculate_screen_position( int x, int y, int screenColumns, int charCount, int& xOut, int& yOut );
+int calculate_displayed_length( char32_t const* buf32, int size );
+char const* ansi_color( Replxx::Color );
+
+}
+
+#endif
+