Lines Matching refs:cursor

16     Visual text editor. Predates the existence of standardized cursor keys,
36 size_t screen, cursor; //offsets
570 if (!TT.filesize) TT.cursor = 0;
573 if (TT.cursor < 1) {
574 TT.cursor = 0;
576 } else if (TT.cursor >= TT.filesize-1) {
577 TT.cursor = TT.filesize-1;
580 if ((len = text_codepoint(buf, TT.cursor)) < 1) {
581 TT.cursor--; //we are not in valid data try jump over
585 else TT.cursor--; //combine char jump over
595 // 0x10000000 = redraw after cursor needed
607 if (!TT.cursor) {
611 } else if (TT.screen > (1<<18) || TT.cursor > (1<<18)) {
614 TT.screen = text_strrchr(TT.cursor-1, '\n')+1;
620 c = text_count(0, TT.cursor, '\n');
622 TT.screen = text_strrchr(TT.cursor-1, '\n')+1;
646 size_t start = from, end = TT.cursor;
650 if (TT.vi_mov_flag&0x80000000) start = TT.cursor, end = from;
651 else TT.cursor = start; //yank moves cursor to left pos always?
671 size_t start = from, end = TT.cursor;
676 start = TT.cursor, end = from;
678 //pre adjust cursor move one right until at next valid rune
685 //cursor is at start at after delete
686 TT.cursor = start;
706 for (;count && TT.cursor; count--) {
707 TT.cursor--;
708 if (text_byte(TT.cursor) == '\n') TT.cursor++;
720 len = text_codepoint(buf, TT.cursor);
723 else if (len > 0) TT.cursor += len;
724 else TT.cursor++;
726 for (;TT.cursor < TT.filesize;) {
727 if ((len = text_codepoint(buf, TT.cursor)) < 1) {
728 TT.cursor++; //we are not in valid data try jump over
733 else TT.cursor += len;
744 for (;count--;) TT.cursor = text_psol(TT.cursor);
755 for (;count--;) TT.cursor = text_nsol(TT.cursor);
762 TT.cursor = text_sol(TT.screen);
768 TT.cursor = text_sol(TT.screen);
775 TT.cursor = text_sol(TT.screen);
782 size_t pos = text_strstr(TT.cursor+1, s);
789 if (pos != SIZE_MAX) TT.cursor = pos;
796 size_t history = TT.cursor;
797 size_t pos = text_sol(TT.cursor); //go left to first char on line
800 for (;count0; count0--) TT.cursor = text_nsol(TT.cursor);
804 TT.cursor = history;
810 size_t pos = text_sol(TT.cursor); //go left to first char on line
813 for (;count0; count0--) TT.cursor = text_nsol(TT.cursor);
815 if (pos == TT.cursor && TT.filesize) pos--;
823 size_t from = TT.cursor;
825 if (text_byte(TT.cursor) == '\n') {
830 if (text_byte(TT.cursor) == '\n') TT.vi_mov_flag |= 2;
843 char c = text_byte(TT.cursor);
845 if (TT.cursor > TT.filesize-1) break;
848 if (++TT.cursor > TT.filesize-1) break;
849 if ((c = text_byte(TT.cursor)) == '\n') break;
852 if (++TT.cursor > TT.filesize-1) break;
853 c = text_byte(TT.cursor);
857 if (++TT.cursor > TT.filesize-1) break;
858 c = text_byte(TT.cursor);
862 if (++TT.cursor > TT.filesize-1) break;
863 c = text_byte(TT.cursor);
878 c = text_byte(TT.cursor);
880 if (!TT.cursor) break;
883 if (!--TT.cursor) break;
884 c = text_byte(TT.cursor);
888 if (!--TT.cursor) break;
890 c = text_byte(TT.cursor);
894 if (!--TT.cursor) break;
896 c = text_byte(TT.cursor);
902 for (;TT.cursor; TT.cursor--) {
903 c = text_byte(TT.cursor-1);
921 c = text_byte(TT.cursor);
923 TT.cursor++;
924 for (;TT.cursor < TT.filesize-1; TT.cursor++) {
925 c = text_byte(TT.cursor+1);
940 insert_str(xstrdup(str), TT.cursor, len, len, HEAP);
941 TT.cursor += len;
948 TT.cursor = text_sol(TT.cursor);
956 size_t new = text_strchr(TT.cursor, '\n');
958 if (new != TT.cursor) {
959 TT.cursor = new - 1;
968 TT.cursor = text_strchr(TT.cursor, '\n');
979 TT.cursor = text_psol(TT.screen);
989 if (TT.screen > TT.cursor) TT.cursor = TT.screen;
996 if (TT.screen > TT.cursor) TT.cursor = TT.screen;
1003 TT.cursor = text_psol(TT.cursor);
1010 //if row changes during push original cursor position is kept
1013 size_t history = TT.cursor;
1018 if ((TT.cursor = text_strchr(TT.cursor, '\n')) == SIZE_MAX)
1019 TT.cursor = TT.filesize;
1020 else TT.cursor = text_nsol(TT.cursor);
1026 TT.cursor = history;
1035 size_t pos = text_strchr(TT.cursor, *symbol);
1036 if (pos != SIZE_MAX) TT.cursor = pos;
1043 size_t pos = text_strrchr(TT.cursor, *symbol);
1044 if (pos != SIZE_MAX) TT.cursor = pos;
1051 size_t prev_cursor = TT.cursor;
1053 TT.cursor = 0;
1055 if (TT.vi_mov_flag&0x40000000 && (TT.cursor = TT.filesize) > 0)
1056 TT.cursor = text_sol(TT.cursor-1);
1060 TT.cursor = next;
1061 TT.cursor++;
1064 check_cursor_bounds(); //adjusts cursor column
1065 if (prev_cursor > TT.cursor) TT.vi_mov_flag |= 0x80000000;
1072 TT.cursor = text_eol(TT.cursor);
1073 insert_str(xstrdup("\n"), TT.cursor++, 1, 1, HEAP);
1081 TT.cursor = text_psol(TT.cursor);
1087 size_t pos = TT.cursor;
1099 TT.cursor = text_sol(TT.cursor);
1109 if ((next = text_strchr(TT.cursor, '\n')) == SIZE_MAX) break;
1110 TT.cursor = next+1;
1111 vi_delete(reg, TT.cursor-1, 0);
1248 int prev_cursor = TT.cursor;
1352 //screen coordinates for cursor
1355 //variables used only for cursor handling
1376 SOL = text_sol(TT.cursor);
1384 //draw cursor row
1386 //for long lines line starts to scroll when cursor hits margin
1387 bytes = TT.cursor-SOL; // TT.cur_col;
1393 //find cursor position
1415 //if clipped area is substring from cursor row start
1421 //when not inserting but still need to keep cursor inside screen
1484 // TODO: the row,col display doesn't show the cursor column
1486 sprintf(toybuf, "%zu/%zuC %zu%% %d,%d", TT.cursor, TT.filesize,
1487 (100*TT.cursor)/(TT.filesize ? : 1), TT.cur_row+1, TT.cur_col+1);
1551 // TODO: support cursor keys in ex mode too.