Changeset 08e103d4 in mainline for kernel/generic/src/console/kconsole.c
- Timestamp:
- 2019-02-05T18:26:05Z (6 years ago)
- Children:
- 1d2f85e
- Parents:
- d066259
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2019-02-05 16:16:55)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2019-02-05 18:26:05)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/console/kconsole.c
rd066259 r08e103d4 167 167 { 168 168 link_t **startpos = (link_t **) ctx; 169 size_t namelen = str_ length(name);169 size_t namelen = str_code_points(name); 170 170 171 171 spinlock_lock(&cmd_lock); … … 178 178 179 179 const char *curname = hlp->name; 180 if (str_ length(curname) < namelen)180 if (str_code_points(curname) < namelen) 181 181 continue; 182 182 … … 187 187 188 188 spinlock_unlock(&cmd_lock); 189 return (curname + str_l size(curname, namelen));189 return (curname + str_lbytes(curname, namelen)); 190 190 } 191 191 } … … 233 233 234 234 while ((hint = hints_enum(name, NULL, &pos))) { 235 if ((found == 0) || (str_ length(hint) > str_length(output)))235 if ((found == 0) || (str_code_points(hint) > str_code_points(output))) 236 236 str_cpy(output, MAX_CMDLINE, hint); 237 237 … … 249 249 } 250 250 251 if ((found > 1) && (str_ length(output) != 0)) {251 if ((found > 1) && (str_code_points(output) != 0)) { 252 252 printf("\n"); 253 253 pos = NULL; … … 358 358 putwchar('\b'); 359 359 printf("%ls ", current + position); 360 print_cc('\b', wstr_ length(current) - position + 1);360 print_cc('\b', wstr_code_points(current) - position + 1); 361 361 continue; 362 362 } … … 440 440 printf("%s> ", prompt); 441 441 printf("%ls", current); 442 position += str_ length(tmp);443 print_cc('\b', wstr_ length(current) - position);442 position += str_code_points(tmp); 443 print_cc('\b', wstr_code_points(current) - position); 444 444 continue; 445 445 } … … 448 448 449 449 printf("%ls", current + position); 450 position += str_ length(tmp);451 print_cc('\b', wstr_ length(current) - position);452 453 if (position == wstr_ length(current)) {450 position += str_code_points(tmp); 451 print_cc('\b', wstr_code_points(current) - position); 452 453 if (position == wstr_code_points(current)) { 454 454 /* Insert a space after the last completed argument */ 455 455 if (wstr_linsert(current, ' ', position, MAX_CMDLINE)) { … … 472 472 if (ch == U_RIGHT_ARROW) { 473 473 /* Right */ 474 if (position < wstr_ length(current)) {474 if (position < wstr_code_points(current)) { 475 475 putwchar(current[position]); 476 476 position++; … … 482 482 /* Up, down */ 483 483 print_cc('\b', position); 484 print_cc(' ', wstr_ length(current));485 print_cc('\b', wstr_ length(current));484 print_cc(' ', wstr_code_points(current)); 485 print_cc('\b', wstr_code_points(current)); 486 486 487 487 if (ch == U_UP_ARROW) { … … 498 498 current = history[history_pos]; 499 499 printf("%ls", current); 500 position = wstr_ length(current);500 position = wstr_code_points(current); 501 501 continue; 502 502 } … … 512 512 /* End */ 513 513 printf("%ls", current + position); 514 position = wstr_ length(current);514 position = wstr_code_points(current); 515 515 continue; 516 516 } … … 518 518 if (ch == U_DELETE) { 519 519 /* Delete */ 520 if (position == wstr_ length(current))520 if (position == wstr_code_points(current)) 521 521 continue; 522 522 523 523 if (wstr_remove(current, position)) { 524 524 printf("%ls ", current + position); 525 print_cc('\b', wstr_ length(current) - position + 1);525 print_cc('\b', wstr_code_points(current) - position + 1); 526 526 } 527 527 continue; … … 531 531 printf("%ls", current + position); 532 532 position++; 533 print_cc('\b', wstr_ length(current) - position);534 } 535 } 536 537 if (wstr_ length(current) > 0) {533 print_cc('\b', wstr_code_points(current) - position); 534 } 535 } 536 537 if (wstr_code_points(current) > 0) { 538 538 history_pos++; 539 539 history_pos = history_pos % KCONSOLE_HISTORY; … … 690 690 691 691 if (str_lcmp(hlp->name, cmdline + start, 692 max(str_ length(hlp->name),693 str_n length(cmdline + start, (size_t) (end - start)))) == 0) {692 max(str_code_points(hlp->name), 693 str_ncode_points(cmdline + start, (size_t) (end - start)))) == 0) { 694 694 cmd = hlp; 695 695 break; … … 826 826 while (true) { 827 827 wchar_t *tmp = clever_readline((char *) prompt, stdin, buffer); 828 size_t len = wstr_ length(tmp);828 size_t len = wstr_code_points(tmp); 829 829 if (!len) 830 830 continue;
Note:
See TracChangeset
for help on using the changeset viewer.