1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

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
This commit is contained in:
Timo Sirainen 2000-10-29 00:35:28 +00:00 committed by cras
parent 73858a2e5e
commit 78064ed161
2 changed files with 20 additions and 7 deletions

View File

@ -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;
}

View File

@ -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 {