summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEmanuele Giaquinta <exg@irssi.org>2009-01-10 18:38:08 +0000
committerexg <exg@dbcabf3a-b0e7-0310-adc4-f8d773084564>2009-01-10 18:38:08 +0000
commit9dcea776a1dd359be200856bd6c959a6d76364ef (patch)
tree10ffeebf312215953cfb671489acd7039e432fe2 /src
parentb9cbba2ae2601ec2252203afc403728566748f0d (diff)
downloadirssi-9dcea776a1dd359be200856bd6c959a6d76364ef.zip
Remove buggy /scrollback redraw - scrollback_save_formats.
git-svn-id: file:///var/www/svn.irssi.org/SVN/irssi/trunk@4981 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r--src/fe-text/Makefile.am2
-rw-r--r--src/fe-text/irssi.c3
-rw-r--r--src/fe-text/textbuffer-commands.c23
-rw-r--r--src/fe-text/textbuffer-reformat.c281
-rw-r--r--src/fe-text/textbuffer-reformat.h9
-rw-r--r--src/fe-text/textbuffer-view.c4
-rw-r--r--src/fe-text/textbuffer.c2
-rw-r--r--src/fe-text/textbuffer.h5
8 files changed, 3 insertions, 326 deletions
diff --git a/src/fe-text/Makefile.am b/src/fe-text/Makefile.am
index 688a0441..b8ec634e 100644
--- a/src/fe-text/Makefile.am
+++ b/src/fe-text/Makefile.am
@@ -61,7 +61,6 @@ irssi_SOURCES = \
$(use_term_sources) \
textbuffer.c \
textbuffer-commands.c \
- textbuffer-reformat.c \
textbuffer-view.c \
irssi.c \
module-formats.c
@@ -82,7 +81,6 @@ noinst_HEADERS = \
terminfo-core.h \
textbuffer.h \
textbuffer-view.h \
- textbuffer-reformat.h \
module.h \
module-formats.h
diff --git a/src/fe-text/irssi.c b/src/fe-text/irssi.c
index bf389998..2f2f37d5 100644
--- a/src/fe-text/irssi.c
+++ b/src/fe-text/irssi.c
@@ -39,7 +39,6 @@
#include "gui-readline.h"
#include "statusbar.h"
#include "gui-windows.h"
-#include "textbuffer-reformat.h"
#include "irssi-version.h"
#include <signal.h>
@@ -168,7 +167,6 @@ static void textui_finish_init(void)
textbuffer_init();
textbuffer_view_init();
textbuffer_commands_init();
- textbuffer_reformat_init();
gui_expandos_init();
gui_printtext_init();
gui_readline_init();
@@ -230,7 +228,6 @@ static void textui_deinit(void)
mainwindow_activity_deinit();
mainwindows_deinit();
gui_expandos_deinit();
- textbuffer_reformat_deinit();
textbuffer_commands_deinit();
textbuffer_view_deinit();
textbuffer_deinit();
diff --git a/src/fe-text/textbuffer-commands.c b/src/fe-text/textbuffer-commands.c
index 8dbc9632..a99b4af4 100644
--- a/src/fe-text/textbuffer-commands.c
+++ b/src/fe-text/textbuffer-commands.c
@@ -29,7 +29,6 @@
#include "printtext.h"
#include "gui-windows.h"
-#include "textbuffer-reformat.h"
/* SYNTAX: CLEAR [-all] [<refnum>] */
static void cmd_clear(const char *data)
@@ -310,26 +309,6 @@ static void cmd_scrollback_end(const char *data)
gui_window_scroll(active_win, view->bottom_subline);
}
-/* SYNTAX: SCROLLBACK REDRAW */
-static void cmd_scrollback_redraw(void)
-{
- GUI_WINDOW_REC *gui;
- LINE_REC *line, *next;
-
- gui = WINDOW_GUI(active_win);
-
- term_refresh_freeze();
- line = textbuffer_view_get_lines(gui->view);
- while (line != NULL) {
- next = line->next;
- textbuffer_reformat_line(active_win, line);
- line = next;
- }
-
- gui_window_redraw(active_win);
- term_refresh_thaw();
-}
-
static void cmd_scrollback_status(void)
{
GSList *tmp;
@@ -385,7 +364,6 @@ void textbuffer_commands_init(void)
command_bind("scrollback goto", NULL, (SIGNAL_FUNC) cmd_scrollback_goto);
command_bind("scrollback home", NULL, (SIGNAL_FUNC) cmd_scrollback_home);
command_bind("scrollback end", NULL, (SIGNAL_FUNC) cmd_scrollback_end);
- command_bind("scrollback redraw", NULL, (SIGNAL_FUNC) cmd_scrollback_redraw);
command_bind("scrollback status", NULL, (SIGNAL_FUNC) cmd_scrollback_status);
command_set_options("clear", "all");
@@ -405,7 +383,6 @@ void textbuffer_commands_deinit(void)
command_unbind("scrollback goto", (SIGNAL_FUNC) cmd_scrollback_goto);
command_unbind("scrollback home", (SIGNAL_FUNC) cmd_scrollback_home);
command_unbind("scrollback end", (SIGNAL_FUNC) cmd_scrollback_end);
- command_unbind("scrollback redraw", (SIGNAL_FUNC) cmd_scrollback_redraw);
command_unbind("scrollback status", (SIGNAL_FUNC) cmd_scrollback_status);
signal_remove("away mode changed", (SIGNAL_FUNC) sig_away_changed);
diff --git a/src/fe-text/textbuffer-reformat.c b/src/fe-text/textbuffer-reformat.c
deleted file mode 100644
index 17c3ed8c..00000000
--- a/src/fe-text/textbuffer-reformat.c
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- textbuffer-reformat.c : Reformatting lines in text buffer
-
- Copyright (C) 1999-2001 Timo Sirainen
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-*/
-
-#include "module.h"
-#include "signals.h"
-#include "settings.h"
-
-#include "formats.h"
-
-#include "gui-windows.h"
-#include "gui-printtext.h"
-#include "textbuffer.h"
-
-static GString *format;
-static int scrollback_save_formats;
-
-/* Read one block between \0<format>s */
-static char *line_read_format(unsigned const char **text)
-{
- GString *str;
- char *ret;
-
- str = g_string_new(NULL);
- for (;;) {
- if (**text == '\0') {
- if ((*text)[1] == LINE_CMD_EOL) {
- /* leave text at \0<eof> */
- break;
- }
- if ((*text)[1] == LINE_CMD_FORMAT_CONT) {
- /* leave text at \0<format_cont> */
- break;
- }
- (*text)++;
-
- if (**text == LINE_CMD_FORMAT) {
- /* move text to start after \0<format> */
- (*text)++;
- break;
- }
-
- if (**text == LINE_CMD_CONTINUE) {
- unsigned char *tmp;
-
- memcpy(&tmp, (*text)+1, sizeof(char *));
- *text = tmp;
- continue;
- } else if (**text & 0x80)
- (*text)++;
- continue;
- }
-
- g_string_append_c(str, (char) **text);
- (*text)++;
- }
-
- ret = str->str;
- g_string_free(str, FALSE);
- return ret;
-}
-
-static char *textbuffer_line_get_format(WINDOW_REC *window, LINE_REC *line,
- GString *raw)
-{
- const unsigned char *text;
- char *module, *format_name, *args[MAX_FORMAT_PARAMS], *ret;
- TEXT_DEST_REC dest;
- int formatnum, argcount;
-
- text = (const unsigned char *) line->text;
-
- /* skip the beginning of the line until we find the format */
- format_name = line_read_format(&text);
- g_free(format_name);
- if (text[1] == LINE_CMD_FORMAT_CONT) {
- if (raw != NULL) {
- g_string_append_c(raw, '\0');
- g_string_append_c(raw, (char)LINE_CMD_FORMAT_CONT);
- }
- return NULL;
- }
-
- /* read format information */
- module = line_read_format(&text);
- format_name = line_read_format(&text);
-
- if (raw != NULL) {
- g_string_append_c(raw, '\0');
- g_string_append_c(raw, (char)LINE_CMD_FORMAT);
-
- g_string_append(raw, module);
-
- g_string_append_c(raw, '\0');
- g_string_append_c(raw, (char)LINE_CMD_FORMAT);
-
- g_string_append(raw, format_name);
- }
-
- formatnum = format_find_tag(module, format_name);
- if (formatnum == -1)
- ret = NULL;
- else {
- argcount = 0;
- memset(args, 0, sizeof(args));
- while (*text != '\0' || text[1] != LINE_CMD_EOL) {
- args[argcount] = line_read_format(&text);
- if (raw != NULL) {
- g_string_append_c(raw, '\0');
- g_string_append_c(raw,
- (char)LINE_CMD_FORMAT);
-
- g_string_append(raw, args[argcount]);
- }
- argcount++;
- }
-
- /* get the format text */
- format_create_dest(&dest, NULL, NULL, line->info.level, window);
- ret = format_get_text_theme_charargs(current_theme,
- module, &dest,
- formatnum, args);
- while (argcount > 0)
- g_free(args[--argcount]);
- }
-
- g_free(module);
- g_free(format_name);
-
- return ret;
-}
-
-void textbuffer_reformat_line(WINDOW_REC *window, LINE_REC *line)
-{
- GUI_WINDOW_REC *gui;
- TEXT_DEST_REC dest;
- LINE_REC *line_prev;
- LINE_INFO_REC line_info;
- GString *raw;
- char *str, *tmp, *prestr, *linestart, *leveltag;
-
- gui = WINDOW_GUI(window);
-
- raw = g_string_new(NULL);
- str = textbuffer_line_get_format(window, line, raw);
-
- if (str == NULL && raw->len == 2 &&
- raw->str[1] == (char)LINE_CMD_FORMAT_CONT) {
- /* multiline format, format explained in one the
- following lines. remove this line. */
- textbuffer_view_remove_line(gui->view, line);
- } else if (str != NULL) {
- /* FIXME: ugly ugly .. and this can't handle
- unformatted lines.. */
- g_string_append_c(raw, '\0');
- g_string_append_c(raw, (char)LINE_CMD_EOL);
-
- line_prev = line->prev;
- memcpy(&line_info, &line->info, sizeof(line_info));
- textbuffer_view_remove_line(gui->view, line); line = NULL;
-
- format_create_dest(&dest, NULL, NULL, line_info.level, window);
-
- linestart = format_get_line_start(current_theme, &dest, line_info.time);
- leveltag = format_get_level_tag(current_theme, &dest);
-
- prestr = g_strconcat(linestart == NULL ? "" : linestart,
- leveltag, NULL);
- g_free_not_null(linestart);
- g_free_not_null(leveltag);
-
- tmp = format_add_linestart(str, prestr);
- g_free(str);
- g_free(prestr);
-
- gui_printtext_after(&dest, line_prev, tmp);
- g_free(tmp);
-
- line = textbuffer_insert(gui->view->buffer, gui->insert_after,
- (unsigned char *) raw->str,
- raw->len, &line_info);
- textbuffer_view_insert_line(gui->view, line);
- }
- g_string_free(raw, TRUE);
-}
-
-static void sig_print_format(THEME_REC *theme, const char *module,
- TEXT_DEST_REC *dest, void *formatnump,
- char **args)
-{
- FORMAT_REC *formats;
- int formatnum, n;
-
- if (!scrollback_save_formats)
- return;
-
- formatnum = GPOINTER_TO_INT(formatnump);
- formats = g_hash_table_lookup(default_formats, module);
-
- /* <module><format_name><arg...> */
- g_string_truncate(format, 0);
-
- g_string_append_c(format, '\0');
- g_string_append_c(format, (char)LINE_CMD_FORMAT);
-
- g_string_append(format, module);
-
- g_string_append_c(format, '\0');
- g_string_append_c(format, (char)LINE_CMD_FORMAT);
-
- g_string_append(format, formats[formatnum].tag);
-
- for (n = 0; n < formats[formatnum].params; n++) {
- g_string_append_c(format, '\0');
- g_string_append_c(format, (char)LINE_CMD_FORMAT);
-
- if (args[n] != NULL)
- g_string_append(format, args[n]);
- }
-}
-
-static void sig_gui_printtext_finished(WINDOW_REC *window)
-{
- GUI_WINDOW_REC *gui;
- LINE_REC *insert_after;
-
- if (format->len == 0)
- return;
-
- /* save format of the line */
- gui = WINDOW_GUI(window);
- insert_after = gui->use_insert_after ?
- gui->insert_after : gui->view->buffer->cur_line;
-
- textbuffer_insert(gui->view->buffer, insert_after,
- (unsigned char *) format->str,
- format->len, NULL);
-
- g_string_truncate(format, 0);
-}
-
-static void read_settings(void)
-{
- scrollback_save_formats = settings_get_bool("scrollback_save_formats");
-}
-
-void textbuffer_reformat_init(void)
-{
- format = g_string_new(NULL);
- settings_add_bool("history", "scrollback_save_formats", FALSE);
-
- read_settings();
- signal_add("print format", (SIGNAL_FUNC) sig_print_format);
- signal_add_first("gui print text finished", (SIGNAL_FUNC) sig_gui_printtext_finished);
- signal_add("setup changed", (SIGNAL_FUNC) read_settings);
-}
-
-void textbuffer_reformat_deinit(void)
-{
- g_string_free(format, TRUE);
-
- signal_remove("print format", (SIGNAL_FUNC) sig_print_format);
- signal_remove("gui print text finished", (SIGNAL_FUNC) sig_gui_printtext_finished);
- signal_remove("setup changed", (SIGNAL_FUNC) read_settings);
-}
diff --git a/src/fe-text/textbuffer-reformat.h b/src/fe-text/textbuffer-reformat.h
deleted file mode 100644
index 2818ec68..00000000
--- a/src/fe-text/textbuffer-reformat.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef __TEXTBUFFER_REFORMAT_H
-#define __TEXTBUFFER_REFORMAT_H
-
-void textbuffer_reformat_line(WINDOW_REC *window, LINE_REC *line);
-
-void textbuffer_reformat_init(void);
-void textbuffer_reformat_deinit(void);
-
-#endif
diff --git a/src/fe-text/textbuffer-view.c b/src/fe-text/textbuffer-view.c
index 9960911c..135c5323 100644
--- a/src/fe-text/textbuffer-view.c
+++ b/src/fe-text/textbuffer-view.c
@@ -189,7 +189,7 @@ view_update_line_cache(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line)
cmd = *ptr;
ptr++;
- if (cmd == LINE_CMD_EOL || cmd == LINE_CMD_FORMAT)
+ if (cmd == LINE_CMD_EOL)
break;
if (cmd == LINE_CMD_CONTINUE) {
@@ -419,7 +419,7 @@ static int view_line_draw(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line,
if (*text == '\0') {
/* command */
text++;
- if (*text == LINE_CMD_EOL || *text == LINE_CMD_FORMAT)
+ if (*text == LINE_CMD_EOL)
break;
if (*text == LINE_CMD_CONTINUE) {
diff --git a/src/fe-text/textbuffer.c b/src/fe-text/textbuffer.c
index 06c7e1ce..a8fed004 100644
--- a/src/fe-text/textbuffer.c
+++ b/src/fe-text/textbuffer.c
@@ -403,7 +403,7 @@ void textbuffer_line2text(LINE_REC *line, int coloring, GString *str)
cmd = *ptr;
ptr++;
- if (cmd == LINE_CMD_EOL || cmd == LINE_CMD_FORMAT) {
+ if (cmd == LINE_CMD_EOL) {
/* end of line */
break;
}
diff --git a/src/fe-text/textbuffer.h b/src/fe-text/textbuffer.h
index 52935981..e3b8f1f4 100644
--- a/src/fe-text/textbuffer.h
+++ b/src/fe-text/textbuffer.h
@@ -16,11 +16,6 @@ enum {
LINE_CMD_REVERSE, /* enable/disable reversed text */
LINE_CMD_INDENT, /* if line is split, indent it at this position */
LINE_CMD_INDENT_FUNC, /* if line is split, use the specified indentation function */
- LINE_CMD_FORMAT, /* end of line, but next will come the format that was used to create the
- text in format <module><format_name><arg><arg2...> - fields are separated
- with \0<format> and last argument ends with \0<eol>. \0<continue> is allowed
- anywhere */
- LINE_CMD_FORMAT_CONT, /* multiline format, continues to next line */
LINE_CMD_BLINK, /* enable/disable blink */
LINE_CMD_BOLD, /* enable/disable bold */
};