Lines Matching defs:cursor

436 find_next_word(char *cursor, char *eol)
438 while (cursor < eol && *cursor != ' ')
439 cursor++;
440 while (cursor < eol && *cursor == ' ')
441 cursor++;
442 return (cursor);
446 find_prev_word(char *buf, char *cursor)
450 if (cursor == buf)
451 return (cursor);
452 cursor--;
453 while (cursor > buf && *cursor == ' ')
454 cursor--;
455 while (cursor > buf && *cursor != ' ') {
457 cursor--;
459 if (skippedword && *cursor == ' ')
460 cursor++;
461 return (cursor);
480 /* Backup cursor for new line */
501 char *p, *cursor, *eol, *tp, *cp;
521 for (cursor = eol = buf; ; ) {
528 if ((cursor - buf) < MAX_LINE_SIZE) {
529 *cursor++ = d;
530 if (cursor > eol)
531 eol = cursor;
545 tp = find_prev_word(buf, cursor);
546 if (tp < cursor) {
547 do_emit_chars(env, '\b', cursor - tp);
548 cursor = tp;
554 tp = find_next_word(cursor, eol);
555 if (tp > cursor) {
556 do_emit_str(env, tp, tp - cursor);
557 cursor = tp;
562 case 'H': /* just before cursor, saving chars */
568 tp = find_next_word(cursor, eol);
569 if (tp <= cursor)
571 len = tp - cursor;
572 do_save_buf(save_buf, cursor, len);
573 memmove(cursor, tp, eol - tp);
574 redraw_line(env, buf, cursor, eol, buf, cursor,
583 if ((cursor - buf) < MAX_LINE_SIZE) {
584 *cursor++ = d;
585 if (cursor > eol)
586 eol = cursor;
596 if (cursor < eol)
597 do_emit(env, *cursor++);
600 case CTRL('a'): /* cursor to beginning of line */
601 do_emit_chars(env, '\b', cursor - buf);
602 cursor = buf;
605 case CTRL('e'): /* cursor to end of line */
606 do_emit_str(env, cursor, eol - cursor);
607 cursor = eol;
618 save_cursor = cursor - buf;
627 redraw_line(env, buf, cursor, eol,
632 cursor = buf + save_cursor;
638 redraw_line(env, buf, cursor, eol, p, p, p + len);
640 cursor = buf;
647 case CTRL('k'): /* Erase from cursor to eol, saving */
649 if (cursor == eol) {
664 redraw_line(env, buf, cursor, eol, buf, cursor,
669 do_save_buf(save_buf, cursor, eol - cursor);
670 redraw_line(env, buf, cursor, eol, buf, cursor,
671 cursor);
672 eol = cursor;
676 tp = find_prev_word(buf, cursor);
677 if (tp == cursor)
679 len = cursor - tp;
681 memmove(tp, cursor, eol - cursor);
682 redraw_line(env, buf, cursor, eol, buf, cursor - len,
685 cursor -= len;
690 redraw_line(env, buf, cursor, eol, buf, buf, buf);
691 cursor = buf;
695 case CTRL('y'): /* Insert save buffer before cursor */
700 memmove(cursor + len, cursor, eol - cursor);
701 memcpy(cursor, save_buf, len);
702 redraw_line(env, buf, cursor, eol, buf, cursor + len,
704 cursor += len;
719 redraw_line(env, buf, buf, buf, buf, cursor, eol);
723 redraw_line(env, buf, cursor, eol, buf, cursor, eol);
729 case CTRL('b'): /* backup cursor */
730 if (cursor <= buf)
732 cursor--;
738 if (cursor <= buf)
740 memmove(cursor - 1, cursor, eol - cursor);
741 redraw_line(env, buf, cursor, eol, buf, cursor - 1,
743 cursor--;