Changes in uspace/app/edit/edit.c [9f1362d4:a000878c] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/edit/edit.c
r9f1362d4 ra000878c 40 40 #include <vfs/vfs.h> 41 41 #include <io/console.h> 42 #include <io/ style.h>42 #include <io/color.h> 43 43 #include <io/keycode.h> 44 44 #include <errno.h> … … 100 100 static bool cursor_visible; 101 101 102 static ipcarg_t scr_rows; 103 static ipcarg_t scr_columns; 102 static int scr_rows, scr_columns; 104 103 105 104 #define ROW_BUF_SIZE 4096 … … 506 505 asprintf(&str, "%s: %s", prompt, init_value); 507 506 status_display(str); 508 console_ set_pos(con, 1 + str_length(str), scr_rows - 1);507 console_goto(con, 1 + str_length(str), scr_rows - 1); 509 508 free(str); 510 509 511 console_set_ style(con, STYLE_INVERTED);510 console_set_color(con, COLOR_WHITE, COLOR_BLACK, 0); 512 511 513 512 max_len = min(INFNAME_MAX_LEN, scr_columns - 4 - str_length(prompt)); … … 553 552 str = wstr_to_astr(buffer); 554 553 555 console_set_ style(con, STYLE_NORMAL);554 console_set_color(con, COLOR_BLACK, COLOR_WHITE, 0); 556 555 557 556 return str; … … 672 671 { 673 672 int sh_rows, rows; 673 int i, j; 674 674 675 675 sheet_get_num_rows(&doc.sh, &sh_rows); … … 678 678 /* Draw rows from the sheet. */ 679 679 680 console_ set_pos(con, 0, 0);680 console_goto(con, 0, 0); 681 681 pane_row_range_display(0, rows); 682 682 683 683 /* Clear the remaining rows if file is short. */ 684 685 int i; 686 ipcarg_t j; 684 687 685 for (i = rows; i < pane.rows; ++i) { 688 console_ set_pos(con, 0, i);686 console_goto(con, 0, i); 689 687 for (j = 0; j < scr_columns; ++j) 690 688 putchar(' '); … … 738 736 /* Draw rows from the sheet. */ 739 737 740 console_ set_pos(con, 0, 0);738 console_goto(con, 0, 0); 741 739 for (i = r0; i < r1; ++i) { 742 740 /* Starting point for row display */ … … 758 756 coord_cmp(&rbc, &csel_end) < 0) { 759 757 fflush(stdout); 760 console_set_ style(con, STYLE_SELECTED);758 console_set_color(con, COLOR_BLACK, COLOR_RED, 0); 761 759 fflush(stdout); 762 760 } 763 761 764 console_ set_pos(con, 0, i);762 console_goto(con, 0, i); 765 763 size = str_size(row_buf); 766 764 pos = 0; … … 769 767 if ((csel_start.row == rbc.row) && (csel_start.column == s_column)) { 770 768 fflush(stdout); 771 console_set_ style(con, STYLE_SELECTED);769 console_set_color(con, COLOR_BLACK, COLOR_RED, 0); 772 770 fflush(stdout); 773 771 } … … 775 773 if ((csel_end.row == rbc.row) && (csel_end.column == s_column)) { 776 774 fflush(stdout); 777 console_set_ style(con, STYLE_NORMAL);775 console_set_color(con, COLOR_BLACK, COLOR_WHITE, 0); 778 776 fflush(stdout); 779 777 } … … 795 793 if ((csel_end.row == rbc.row) && (csel_end.column == s_column)) { 796 794 fflush(stdout); 797 console_set_ style(con, STYLE_NORMAL);795 console_set_color(con, COLOR_BLACK, COLOR_WHITE, 0); 798 796 fflush(stdout); 799 797 } … … 809 807 putchar(' '); 810 808 fflush(stdout); 811 console_set_ style(con, STYLE_NORMAL);809 console_set_color(con, COLOR_BLACK, COLOR_WHITE, 0); 812 810 } 813 811 … … 826 824 const char *fname = (doc.file_name != NULL) ? doc.file_name : "<unnamed>"; 827 825 828 console_ set_pos(con, 0, scr_rows - 1);829 console_set_ style(con, STYLE_INVERTED);826 console_goto(con, 0, scr_rows - 1); 827 console_set_color(con, COLOR_WHITE, COLOR_BLACK, 0); 830 828 int n = printf(" %d, %d: File '%s'. Ctrl-Q Quit Ctrl-S Save " 831 829 "Ctrl-E Save As", coord.row, coord.column, fname); 832 830 printf("%*s", scr_columns - 1 - n, ""); 833 831 fflush(stdout); 834 console_set_ style(con, STYLE_NORMAL);832 console_set_color(con, COLOR_BLACK, COLOR_WHITE, 0); 835 833 836 834 pane.rflags |= REDRAW_CARET; … … 846 844 847 845 spt_get_coord(&caret_pt, &coord); 848 console_ set_pos(con, coord.column - pane.sh_column,846 console_goto(con, coord.column - pane.sh_column, 849 847 coord.row - pane.sh_row); 850 848 } … … 1151 1149 static void status_display(char const *str) 1152 1150 { 1153 console_ set_pos(con, 0, scr_rows - 1);1154 console_set_ style(con, STYLE_INVERTED);1151 console_goto(con, 0, scr_rows - 1); 1152 console_set_color(con, COLOR_WHITE, COLOR_BLACK, 0); 1155 1153 printf(" %*s ", -(scr_columns - 3), str); 1156 1154 fflush(stdout); 1157 console_set_ style(con, STYLE_NORMAL);1155 console_set_color(con, COLOR_BLACK, COLOR_WHITE, 0); 1158 1156 1159 1157 pane.rflags |= REDRAW_CARET;
Note:
See TracChangeset
for help on using the changeset viewer.