Changeset 28a5ebd in mainline for kernel/generic/src/console/kconsole.c
- Timestamp:
- 2020-06-18T15:39:50Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ce52c333
- Parents:
- 4f663f3e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/console/kconsole.c
r4f663f3e r28a5ebd 86 86 LIST_INITIALIZE(cmd_list); /**< Command list. */ 87 87 88 static wchar_t history[KCONSOLE_HISTORY][MAX_CMDLINE] = { };88 static char32_t history[KCONSOLE_HISTORY][MAX_CMDLINE] = { }; 89 89 static size_t history_pos = 0; 90 90 … … 156 156 157 157 /** Print count times a character */ 158 _NO_TRACE static void print_cc( wchar_t ch, size_t count)158 _NO_TRACE static void print_cc(char32_t ch, size_t count) 159 159 { 160 160 size_t i; 161 161 for (i = 0; i < count; i++) 162 put wchar(ch);162 putuchar(ch); 163 163 } 164 164 … … 290 290 } 291 291 292 _NO_TRACE static cmd_info_t *parse_cmd(const wchar_t *cmdline)292 _NO_TRACE static cmd_info_t *parse_cmd(const char32_t *cmdline) 293 293 { 294 294 size_t start = 0; … … 331 331 } 332 332 333 _NO_TRACE static wchar_t *clever_readline(const char *prompt, indev_t *indev,333 _NO_TRACE static char32_t *clever_readline(const char *prompt, indev_t *indev, 334 334 char *tmp) 335 335 { … … 337 337 338 338 size_t position = 0; 339 wchar_t *current = history[history_pos];339 char32_t *current = history[history_pos]; 340 340 current[0] = 0; 341 341 342 342 while (true) { 343 wchar_t ch = indev_pop_character(indev);343 char32_t ch = indev_pop_character(indev); 344 344 345 345 if (ch == '\n') { 346 346 /* Enter */ 347 put wchar(ch);347 putuchar(ch); 348 348 break; 349 349 } … … 356 356 if (wstr_remove(current, position - 1)) { 357 357 position--; 358 put wchar('\b');358 putuchar('\b'); 359 359 printf("%ls ", current + position); 360 360 print_cc('\b', wstr_length(current) - position + 1); … … 369 369 for (; (current[position] != 0) && (!isspace(current[position])); 370 370 position++) 371 put wchar(current[position]);371 putuchar(current[position]); 372 372 373 373 /* … … 464 464 /* Left */ 465 465 if (position > 0) { 466 put wchar('\b');466 putuchar('\b'); 467 467 position--; 468 468 } … … 473 473 /* Right */ 474 474 if (position < wstr_length(current)) { 475 put wchar(current[position]);475 putuchar(current[position]); 476 476 position++; 477 477 } … … 646 646 size_t offset = *start; 647 647 size_t prev = *start; 648 wchar_t ch;648 char32_t ch; 649 649 650 650 while ((ch = str_decode(cmdline, &offset, size)) != 0) { … … 825 825 826 826 while (true) { 827 wchar_t *tmp = clever_readline((char *) prompt, stdin, buffer);827 char32_t *tmp = clever_readline((char *) prompt, stdin, buffer); 828 828 size_t len = wstr_length(tmp); 829 829 if (!len)
Note:
See TracChangeset
for help on using the changeset viewer.