summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-10-29 00:35:28 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-10-29 00:35:28 +0000
commit78064ed161f468d5c176e7307bb73f04e34f0255 (patch)
tree8e2efbdcf10216c4637a2f159565270357b9e894 /src
parent73858a2e5e640c5e5ad28577a6474e4163df32e7 (diff)
downloadirssi-78064ed161f468d5c176e7307bb73f04e34f0255.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/fe-text/gui-windows.c26
-rw-r--r--src/fe-text/gui-windows.h1
2 files changed, 20 insertions, 7 deletions
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 {