equal
deleted
inserted
replaced
78 std::wstringstream result; |
78 std::wstringstream result; |
79 |
79 |
80 result << convertor.from_bytes(color); |
80 result << convertor.from_bytes(color); |
81 |
81 |
82 for (auto & ch : value) { |
82 for (auto & ch : value) { |
|
83 // see computeWidth below |
83 switch (ch) { |
84 switch (ch) { |
84 case L'\n': result << colorizeReplacement(L"↲", color); |
85 case L'\n': result << colorizeReplacement(L"↲", color); |
85 break; |
86 break; |
86 case L'\r': result << colorizeReplacement(L"⏎", color); |
87 case L'\r': result << colorizeReplacement(L"⏎", color); |
87 break; |
88 break; |
102 * @param stringValue |
103 * @param stringValue |
103 * @return the width that would the string occupy on the display (particular characters might be wider than 1 column) |
104 * @return the width that would the string occupy on the display (particular characters might be wider than 1 column) |
104 */ |
105 */ |
105 integer_t computeWidth(const string_t& stringValue) { |
106 integer_t computeWidth(const string_t& stringValue) { |
106 integer_t width = 0; |
107 integer_t width = 0; |
107 for (wchar_t ch : stringValue) width += std::max(0, wcwidth(ch)); |
108 for (wchar_t ch : stringValue) { |
|
109 // see formatValue() above |
|
110 switch (ch) { |
|
111 case L'\n': |
|
112 case L'\r': |
|
113 case L'\t': |
|
114 case L' ': |
|
115 width += 1; |
|
116 break; |
|
117 default: |
|
118 width += std::max(0, wcwidth(ch)); |
|
119 } |
|
120 } |
108 return width; |
121 return width; |
109 } |
122 } |
110 |
123 |
111 void printHorizontalLine(const string_t &left, const string_t &middle, const string_t &right) { |
124 void printHorizontalLine(const string_t &left, const string_t &middle, const string_t &right) { |
112 const string_t bar = L"─"; |
125 const string_t bar = L"─"; |