mirror of
https://github.com/weechat/weechat.git
synced 2026-07-10 11:43:13 +02:00
Added option to align text of messages (except first lines) (task #7246)
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2007-08-23
|
||||
ChangeLog - 2007-08-27
|
||||
|
||||
|
||||
Version 0.2.6 (under dev!):
|
||||
* added option to align text of messages (except first lines) (task #7246)
|
||||
* fixed user modes in nicklist when ban and nick mode are received in the
|
||||
same MODE message (bug #20870)
|
||||
* fixed IRC message 333: silently ignore message if error when parsing it
|
||||
|
||||
+301
-290
File diff suppressed because it is too large
Load Diff
@@ -95,6 +95,7 @@ char *cfg_look_align_nick_values[] =
|
||||
int cfg_look_align_other;
|
||||
int cfg_look_align_size;
|
||||
int cfg_look_align_size_max;
|
||||
int cfg_look_align_text_offset;
|
||||
char *cfg_look_nick_completor;
|
||||
char *cfg_look_nick_completion_ignore;
|
||||
int cfg_look_nick_completion_smart;
|
||||
@@ -221,6 +222,13 @@ t_config_option weechat_options_look[] =
|
||||
"look_align_size)"),
|
||||
OPTION_TYPE_INT, 8, 64, 20,
|
||||
NULL, NULL, &cfg_look_align_size_max, NULL, config_change_noop },
|
||||
{ "look_align_text_offset", N_("offset for aligning lines of messages "
|
||||
"(except first lines)"),
|
||||
N_("offset for aligning lines of messages (except first lines), default is "
|
||||
"-1 (align after nick), a null or positive value is offset after "
|
||||
"beginning of line"),
|
||||
OPTION_TYPE_INT, -1, 64, -1,
|
||||
NULL, NULL, &cfg_look_align_text_offset, NULL, config_change_buffers },
|
||||
{ "look_nick_completor", N_("the string inserted after nick completion"),
|
||||
N_("the string inserted after nick completion"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
|
||||
@@ -118,6 +118,7 @@ extern int cfg_look_align_nick;
|
||||
extern int cfg_look_align_other;
|
||||
extern int cfg_look_align_size;
|
||||
extern int cfg_look_align_size_max;
|
||||
extern int cfg_look_align_text_offset;
|
||||
extern char *cfg_look_nick_completor;
|
||||
extern char *cfg_look_nick_completion_ignore;
|
||||
extern int cfg_look_nick_completion_smart;
|
||||
|
||||
@@ -523,6 +523,7 @@ gui_chat_display_word (t_gui_window *window,
|
||||
{
|
||||
char *end_line, saved_char_end, saved_char;
|
||||
int pos_saved_char, chars_to_display, num_displayed;
|
||||
int length_align;
|
||||
|
||||
if (!data ||
|
||||
((!simulate) && (window->win_chat_cursor_y >= window->win_chat_height)))
|
||||
@@ -544,11 +545,12 @@ gui_chat_display_word (t_gui_window *window,
|
||||
while (data && data[0])
|
||||
{
|
||||
/* insert spaces for align text under time/nick */
|
||||
if ((line->length_align > 0) &&
|
||||
length_align = GUI_LINE_LENGTH_ALIGN(line);
|
||||
if ((length_align > 0) &&
|
||||
(window->win_chat_cursor_x == 0) &&
|
||||
(*lines_displayed > 0) &&
|
||||
/* TODO: modify arbitraty value for non aligning messages on time/nick? */
|
||||
(line->length_align < (window->win_chat_width - 5)))
|
||||
(length_align < (window->win_chat_width - 5)))
|
||||
{
|
||||
if (!simulate)
|
||||
{
|
||||
@@ -557,7 +559,7 @@ gui_chat_display_word (t_gui_window *window,
|
||||
window->win_chat_cursor_x);
|
||||
wclrtoeol (GUI_CURSES(window)->win_chat);
|
||||
}
|
||||
window->win_chat_cursor_x += line->length_align;
|
||||
window->win_chat_cursor_x += length_align;
|
||||
}
|
||||
|
||||
chars_to_display = gui_word_strlen (window, data);
|
||||
@@ -743,7 +745,7 @@ gui_chat_display_line (t_gui_window *window, t_gui_line *line, int count,
|
||||
{
|
||||
/* spaces + word too long for current line but ok for next line */
|
||||
if ((window->win_chat_cursor_x + word_length_with_spaces > gui_chat_get_real_width (window))
|
||||
&& (word_length <= gui_chat_get_real_width (window) - line->length_align))
|
||||
&& (word_length <= gui_chat_get_real_width (window) - GUI_LINE_LENGTH_ALIGN(line)))
|
||||
{
|
||||
gui_chat_display_new_line (window, num_lines, count,
|
||||
&lines_displayed, simulate);
|
||||
|
||||
@@ -27,17 +27,20 @@
|
||||
#define GUI_BUFFER_TYPE_DCC 1
|
||||
#define GUI_BUFFER_TYPE_RAW_DATA 2
|
||||
|
||||
#define GUI_SERVER(buffer) ((t_irc_server *)(buffer->server))
|
||||
#define GUI_CHANNEL(buffer) ((t_irc_channel *)(buffer->channel))
|
||||
#define GUI_SERVER(buffer) ((t_irc_server *)(buffer->server))
|
||||
#define GUI_CHANNEL(buffer) ((t_irc_channel *)(buffer->channel))
|
||||
|
||||
#define GUI_BUFFER_IS_SERVER(buffer) ((GUI_SERVER(buffer) || (buffer->all_servers)) && !GUI_CHANNEL(buffer))
|
||||
#define GUI_BUFFER_IS_CHANNEL(buffer) (GUI_CHANNEL(buffer) && (GUI_CHANNEL(buffer)->type == IRC_CHANNEL_TYPE_CHANNEL))
|
||||
#define GUI_BUFFER_IS_PRIVATE(buffer) (GUI_CHANNEL(buffer) && \
|
||||
#define GUI_BUFFER_IS_PRIVATE(buffer) (GUI_CHANNEL(buffer) && \
|
||||
((GUI_CHANNEL(buffer)->type == IRC_CHANNEL_TYPE_PRIVATE) \
|
||||
|| (GUI_CHANNEL(buffer)->type == IRC_CHANNEL_TYPE_DCC_CHAT)))
|
||||
|
||||
#define GUI_BUFFER_HAS_NICKLIST(buffer) (GUI_BUFFER_IS_CHANNEL(buffer))
|
||||
|
||||
#define GUI_LINE_LENGTH_ALIGN(line) ((cfg_look_align_text_offset >= 0) ? \
|
||||
cfg_look_align_text_offset : line->length_align)
|
||||
|
||||
#define GUI_MSG_TYPE_TIME 1
|
||||
#define GUI_MSG_TYPE_PREFIX 2
|
||||
#define GUI_MSG_TYPE_NICK 4
|
||||
|
||||
+2
-1
@@ -1,10 +1,11 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2007-08-23
|
||||
ChangeLog - 2007-08-27
|
||||
|
||||
|
||||
Version 0.2.6 (under dev!):
|
||||
* added option to align text of messages (except first lines) (task #7246)
|
||||
* fixed user modes in nicklist when ban and nick mode are received in the
|
||||
same MODE message (bug #20870)
|
||||
* fixed IRC message 333: silently ignore message if error when parsing it
|
||||
|
||||
+301
-290
File diff suppressed because it is too large
Load Diff
+301
-290
File diff suppressed because it is too large
Load Diff
+301
-290
File diff suppressed because it is too large
Load Diff
+302
-291
File diff suppressed because it is too large
Load Diff
+301
-290
File diff suppressed because it is too large
Load Diff
+301
-290
File diff suppressed because it is too large
Load Diff
+301
-290
File diff suppressed because it is too large
Load Diff
@@ -95,6 +95,7 @@ char *cfg_look_align_nick_values[] =
|
||||
int cfg_look_align_other;
|
||||
int cfg_look_align_size;
|
||||
int cfg_look_align_size_max;
|
||||
int cfg_look_align_text_offset;
|
||||
char *cfg_look_nick_completor;
|
||||
char *cfg_look_nick_completion_ignore;
|
||||
int cfg_look_nick_completion_smart;
|
||||
@@ -221,6 +222,13 @@ t_config_option weechat_options_look[] =
|
||||
"look_align_size)"),
|
||||
OPTION_TYPE_INT, 8, 64, 20,
|
||||
NULL, NULL, &cfg_look_align_size_max, NULL, config_change_noop },
|
||||
{ "look_align_text_offset", N_("offset for aligning lines of messages "
|
||||
"(except first lines)"),
|
||||
N_("offset for aligning lines of messages (except first lines), default is "
|
||||
"-1 (align after nick), a null or positive value is offset after "
|
||||
"beginning of line"),
|
||||
OPTION_TYPE_INT, -1, 64, -1,
|
||||
NULL, NULL, &cfg_look_align_text_offset, NULL, config_change_buffers },
|
||||
{ "look_nick_completor", N_("the string inserted after nick completion"),
|
||||
N_("the string inserted after nick completion"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
|
||||
@@ -118,6 +118,7 @@ extern int cfg_look_align_nick;
|
||||
extern int cfg_look_align_other;
|
||||
extern int cfg_look_align_size;
|
||||
extern int cfg_look_align_size_max;
|
||||
extern int cfg_look_align_text_offset;
|
||||
extern char *cfg_look_nick_completor;
|
||||
extern char *cfg_look_nick_completion_ignore;
|
||||
extern int cfg_look_nick_completion_smart;
|
||||
|
||||
@@ -523,6 +523,7 @@ gui_chat_display_word (t_gui_window *window,
|
||||
{
|
||||
char *end_line, saved_char_end, saved_char;
|
||||
int pos_saved_char, chars_to_display, num_displayed;
|
||||
int length_align;
|
||||
|
||||
if (!data ||
|
||||
((!simulate) && (window->win_chat_cursor_y >= window->win_chat_height)))
|
||||
@@ -544,11 +545,12 @@ gui_chat_display_word (t_gui_window *window,
|
||||
while (data && data[0])
|
||||
{
|
||||
/* insert spaces for align text under time/nick */
|
||||
if ((line->length_align > 0) &&
|
||||
length_align = GUI_LINE_LENGTH_ALIGN(line);
|
||||
if ((length_align > 0) &&
|
||||
(window->win_chat_cursor_x == 0) &&
|
||||
(*lines_displayed > 0) &&
|
||||
/* TODO: modify arbitraty value for non aligning messages on time/nick? */
|
||||
(line->length_align < (window->win_chat_width - 5)))
|
||||
(length_align < (window->win_chat_width - 5)))
|
||||
{
|
||||
if (!simulate)
|
||||
{
|
||||
@@ -557,7 +559,7 @@ gui_chat_display_word (t_gui_window *window,
|
||||
window->win_chat_cursor_x);
|
||||
wclrtoeol (GUI_CURSES(window)->win_chat);
|
||||
}
|
||||
window->win_chat_cursor_x += line->length_align;
|
||||
window->win_chat_cursor_x += length_align;
|
||||
}
|
||||
|
||||
chars_to_display = gui_word_strlen (window, data);
|
||||
@@ -743,7 +745,7 @@ gui_chat_display_line (t_gui_window *window, t_gui_line *line, int count,
|
||||
{
|
||||
/* spaces + word too long for current line but ok for next line */
|
||||
if ((window->win_chat_cursor_x + word_length_with_spaces > gui_chat_get_real_width (window))
|
||||
&& (word_length <= gui_chat_get_real_width (window) - line->length_align))
|
||||
&& (word_length <= gui_chat_get_real_width (window) - GUI_LINE_LENGTH_ALIGN(line)))
|
||||
{
|
||||
gui_chat_display_new_line (window, num_lines, count,
|
||||
&lines_displayed, simulate);
|
||||
|
||||
@@ -27,17 +27,20 @@
|
||||
#define GUI_BUFFER_TYPE_DCC 1
|
||||
#define GUI_BUFFER_TYPE_RAW_DATA 2
|
||||
|
||||
#define GUI_SERVER(buffer) ((t_irc_server *)(buffer->server))
|
||||
#define GUI_CHANNEL(buffer) ((t_irc_channel *)(buffer->channel))
|
||||
#define GUI_SERVER(buffer) ((t_irc_server *)(buffer->server))
|
||||
#define GUI_CHANNEL(buffer) ((t_irc_channel *)(buffer->channel))
|
||||
|
||||
#define GUI_BUFFER_IS_SERVER(buffer) ((GUI_SERVER(buffer) || (buffer->all_servers)) && !GUI_CHANNEL(buffer))
|
||||
#define GUI_BUFFER_IS_CHANNEL(buffer) (GUI_CHANNEL(buffer) && (GUI_CHANNEL(buffer)->type == IRC_CHANNEL_TYPE_CHANNEL))
|
||||
#define GUI_BUFFER_IS_PRIVATE(buffer) (GUI_CHANNEL(buffer) && \
|
||||
#define GUI_BUFFER_IS_PRIVATE(buffer) (GUI_CHANNEL(buffer) && \
|
||||
((GUI_CHANNEL(buffer)->type == IRC_CHANNEL_TYPE_PRIVATE) \
|
||||
|| (GUI_CHANNEL(buffer)->type == IRC_CHANNEL_TYPE_DCC_CHAT)))
|
||||
|
||||
#define GUI_BUFFER_HAS_NICKLIST(buffer) (GUI_BUFFER_IS_CHANNEL(buffer))
|
||||
|
||||
#define GUI_LINE_LENGTH_ALIGN(line) ((cfg_look_align_text_offset >= 0) ? \
|
||||
cfg_look_align_text_offset : line->length_align)
|
||||
|
||||
#define GUI_MSG_TYPE_TIME 1
|
||||
#define GUI_MSG_TYPE_PREFIX 2
|
||||
#define GUI_MSG_TYPE_NICK 4
|
||||
|
||||
Reference in New Issue
Block a user