Mercurial > ~mikael > mcabber > hg
comparison mcabber/mcabber/screen.c @ 1965:ec737f5f1d6f
Couple of readmark-related bugfixes
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Fri, 18 Mar 2011 12:29:57 +0100 |
parents | 39021fd6b0e1 |
children | 83d7c7daea6a |
comparison
equal
deleted
inserted
replaced
1964:306ddec07d63 | 1965:ec737f5f1d6f |
---|---|
1054 g_free(id); | 1054 g_free(id); |
1055 } else { // Load buddy history from file (if enabled) | 1055 } else { // Load buddy history from file (if enabled) |
1056 tmp->bd = g_new0(buffdata, 1); | 1056 tmp->bd = g_new0(buffdata, 1); |
1057 hlog_read_history(title, &tmp->bd->hbuf, | 1057 hlog_read_history(title, &tmp->bd->hbuf, |
1058 maxX - Roster_Width - scr_getprefixwidth()); | 1058 maxX - Roster_Width - scr_getprefixwidth()); |
1059 | |
1060 // Set a readmark to separate new content | |
1061 hbuf_set_readmark(tmp->bd->hbuf, TRUE); | |
1059 } | 1062 } |
1060 | 1063 |
1061 id = g_strdup(title); | 1064 id = g_strdup(title); |
1062 mc_strtolower(id); | 1065 mc_strtolower(id); |
1063 g_hash_table_insert(winbufhash, id, tmp); | 1066 g_hash_table_insert(winbufhash, id, tmp); |
1135 int n, mark_offset = 0; | 1138 int n, mark_offset = 0; |
1136 guint prefixwidth; | 1139 guint prefixwidth; |
1137 char pref[96]; | 1140 char pref[96]; |
1138 hbb_line **lines, *line; | 1141 hbb_line **lines, *line; |
1139 GList *hbuf_head; | 1142 GList *hbuf_head; |
1140 int color; | 1143 int color = COLOR_GENERAL; |
1141 bool readmark = FALSE; | 1144 bool readmark = FALSE; |
1142 bool skipline = FALSE; | 1145 bool skipline = FALSE; |
1143 | 1146 |
1144 prefixwidth = scr_getprefixwidth(); | 1147 prefixwidth = scr_getprefixwidth(); |
1145 prefixwidth = MIN(prefixwidth, sizeof pref); | 1148 prefixwidth = MIN(prefixwidth, sizeof pref); |
1283 | 1286 |
1284 // Display text line | 1287 // Display text line |
1285 wprintw(win_entry->win, "%s", line->text+line->mucnicklen); | 1288 wprintw(win_entry->win, "%s", line->text+line->mucnicklen); |
1286 wclrtoeol(win_entry->win); | 1289 wclrtoeol(win_entry->win); |
1287 | 1290 |
1288 // Return the color back | |
1289 if (color != COLOR_GENERAL) | |
1290 wattrset(win_entry->win, get_color(COLOR_GENERAL)); | |
1291 | |
1292 scr_update_window_skipline: | 1291 scr_update_window_skipline: |
1293 skipline = FALSE; | 1292 skipline = FALSE; |
1294 if (readmark && line->flags & HBB_PREFIX_READMARK) { | 1293 if (readmark && line->flags & HBB_PREFIX_READMARK) { |
1295 int i, w; | 1294 int i, w; |
1296 mark_offset++; | 1295 mark_offset++; |
1297 | 1296 |
1298 // Display the mark | 1297 // Display the mark |
1299 winy = n + mark_offset; | 1298 winy = n + mark_offset; |
1300 wmove(win_entry->win, winy, 0); | 1299 wmove(win_entry->win, winy, 0); |
1301 wattrset(win_entry->win, get_color(COLOR_READMARK)); | 1300 color = COLOR_READMARK; |
1301 wattrset(win_entry->win, get_color(color)); | |
1302 g_snprintf(pref, prefixwidth, " == "); | 1302 g_snprintf(pref, prefixwidth, " == "); |
1303 wprintw(win_entry->win, pref); | 1303 wprintw(win_entry->win, pref); |
1304 w = scr_gettextwidth() / 3; | 1304 w = scr_gettextwidth() / 3; |
1305 for (i=0; i<w; i++) | 1305 for (i=0; i<w; i++) |
1306 wprintw(win_entry->win, "== "); | 1306 wprintw(win_entry->win, "== "); |
1307 wclrtoeol(win_entry->win); | 1307 wclrtoeol(win_entry->win); |
1308 wattrset(win_entry->win, get_color(COLOR_GENERAL)); | 1308 wattrset(win_entry->win, get_color(COLOR_GENERAL)); |
1309 } | 1309 } |
1310 | |
1311 // Restore default ("general") color | |
1312 if (color != COLOR_GENERAL) | |
1313 wattrset(win_entry->win, get_color(COLOR_GENERAL)); | |
1310 | 1314 |
1311 g_free(line->text); | 1315 g_free(line->text); |
1312 g_free(line); | 1316 g_free(line); |
1313 } else { | 1317 } else { |
1314 wclrtobot(win_entry->win); | 1318 wclrtobot(win_entry->win); |