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