MCPcopy Create free account
hub / github.com/antirez/llama.cpp-deepseek-v4-flash / move_word_right

Function move_word_right

common/console.cpp:619–664  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

617 }
618
619 static void move_word_right(size_t & char_pos, size_t & byte_pos, const std::vector<int> & widths, const std::string & line) {
620 if (char_pos >= widths.size()) {
621 return;
622 }
623
624 size_t new_char_pos = char_pos;
625 size_t new_byte_pos = byte_pos;
626 int move_width = 0;
627
628 while (new_char_pos < widths.size()) {
629 size_t advance = 0;
630 char32_t cp = decode_utf8(line, new_byte_pos, advance);
631 if (!is_space_codepoint(cp)) {
632 break;
633 }
634 move_width += widths[new_char_pos];
635 new_char_pos++;
636 new_byte_pos += advance;
637 }
638
639 while (new_char_pos < widths.size()) {
640 size_t advance = 0;
641 char32_t cp = decode_utf8(line, new_byte_pos, advance);
642 if (is_space_codepoint(cp)) {
643 break;
644 }
645 move_width += widths[new_char_pos];
646 new_char_pos++;
647 new_byte_pos += advance;
648 }
649
650 while (new_char_pos < widths.size()) {
651 size_t advance = 0;
652 char32_t cp = decode_utf8(line, new_byte_pos, advance);
653 if (!is_space_codepoint(cp)) {
654 break;
655 }
656 move_width += widths[new_char_pos];
657 new_char_pos++;
658 new_byte_pos += advance;
659 }
660
661 move_cursor(move_width);
662 char_pos = new_char_pos;
663 byte_pos = new_byte_pos;
664 }
665
666 static void move_cursor(int delta) {
667 if (delta == 0) return;

Callers 1

readline_advancedFunction · 0.85

Calls 4

is_space_codepointFunction · 0.85
move_cursorFunction · 0.85
decode_utf8Function · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected