1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05: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 */ 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 /** This is one of the axis of ELinks' user interaction. struct terminal
* defines the terminal ELinks is running on --- each ELinks instance has * defines the terminal ELinks is running on --- each ELinks instance has
* one. It contains the basic terminal attributes, the settings associated * one. It contains the basic terminal attributes, the settings associated
@ -155,6 +165,8 @@ struct terminal {
/** For communication between instances */ /** For communication between instances */
struct terminal_interlink *interlink; struct terminal_interlink *interlink;
struct textarea_data *textarea_data;
struct term_event_mouse prev_mouse_event; struct term_event_mouse prev_mouse_event;
}; };

View File

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