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

long word handling fixes

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@799 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-10-29 19:03:19 +00:00 committed by cras
parent 78064ed161
commit ae06c90be1

View File

@ -255,7 +255,8 @@ void gui_window_newline(GUI_WINDOW_REC *gui, int visible)
} }
} }
static LINE_CACHE_REC *gui_window_line_cache(GUI_WINDOW_REC *gui, LINE_REC *line) static LINE_CACHE_REC *gui_window_line_cache(GUI_WINDOW_REC *gui,
LINE_REC *line)
{ {
LINE_CACHE_REC *rec; LINE_CACHE_REC *rec;
LINE_CACHE_SUB_REC *sub; LINE_CACHE_SUB_REC *sub;
@ -269,7 +270,7 @@ static LINE_CACHE_REC *gui_window_line_cache(GUI_WINDOW_REC *gui, LINE_REC *line
rec->last_access = time(NULL); rec->last_access = time(NULL);
xpos = 0; color = 0; indent_pos = default_indent_pos; xpos = 0; color = 0; indent_pos = default_indent_pos;
last_space = last_color = 0; last_space_ptr = NULL; last_space = last_color = 0; last_space_ptr = NULL; sub = NULL;
rec->count = 1; lines = NULL; rec->count = 1; lines = NULL;
for (ptr = (unsigned char *) line->text;;) { for (ptr = (unsigned char *) line->text;;) {
@ -317,6 +318,13 @@ static LINE_CACHE_REC *gui_window_line_cache(GUI_WINDOW_REC *gui, LINE_REC *line
continue; continue;
} }
if (xpos == COLS && sub != NULL &&
(last_space <= indent_pos || last_space <= 10)) {
/* long word, remove the indentation from this line */
xpos -= sub->indent;
sub->indent = 0;
}
if (xpos == COLS) { if (xpos == COLS) {
xpos = indent_pos; xpos = indent_pos;
@ -399,7 +407,7 @@ int gui_window_get_linecount(GUI_WINDOW_REC *gui, LINE_REC *line)
static void single_line_draw(GUI_WINDOW_REC *gui, int ypos, static void single_line_draw(GUI_WINDOW_REC *gui, int ypos,
LINE_CACHE_SUB_REC *rec, const char *text, LINE_CACHE_SUB_REC *rec, const char *text,
const char *text_end, int continues) const char *text_end)
{ {
WINDOW *cwin; WINDOW *cwin;
char *tmp; char *tmp;
@ -418,7 +426,7 @@ static void single_line_draw(GUI_WINDOW_REC *gui, int ypos,
cwin = stdscr; cwin = stdscr;
ypos += gui->parent->first_line; ypos += gui->parent->first_line;
#endif #endif
if (!continues) wmove(cwin, ypos, xpos); wmove(cwin, ypos, xpos);
set_color(cwin, color); set_color(cwin, color);
while (text != text_end) { while (text != text_end) {
@ -499,8 +507,7 @@ int gui_window_line_draw(GUI_WINDOW_REC *gui, LINE_REC *line, int ypos, int skip
next_pos = (n+1 < cache->count) ? next_pos = (n+1 < cache->count) ?
cache->lines[n].start : NULL; 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 #ifdef USE_CURSES_WINDOWS
@ -558,7 +565,7 @@ void gui_window_redraw(WINDOW_REC *window)
static void gui_window_scroll_up(GUI_WINDOW_REC *gui, int lines) static void gui_window_scroll_up(GUI_WINDOW_REC *gui, int lines)
{ {
LINE_REC *line; LINE_REC *line;
gint count, linecount; int count, linecount;
if (gui->startline == NULL) if (gui->startline == NULL)
return; return;