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

Function move_word_left

common/console.cpp:581–617  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

579 }
580
581 static void move_word_left(size_t & char_pos, size_t & byte_pos, const std::vector<int> & widths, const std::string & line) {
582 if (char_pos == 0) {
583 return;
584 }
585
586 size_t new_char_pos = char_pos;
587 size_t new_byte_pos = byte_pos;
588 int move_width = 0;
589
590 while (new_char_pos > 0) {
591 size_t prev_byte = prev_utf8_char_pos(line, new_byte_pos);
592 size_t advance = 0;
593 char32_t cp = decode_utf8(line, prev_byte, advance);
594 if (!is_space_codepoint(cp)) {
595 break;
596 }
597 move_width += widths[new_char_pos - 1];
598 new_char_pos--;
599 new_byte_pos = prev_byte;
600 }
601
602 while (new_char_pos > 0) {
603 size_t prev_byte = prev_utf8_char_pos(line, new_byte_pos);
604 size_t advance = 0;
605 char32_t cp = decode_utf8(line, prev_byte, advance);
606 if (is_space_codepoint(cp)) {
607 break;
608 }
609 move_width += widths[new_char_pos - 1];
610 new_char_pos--;
611 new_byte_pos = prev_byte;
612 }
613
614 move_cursor(-move_width);
615 char_pos = new_char_pos;
616 byte_pos = new_byte_pos;
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()) {

Callers 1

readline_advancedFunction · 0.85

Calls 4

prev_utf8_char_posFunction · 0.85
is_space_codepointFunction · 0.85
move_cursorFunction · 0.85
decode_utf8Function · 0.70

Tested by

no test coverage detected