From 78064ed161f468d5c176e7307bb73f04e34f0255 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sun, 29 Oct 2000 00:35:28 +0000 Subject: Don't indent the next line when long word is split. Also we try not to do any cursor movement so that terminals could notice that the word continues to next line .. however terminfo or curses or something is being stupid and breaks this anyway, with TERM=ansi it seems to work :) also using gnome-terminal long URLs work right too. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@798 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/fe-text/gui-windows.c | 26 +++++++++++++++++++------- src/fe-text/gui-windows.h | 1 + 2 files changed, 20 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/fe-text/gui-windows.c b/src/fe-text/gui-windows.c index 7ccb5fbb..f73a3b88 100644 --- a/src/fe-text/gui-windows.c +++ b/src/fe-text/gui-windows.c @@ -320,16 +320,20 @@ static LINE_CACHE_REC *gui_window_line_cache(GUI_WINDOW_REC *gui, LINE_REC *line if (xpos == COLS) { xpos = indent_pos; + sub = g_new(LINE_CACHE_SUB_REC, 1); if (last_space > indent_pos && last_space > 10) { /* go back to last space */ color = last_color; ptr = last_space_ptr; while (*ptr == ' ') ptr++; + } else { + /* long word, no indentation in next line */ + xpos = 0; + sub->continues = TRUE; } - sub = g_new(LINE_CACHE_SUB_REC, 1); sub->start = (char *) ptr; - sub->indent = indent_pos; + sub->indent = xpos; sub->color = color; lines = g_slist_append(lines, sub); @@ -393,7 +397,9 @@ int gui_window_get_linecount(GUI_WINDOW_REC *gui, LINE_REC *line) return cache->count; } -static void single_line_draw(GUI_WINDOW_REC *gui, int ypos, LINE_CACHE_SUB_REC *rec, const char *text, const char *text_end) +static void single_line_draw(GUI_WINDOW_REC *gui, int ypos, + LINE_CACHE_SUB_REC *rec, const char *text, + const char *text_end, int continues) { WINDOW *cwin; char *tmp; @@ -412,7 +418,7 @@ static void single_line_draw(GUI_WINDOW_REC *gui, int ypos, LINE_CACHE_SUB_REC * cwin = stdscr; ypos += gui->parent->first_line; #endif - wmove(cwin, ypos, xpos); + if (!continues) wmove(cwin, ypos, xpos); set_color(cwin, color); while (text != text_end) { @@ -467,8 +473,6 @@ static void single_line_draw(GUI_WINDOW_REC *gui, int ypos, LINE_CACHE_SUB_REC * } text++; } - - screen_refresh(cwin); } int gui_window_line_draw(GUI_WINDOW_REC *gui, LINE_REC *line, int ypos, int skip, int max) @@ -494,9 +498,17 @@ int gui_window_line_draw(GUI_WINDOW_REC *gui, LINE_REC *line, int ypos, int skip pos = sub == NULL ? line->text : sub->start; next_pos = (n+1 < cache->count) ? cache->lines[n].start : NULL; - single_line_draw(gui, ypos, sub, pos, next_pos); + + single_line_draw(gui, ypos, sub, pos, next_pos, + sub != NULL && sub->continues && n != skip); } +#ifdef USE_CURSES_WINDOWS + screen_refresh(gui->parent->curses_win); +#else + screen_refresh(NULL); +#endif + return cache->count; } diff --git a/src/fe-text/gui-windows.h b/src/fe-text/gui-windows.h index 6304a05d..1600ab3b 100644 --- a/src/fe-text/gui-windows.h +++ b/src/fe-text/gui-windows.h @@ -27,6 +27,7 @@ typedef struct { char *start; int indent; int color; + int continues:1; /* first word in line belong to the end of the last word in previous line */ } LINE_CACHE_SUB_REC; typedef struct { -- cgit v1.2.3