1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

viewer: Document some members of struct form_state.

The new comments describe how the members were apparently intended to
be used.  However, the implementation does not actually work when
CONFIG_UTF_8 is defined, and the current semantics do not even allow
an efficient implementation of long (mostly scrolled out) strings.
This commit is contained in:
Kalle Olavi Niemitalo 2006-09-02 18:58:24 +03:00 committed by Kalle Olavi Niemitalo
parent 527898687a
commit a8c573a174

View File

@ -37,11 +37,31 @@ struct form_state {
int position;
enum form_type type;
/* For FC_TEXT, FC_PASSWORD, and FC_FILE, @value is the text
* string that the user can edit. The string is null-terminated;
* its length is not stored separately. The size of the buffer
* is not stored anywhere; extending the string always requires
* calling realloc(). The string is not normally allowed to grow
* past @form_control.maxlength bytes (not counting the null),
* but there may be ways to get longer strings. */
unsigned char *value;
/* For FC_TEXT, FC_PASSWORD, and FC_FILE, @state is the byte
* position of the insertion point in @value.
* For FC_CHECKBOX and FC_RADIO, @state is 1 or 0.
* For FC_SELECT, @state is the index of the selected item
* in @form_control.labels. */
int state;
#ifdef CONFIG_UTF_8
/* For FC_TEXT, FC_PASSWORD, and FC_FILE, @state_cell is the
* number of cells needed for the text before the insertion
* point. (For FC_PASSWORD, each character is one cell.)
* When CONFIG_UTF_8 is not defined, @state_cell is assumed
* to be the same as @state. */
int state_cell;
#endif /* CONFIG_UTF_8 */
/* For FC_TEXT, FC_PASSWORD, and FC_FILE, @vpos is the number
* of cells that scrolling has hidden at the left. Thus, the
* X offset of the cursor is @state_cell - @vpos. */
int vpos;
int vypos;