Changeset ed372da in mainline


Ignore:
Timestamp:
2009-12-05T16:03:12Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
371a012
Parents:
7e0cb78
Message:

Add some comments.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/input.c

    r7e0cb78 red372da  
    5151#define HISTORY_LEN 10
    5252
     53/** Text input field. */
    5354typedef struct {
     55        /** Buffer holding text currently being edited */
    5456        wchar_t buffer[INPUT_MAX];
     57        /** Screen coordinates of the top-left corner of the text field */
    5558        int col0, row0;
     59        /** Screen dimensions */
    5660        int con_cols, con_rows;
     61        /** Number of characters in @c buffer */
    5762        int nc;
     63        /** Caret position within buffer */
    5864        int pos;
     65        /** Selection mark position within buffer */
    5966        int sel_start;
    6067
     68        /** History (dynamically allocated strings) */
    6169        char *history[1 + HISTORY_LEN];
     70        /** Number of entries in @c history, not counting [0] */
    6271        int hnum;
     72        /** Current position in history */
    6373        int hpos;
     74        /** Exit flag */
    6475        bool done;
    6576} tinput_t;
    6677
     78/** Seek direction */
    6779typedef enum {
    6880        seek_backward = -1,
     
    196208        width = ti->col0 + ti->nc;
    197209        rows = (width / ti->con_cols) + 1;
    198  
     210
    199211        /* Update row0 if the screen scrolled. */
    200212        if (ti->row0 + rows > ti->con_rows)
     
    240252                return;
    241253        }
    242  
     254
    243255        if (ti->pos == 0)
    244256                return;
     
    461473}
    462474
     475/** Initialize text input field.
     476 *
     477 * Must be called before using the field. It clears the history.
     478 */
    463479static void tinput_init(tinput_t *ti)
    464480{
     
    468484}
    469485
     486/** Read in one line of input. */
    470487static char *tinput_read(tinput_t *ti)
    471488{
     
    634651}
    635652
    636 
    637653void get_input(cliuser_t *usr)
    638654{
Note: See TracChangeset for help on using the changeset viewer.