Changeset ed372da in mainline
- Timestamp:
- 2009-12-05T16:03:12Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 371a012
- Parents:
- 7e0cb78
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/input.c
r7e0cb78 red372da 51 51 #define HISTORY_LEN 10 52 52 53 /** Text input field. */ 53 54 typedef struct { 55 /** Buffer holding text currently being edited */ 54 56 wchar_t buffer[INPUT_MAX]; 57 /** Screen coordinates of the top-left corner of the text field */ 55 58 int col0, row0; 59 /** Screen dimensions */ 56 60 int con_cols, con_rows; 61 /** Number of characters in @c buffer */ 57 62 int nc; 63 /** Caret position within buffer */ 58 64 int pos; 65 /** Selection mark position within buffer */ 59 66 int sel_start; 60 67 68 /** History (dynamically allocated strings) */ 61 69 char *history[1 + HISTORY_LEN]; 70 /** Number of entries in @c history, not counting [0] */ 62 71 int hnum; 72 /** Current position in history */ 63 73 int hpos; 74 /** Exit flag */ 64 75 bool done; 65 76 } tinput_t; 66 77 78 /** Seek direction */ 67 79 typedef enum { 68 80 seek_backward = -1, … … 196 208 width = ti->col0 + ti->nc; 197 209 rows = (width / ti->con_cols) + 1; 198 210 199 211 /* Update row0 if the screen scrolled. */ 200 212 if (ti->row0 + rows > ti->con_rows) … … 240 252 return; 241 253 } 242 254 243 255 if (ti->pos == 0) 244 256 return; … … 461 473 } 462 474 475 /** Initialize text input field. 476 * 477 * Must be called before using the field. It clears the history. 478 */ 463 479 static void tinput_init(tinput_t *ti) 464 480 { … … 468 484 } 469 485 486 /** Read in one line of input. */ 470 487 static char *tinput_read(tinput_t *ti) 471 488 { … … 634 651 } 635 652 636 637 653 void get_input(cliuser_t *usr) 638 654 {
Note:
See TracChangeset
for help on using the changeset viewer.