Changeset 41811af in mainline for uspace/app/edit/edit.c
- Timestamp:
- 2011-06-10T10:14:26Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ab547063
- Parents:
- 9536e6e (diff), 390d80d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/edit/edit.c
r9536e6e r41811af 94 94 } doc_t; 95 95 96 static intcon;96 static console_ctrl_t *con; 97 97 static doc_t doc; 98 98 static bool done; … … 115 115 static void cursor_setvis(bool visible); 116 116 117 static void key_handle_unmod( console_event_t const *ev);118 static void key_handle_ctrl( console_event_t const *ev);119 static void key_handle_shift( console_event_t const *ev);117 static void key_handle_unmod(kbd_event_t const *ev); 118 static void key_handle_ctrl(kbd_event_t const *ev); 119 static void key_handle_shift(kbd_event_t const *ev); 120 120 static void key_handle_movement(unsigned int key, bool shift); 121 121 … … 158 158 int main(int argc, char *argv[]) 159 159 { 160 console_event_t ev;160 kbd_event_t ev; 161 161 coord_t coord; 162 162 bool new_file; … … 164 164 spt_t pt; 165 165 166 con = fphone(stdout);166 con = console_init(stdin, stdout); 167 167 console_clear(con); 168 168 … … 219 219 220 220 while (!done) { 221 console_get_ event(con, &ev);221 console_get_kbd_event(con, &ev); 222 222 pane.rflags = 0; 223 223 … … 277 277 278 278 /** Handle key without modifier. */ 279 static void key_handle_unmod( console_event_t const *ev)279 static void key_handle_unmod(kbd_event_t const *ev) 280 280 { 281 281 switch (ev->key) { … … 320 320 321 321 /** Handle Shift-key combination. */ 322 static void key_handle_shift( console_event_t const *ev)322 static void key_handle_shift(kbd_event_t const *ev) 323 323 { 324 324 switch (ev->key) { … … 344 344 345 345 /** Handle Ctrl-key combination. */ 346 static void key_handle_ctrl( console_event_t const *ev)346 static void key_handle_ctrl(kbd_event_t const *ev) 347 347 { 348 348 switch (ev->key) { … … 497 497 static char *filename_prompt(char const *prompt, char const *init_value) 498 498 { 499 console_event_t ev;499 kbd_event_t ev; 500 500 char *str; 501 501 wchar_t buffer[INFNAME_MAX_LEN + 1]; … … 517 517 518 518 while (!done) { 519 console_get_ event(con, &ev);519 console_get_kbd_event(con, &ev); 520 520 521 521 if (ev.type == KEY_PRESS) { … … 531 531 if (nc > 0) { 532 532 putchar('\b'); 533 fflush(stdout);533 console_flush(con); 534 534 --nc; 535 535 } … … 541 541 if (ev.c >= 32 && nc < max_len) { 542 542 putchar(ev.c); 543 fflush(stdout);543 console_flush(con); 544 544 buffer[nc++] = ev.c; 545 545 } … … 689 689 for (j = 0; j < scr_columns; ++j) 690 690 putchar(' '); 691 fflush(stdout);691 console_flush(con); 692 692 } 693 693 … … 757 757 if (coord_cmp(&csel_start, &rbc) <= 0 && 758 758 coord_cmp(&rbc, &csel_end) < 0) { 759 fflush(stdout);759 console_flush(con); 760 760 console_set_style(con, STYLE_SELECTED); 761 fflush(stdout);761 console_flush(con); 762 762 } 763 763 … … 768 768 while (pos < size) { 769 769 if ((csel_start.row == rbc.row) && (csel_start.column == s_column)) { 770 fflush(stdout);770 console_flush(con); 771 771 console_set_style(con, STYLE_SELECTED); 772 fflush(stdout);772 console_flush(con); 773 773 } 774 774 775 775 if ((csel_end.row == rbc.row) && (csel_end.column == s_column)) { 776 fflush(stdout);776 console_flush(con); 777 777 console_set_style(con, STYLE_NORMAL); 778 fflush(stdout);778 console_flush(con); 779 779 } 780 780 … … 794 794 795 795 if ((csel_end.row == rbc.row) && (csel_end.column == s_column)) { 796 fflush(stdout);796 console_flush(con); 797 797 console_set_style(con, STYLE_NORMAL); 798 fflush(stdout);798 console_flush(con); 799 799 } 800 800 … … 808 808 for (j = 0; j < fill; ++j) 809 809 putchar(' '); 810 fflush(stdout);810 console_flush(con); 811 811 console_set_style(con, STYLE_NORMAL); 812 812 } … … 833 833 int pos = scr_columns - 1 - n; 834 834 printf("%*s", pos, ""); 835 fflush(stdout);835 console_flush(con); 836 836 console_set_style(con, STYLE_NORMAL); 837 837 … … 1158 1158 int pos = -(scr_columns - 3); 1159 1159 printf(" %*s ", pos, str); 1160 fflush(stdout);1160 console_flush(con); 1161 1161 console_set_style(con, STYLE_NORMAL); 1162 1162
Note:
See TracChangeset
for help on using the changeset viewer.