1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-30 14:56:39 +02:00

Added read marker (indicator for first unread line), added quotes and spaces in config files

This commit is contained in:
Sebastien Helleu
2005-11-19 22:08:46 +00:00
parent 967d436a1d
commit d5affecc23
32 changed files with 3782 additions and 3254 deletions
+33
View File
@@ -1228,6 +1228,7 @@ int
gui_display_line (t_gui_window *window, t_gui_line *line, int count, int simulate)
{
int num_lines, x, y, lines_displayed;
int read_marker_x, read_marker_y;
int word_start_offset, word_end_offset;
int word_length_with_spaces, word_length;
int skip_spaces;
@@ -1253,6 +1254,18 @@ gui_display_line (t_gui_window *window, t_gui_line *line, int count, int simulat
window->win_chat_cursor_y = y;
}
/* calculate marker position (maybe not used for this line!) */
if (line->ofs_after_date > 0)
{
saved_char = line->data[line->ofs_after_date - 1];
line->data[line->ofs_after_date - 1] = '\0';
read_marker_x = x + gui_word_strlen (NULL, line->data);
line->data[line->ofs_after_date - 1] = saved_char;
}
else
read_marker_x = x;
read_marker_y = y;
/* reset color & style for a new line */
gui_window_chat_reset_style (window);
@@ -1342,6 +1355,18 @@ gui_display_line (t_gui_window *window, t_gui_line *line, int count, int simulat
window->win_chat_cursor_x = x;
window->win_chat_cursor_y = y;
}
else
{
/* display read marker if needed */
if (cfg_look_read_marker && cfg_look_read_marker[0] &&
window->buffer->last_read_line &&
(window->buffer->last_read_line == line->prev_line))
{
gui_window_chat_set_weechat_color (window, COLOR_WIN_CHAT_MARKER);
mvwprintw (window->win_chat, read_marker_y, read_marker_x,
"%c", cfg_look_read_marker[0]);
}
}
return lines_displayed;
}
@@ -2503,6 +2528,13 @@ gui_switch_to_buffer (t_gui_window *window, t_gui_buffer *buffer)
if (window->buffer->num_displayed > 0)
window->buffer->num_displayed--;
if (window->buffer != buffer)
{
window->buffer->last_read_line = window->buffer->last_line;
if (buffer->last_read_line == buffer->last_line)
buffer->last_read_line = NULL;
}
window->buffer = buffer;
window->win_nick_start = 0;
gui_calculate_pos_size (window);
@@ -3129,6 +3161,7 @@ gui_init_weechat_colors ()
gui_color[COLOR_WIN_CHAT_CHANNEL] = gui_color_build (COLOR_WIN_CHAT_CHANNEL, cfg_col_chat_channel, cfg_col_chat_bg);
gui_color[COLOR_WIN_CHAT_DARK] = gui_color_build (COLOR_WIN_CHAT_DARK, cfg_col_chat_dark, cfg_col_chat_bg);
gui_color[COLOR_WIN_CHAT_HIGHLIGHT] = gui_color_build (COLOR_WIN_CHAT_HIGHLIGHT, cfg_col_chat_highlight, cfg_col_chat_bg);
gui_color[COLOR_WIN_CHAT_MARKER] = gui_color_build (COLOR_WIN_CHAT_MARKER, cfg_col_chat_marker, cfg_col_chat_marker_bg);
gui_color[COLOR_WIN_STATUS] = gui_color_build (COLOR_WIN_STATUS, cfg_col_status, cfg_col_status_bg);
gui_color[COLOR_WIN_STATUS_DELIMITERS] = gui_color_build (COLOR_WIN_STATUS_DELIMITERS, cfg_col_status_delimiters, cfg_col_status_bg);
gui_color[COLOR_WIN_STATUS_CHANNEL] = gui_color_build (COLOR_WIN_STATUS_CHANNEL, cfg_col_status_channel, cfg_col_status_bg);
+43 -39
View File
@@ -362,6 +362,7 @@ gui_buffer_new (t_gui_window *window, void *server, void *channel, int dcc,
/* init lines */
new_buffer->lines = NULL;
new_buffer->last_line = NULL;
new_buffer->last_read_line = NULL;
new_buffer->num_lines = 0;
new_buffer->line_complete = 1;
@@ -857,66 +858,68 @@ gui_printf_internal (t_gui_buffer *buffer, int display_time, int type, char *mes
pos = buf2 - 1;
while (pos)
{
if (display_time
&& cfg_look_buffer_timestamp && cfg_look_buffer_timestamp[0]
&& ((!buffer->last_line) || (buffer->line_complete)))
if ((!buffer->last_line) || (buffer->line_complete))
{
time_seconds = time (NULL);
local_time = localtime (&time_seconds);
strftime (text_time, sizeof (text_time), cfg_look_buffer_timestamp, local_time);
time_first_digit = -1;
time_last_digit = -1;
i = 0;
while (text_time[i])
if (display_time && cfg_look_buffer_timestamp &&
cfg_look_buffer_timestamp[0])
{
if (isdigit (text_time[i]))
time_seconds = time (NULL);
local_time = localtime (&time_seconds);
strftime (text_time, sizeof (text_time), cfg_look_buffer_timestamp, local_time);
time_first_digit = -1;
time_last_digit = -1;
i = 0;
while (text_time[i])
{
if (time_first_digit == -1)
time_first_digit = i;
time_last_digit = i;
if (isdigit (text_time[i]))
{
if (time_first_digit == -1)
time_first_digit = i;
time_last_digit = i;
}
i++;
}
i++;
}
text_time_char[1] = '\0';
i = 0;
while (text_time[i])
{
text_time_char[0] = text_time[i];
if (time_first_digit < 0)
text_time_char[1] = '\0';
i = 0;
while (text_time[i])
{
gui_add_to_line (buffer, MSG_TYPE_TIME,
GUI_COLOR(COLOR_WIN_CHAT_TIME));
gui_add_to_line (buffer, MSG_TYPE_TIME, text_time_char);
}
else
{
if ((i < time_first_digit) || (i > time_last_digit))
text_time_char[0] = text_time[i];
if (time_first_digit < 0)
{
gui_add_to_line (buffer, MSG_TYPE_TIME,
GUI_COLOR(COLOR_WIN_CHAT_DARK));
GUI_COLOR(COLOR_WIN_CHAT_TIME));
gui_add_to_line (buffer, MSG_TYPE_TIME, text_time_char);
}
else
{
if (isdigit (text_time[i]))
if ((i < time_first_digit) || (i > time_last_digit))
{
gui_add_to_line (buffer, MSG_TYPE_TIME,
GUI_COLOR(COLOR_WIN_CHAT_TIME));
GUI_COLOR(COLOR_WIN_CHAT_DARK));
gui_add_to_line (buffer, MSG_TYPE_TIME, text_time_char);
}
else
{
gui_add_to_line (buffer, MSG_TYPE_TIME,
GUI_COLOR(COLOR_WIN_CHAT_TIME_SEP));
gui_add_to_line (buffer, MSG_TYPE_TIME, text_time_char);
if (isdigit (text_time[i]))
{
gui_add_to_line (buffer, MSG_TYPE_TIME,
GUI_COLOR(COLOR_WIN_CHAT_TIME));
gui_add_to_line (buffer, MSG_TYPE_TIME, text_time_char);
}
else
{
gui_add_to_line (buffer, MSG_TYPE_TIME,
GUI_COLOR(COLOR_WIN_CHAT_TIME_SEP));
gui_add_to_line (buffer, MSG_TYPE_TIME, text_time_char);
}
}
}
i++;
}
i++;
gui_add_to_line (buffer, MSG_TYPE_TIME, GUI_COLOR(COLOR_WIN_CHAT));
}
gui_add_to_line (buffer, MSG_TYPE_TIME, GUI_COLOR(COLOR_WIN_CHAT));
gui_add_to_line (buffer, MSG_TYPE_TIME, " ");
}
gui_add_to_line (buffer, type, pos + 1);
@@ -1611,6 +1614,7 @@ gui_buffer_print_log (t_gui_buffer *buffer)
wee_log_printf (" dcc. . . . . . . . . : %d\n", buffer->dcc);
wee_log_printf (" lines. . . . . . . . : 0x%X\n", buffer->lines);
wee_log_printf (" last_line. . . . . . : 0x%X\n", buffer->last_line);
wee_log_printf (" last_read_line . . . : 0x%X\n", buffer->last_read_line);
wee_log_printf (" num_lines. . . . . . : %d\n", buffer->num_lines);
wee_log_printf (" line_complete. . . . : %d\n", buffer->line_complete);
wee_log_printf (" notify_level . . . . : %d\n", buffer->notify_level);
+2
View File
@@ -58,6 +58,7 @@ enum t_weechat_color
COLOR_WIN_CHAT_CHANNEL,
COLOR_WIN_CHAT_DARK,
COLOR_WIN_CHAT_HIGHLIGHT,
COLOR_WIN_CHAT_MARKER,
COLOR_WIN_STATUS,
COLOR_WIN_STATUS_DELIMITERS,
COLOR_WIN_STATUS_CHANNEL,
@@ -228,6 +229,7 @@ struct t_gui_buffer
/* chat content (lines, line is composed by many messages) */
t_gui_line *lines; /* lines of chat window */
t_gui_line *last_line; /* last line of chat window */
t_gui_line *last_read_line; /* last read line before jump */
int num_lines; /* number of lines in the window */
int line_complete; /* current line complete ? (\n ending) */