1 #ifndef REPLXX_UTIL_HXX_INCLUDED 2 #define REPLXX_UTIL_HXX_INCLUDED 1 3 4 #include "replxx.hxx" 5 6 namespace replxx { 7 is_control_code(char32_t testChar)8inline bool is_control_code(char32_t testChar) { 9 return (testChar < ' ') || // C0 controls 10 (testChar >= 0x7F && testChar <= 0x9F); // DEL and C1 controls 11 } 12 control_to_human(char32_t key)13inline char32_t control_to_human( char32_t key ) { 14 return ( key < 27 ? ( key + 0x40 ) : ( key + 0x18 ) ); 15 } 16 17 void recompute_character_widths( char32_t const* text, char* widths, int charCount ); 18 void calculate_screen_position( int x, int y, int screenColumns, int charCount, int& xOut, int& yOut ); 19 int calculate_displayed_length( char32_t const* buf32, int size ); 20 char const* ansi_color( Replxx::Color ); 21 std::string now_ms_str( void ); 22 23 } 24 25 #endif 26 27