summaryrefslogtreecommitdiff
path: root/src/fe-text/textbuffer.c
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-07-15 00:39:48 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-07-15 00:39:48 +0000
commit79d1d7089a699cf8a09bd5227f9033282001b0b3 (patch)
tree11a2e10bce84587e2b5a13029c43354a185e846c /src/fe-text/textbuffer.c
parentbcbb55dd1e0ecf828942dcc91d5661e9a44ab841 (diff)
downloadirssi-79d1d7089a699cf8a09bd5227f9033282001b0b3.zip
Added --home and --config command line parameters to irssi to specify
locations for ~/.irssi and ~/.irssi/config git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1626 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-text/textbuffer.c')
-rw-r--r--src/fe-text/textbuffer.c168
1 files changed, 0 insertions, 168 deletions
diff --git a/src/fe-text/textbuffer.c b/src/fe-text/textbuffer.c
index 06cb2fe9..3c11aea3 100644
--- a/src/fe-text/textbuffer.c
+++ b/src/fe-text/textbuffer.c
@@ -462,174 +462,6 @@ GList *textbuffer_find_text(TEXT_BUFFER_REC *buffer, LINE_REC *startline,
return matches;
}
-#if 0 /* FIXME: saving formats is broken */
-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 */
- g_free(line_read_format(&text));
- if (text[1] == LINE_CMD_FORMAT_CONT) {
- 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->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;
- 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_line_remove(window, line, FALSE);
- } else if (str != NULL) {
- /* FIXME: ugly ugly .. and this can't handle
- non-formatted lines.. */
- g_string_append_c(raw, '\0');
- g_string_append_c(raw, (char)LINE_CMD_EOL);
-
- textbuffer_line_text_free(gui, line);
-
- gui->temp_line = line;
- gui->temp_line->text = gui->cur_text->buffer+gui->cur_text->pos;
- gui->cur_text->lines++;
- gui->eol_marked = FALSE;
-
- format_create_dest(&dest, NULL, NULL, line->level, window);
-
- linestart = format_get_line_start(current_theme, &dest, line->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);
-
- format_send_to_gui(&dest, tmp);
- g_free(tmp);
-
- textbuffer_line_append(gui, raw->str, raw->len);
-
- gui->eol_marked = TRUE;
- gui->temp_line = NULL;
- }
- g_string_free(raw, TRUE);
-}
-#endif
-
void textbuffer_init(void)
{
buffer_chunk = g_mem_chunk_new("text buffer chunk",