1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-28 03:06:20 -04:00

Move pointers to struct textarea_data from linked-list to terminal structure

This commit is contained in:
Miciah Dashiel Butler Masters 2007-09-01 09:02:01 +00:00 committed by Miciah Dashiel Butler Masters
parent 7726e33b0a
commit d4c262694b
2 changed files with 16 additions and 21 deletions

View File

@ -49,6 +49,16 @@ enum term_redrawing_state {
TREDRAW_DELAYED = 2, /**< Do not redraw for now */
};
struct textarea_data {
LIST_HEAD(struct textarea_data);
size_t fc_maxlength;
struct form_state *fs;
struct terminal *term;
struct document_view *doc_view;
struct link *link;
unsigned char *fn;
};
/** This is one of the axis of ELinks' user interaction. struct terminal
* defines the terminal ELinks is running on --- each ELinks instance has
* one. It contains the basic terminal attributes, the settings associated
@ -155,6 +165,8 @@ struct terminal {
/** For communication between instances */
struct terminal_interlink *interlink;
struct textarea_data *textarea_data;
struct term_event_mouse prev_mouse_event;
};

View File

@ -48,18 +48,6 @@ struct line_info {
#endif /* CONFIG_UTF8 */
};
struct textarea_data {
LIST_HEAD(struct textarea_data);
size_t fc_maxlength;
struct form_state *fs;
struct terminal *term;
struct document_view *doc_view;
struct link *link;
unsigned char *fn;
};
static INIT_LIST_HEAD(textarea_list); /* struct textarea_data */
/** We add two extra entries to the table so the ending info can be added
* without reallocating. */
#define realloc_line_info(info, size) \
@ -635,7 +623,7 @@ textarea_edit(int op, struct terminal *term_, struct form_state *fs_,
td->link = link_;
td->fc_maxlength = get_link_form_control(link_)->maxlength;
td->term = term_;
add_to_list(textarea_list, td);
td->term->textarea_data = td;
exec_on_terminal(td->term, ex, "", TERM_EXEC_FG);
mem_free(ex);
@ -647,13 +635,9 @@ textarea_edit(int op, struct terminal *term_, struct form_state *fs_,
int found = 0;
struct string file;
foreach (td, textarea_list) {
if (td->term == term_) {
found = 1;
break;
}
}
if (!found) return;
td = term_->textarea_data;
if (!td)
return;
if (!td->fs || !init_string(&file)
|| !add_file_to_string(&file, td->fn))
@ -689,7 +673,6 @@ textarea_edit(int op, struct terminal *term_, struct form_state *fs_,
draw_form_entry(td->term, td->doc_view, td->link);
}
end:
del_from_list(td);
textarea_editor--;
free_and_return:
mem_free(td->fn);