From cc67edbe1c77d4bc1803084e99498be97a9a662f Mon Sep 17 00:00:00 2001 From: Miciah Dashiel Butler Masters Date: Sat, 1 Sep 2007 09:10:54 +0000 Subject: [PATCH] Drop @textarea_editor global --- src/terminal/event.c | 2 +- src/terminal/terminal.c | 2 +- src/viewer/text/textarea.c | 10 ++-------- src/viewer/text/textarea.h | 1 - 4 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/terminal/event.c b/src/terminal/event.c index 1b3c56419..a3af89ddd 100644 --- a/src/terminal/event.c +++ b/src/terminal/event.c @@ -446,7 +446,7 @@ invalid_utf8_start_byte: destroy_terminal(term); return 0; case EVENT_TEXTAREA: - if (textarea_editor) + if (term->textarea_data) textarea_edit(1, term, NULL, NULL, NULL); break; diff --git a/src/terminal/terminal.c b/src/terminal/terminal.c index e781ff338..1b2afab1a 100644 --- a/src/terminal/terminal.c +++ b/src/terminal/terminal.c @@ -202,7 +202,7 @@ unblock_terminal(struct terminal *term) (select_handler_T) destroy_terminal, term); unblock_itrm(); redraw_terminal_cls(term); - if (textarea_editor) /* XXX */ + if (term->textarea_data) /* XXX */ textarea_edit(1, term, NULL, NULL, NULL); } diff --git a/src/viewer/text/textarea.c b/src/viewer/text/textarea.c index 59f255770..cc71525ef 100644 --- a/src/viewer/text/textarea.c +++ b/src/viewer/text/textarea.c @@ -530,7 +530,6 @@ encode_textarea(struct submitted_value *sv) * the content of it back to master somehow, add special flags for not deleting * of 'delete' etc) and I'm not going to do that now. Inter-links communication * *NEEDS* rewrite, as it looks just like quick messy hack now. --pasky */ -int textarea_editor = 0; static unsigned char * save_textarea_file(unsigned char *value) @@ -628,20 +627,17 @@ textarea_edit(int op, struct terminal *term_, struct form_state *fs_, exec_on_terminal(td->term, ex, "", TERM_EXEC_FG); mem_free(ex); - textarea_editor++; return; } else if (op == 1) { - int found = 0; struct string file; td = term_->textarea_data; - if (!td) - return; + assert(td); if (!td->fs || !init_string(&file) || !add_file_to_string(&file, td->fn)) - goto end; + goto free_and_return; if (file.length > td->fc_maxlength) { file.source[td->fc_maxlength] = '\0'; @@ -672,8 +668,6 @@ textarea_edit(int op, struct terminal *term_, struct form_state *fs_, if (td->doc_view && td->link) draw_form_entry(td->term, td->doc_view, td->link); } -end: - textarea_editor--; free_and_return: mem_free(td->fn); mem_free(td); diff --git a/src/viewer/text/textarea.h b/src/viewer/text/textarea.h index 6b6386f78..53b377f4c 100644 --- a/src/viewer/text/textarea.h +++ b/src/viewer/text/textarea.h @@ -21,7 +21,6 @@ int area_cursor(struct form_control *fc, struct form_state *fs); void draw_textarea(struct terminal *term, struct form_state *fs, struct document_view *doc_view, struct link *link); unsigned char *encode_textarea(struct submitted_value *sv); -extern int textarea_editor; void textarea_edit(int, struct terminal *, struct form_state *, struct document_view *, struct link *); void menu_textarea_edit(struct terminal *term, void *xxx, void *ses_);