258 // |
258 // |
259 int Interface::render_colorline (int y, int x0, int width, const ColoredLine& line, bool allowWrap) |
259 int Interface::render_colorline (int y, int x0, int width, const ColoredLine& line, bool allowWrap) |
260 { |
260 { |
261 int x = x0; |
261 int x = x0; |
262 |
262 |
263 for (int i = 0; i < line.length(); ++i) |
263 for (int i = 0; i < line.data().size(); ++i) |
264 { |
264 { |
265 int byte = line.data()[i]; |
265 int byte = line.data()[i]; |
266 |
266 |
267 if (x == x0 + width) |
267 if (x == x0 + width) |
268 { |
268 { |
271 |
271 |
272 x = x0; |
272 x = x0; |
273 ++y; |
273 ++y; |
274 } |
274 } |
275 |
275 |
276 if (isprint (byte)) |
276 if (byte < 256 && isprint (byte)) |
277 { |
277 { |
278 mvaddch (y, x, char (byte)); |
278 mvaddch (y, x, char (byte)); |
279 ++x; |
279 ++x; |
280 } |
280 } |
281 else switch (byte) |
281 else switch (byte) |
282 { |
282 { |
283 case RLINE_ON_BLACK: |
|
284 case RLINE_ON_RED: |
|
285 case RLINE_ON_GREEN: |
|
286 case RLINE_ON_YELLOW: |
|
287 case RLINE_ON_BLUE: |
|
288 case RLINE_ON_MAGENTA: |
|
289 case RLINE_ON_CYAN: |
|
290 case RLINE_ON_WHITE: |
|
291 attron (color_pair (Color (byte - RLINE_ON_BLACK), DEFAULT)); |
|
292 break; |
|
293 |
|
294 case RLINE_OFF_BLACK: |
|
295 case RLINE_OFF_RED: |
|
296 case RLINE_OFF_GREEN: |
|
297 case RLINE_OFF_YELLOW: |
|
298 case RLINE_OFF_BLUE: |
|
299 case RLINE_OFF_MAGENTA: |
|
300 case RLINE_OFF_CYAN: |
|
301 case RLINE_OFF_WHITE: |
|
302 attroff (color_pair (Color (byte - RLINE_OFF_BLACK), DEFAULT)); |
|
303 break; |
|
304 |
|
305 case RLINE_ON_BOLD: |
283 case RLINE_ON_BOLD: |
306 attron (A_BOLD); |
284 attron (A_BOLD); |
307 break; |
285 break; |
308 |
286 |
309 case RLINE_OFF_BOLD: |
287 case RLINE_OFF_BOLD: |
310 attroff (A_BOLD); |
288 attroff (A_BOLD); |
|
289 break; |
|
290 |
|
291 default: |
|
292 if (byte < 256) |
|
293 break; |
|
294 |
|
295 (byte < RLINE_OFF_COLOR ? attron : attroff) (color_pair (Color ((byte - RLINE_ON_COLOR) & 7), DEFAULT)); |
311 break; |
296 break; |
312 } |
297 } |
313 } |
298 } |
314 |
299 |
315 return y + 1; |
300 return y + 1; |