summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2016-12-17 07:51:47 +0100
committerSébastien Helleu <flashcode@flashtux.org>2016-12-17 07:51:47 +0100
commite671e20e0c94ab2e368ead0f994ec3fe7da4b29e (patch)
treecbbffac3fd213ad9e01c2d880374b0658c27bf5d /src
parentf18a32e1605a7e08838cc19485f58e1e83b6d220 (diff)
parent592810ca1f406bd5b2dde4c3a242c5ff6efc14fc (diff)
downloadweechat-e671e20e0c94ab2e368ead0f994ec3fe7da4b29e.zip
Merge remote-tracking branch 'origin/pr/802'
Diffstat (limited to 'src')
-rw-r--r--src/core/wee-config.c9
-rw-r--r--src/core/wee-config.h1
-rw-r--r--src/gui/curses/gui-curses-chat.c60
3 files changed, 44 insertions, 26 deletions
diff --git a/src/core/wee-config.c b/src/core/wee-config.c
index 1f2e5080f..8089a0220 100644
--- a/src/core/wee-config.c
+++ b/src/core/wee-config.c
@@ -83,6 +83,7 @@ struct t_config_option *config_startup_sys_rlimit;
/* config, look & feel section */
struct t_config_option *config_look_align_end_of_lines;
+struct t_config_option *config_look_align_multiline_words;
struct t_config_option *config_look_bar_more_down;
struct t_config_option *config_look_bar_more_left;
struct t_config_option *config_look_bar_more_right;
@@ -2458,6 +2459,14 @@ config_weechat_init_options ()
NULL, NULL, NULL,
&config_change_buffers, NULL, NULL,
NULL, NULL, NULL);
+ config_look_align_multiline_words = config_file_new_option (
+ weechat_config_file, ptr_section,
+ "align_multiline_words", "boolean",
+ N_("align multiline words according to weechat.look.align_end_of_lines"),
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL,
+ &config_change_buffers, NULL, NULL,
+ NULL, NULL, NULL);
config_look_bar_more_down = config_file_new_option (
weechat_config_file, ptr_section,
"bar_more_down", "string",
diff --git a/src/core/wee-config.h b/src/core/wee-config.h
index 6682f25f1..73305d5b4 100644
--- a/src/core/wee-config.h
+++ b/src/core/wee-config.h
@@ -133,6 +133,7 @@ extern struct t_config_option *config_startup_display_version;
extern struct t_config_option *config_startup_sys_rlimit;
extern struct t_config_option *config_look_align_end_of_lines;
+extern struct t_config_option *config_look_align_multiline_words;
extern struct t_config_option *config_look_bar_more_down;
extern struct t_config_option *config_look_bar_more_left;
extern struct t_config_option *config_look_bar_more_right;
diff --git a/src/gui/curses/gui-curses-chat.c b/src/gui/curses/gui-curses-chat.c
index 350010e67..7dd2dafbd 100644
--- a/src/gui/curses/gui-curses-chat.c
+++ b/src/gui/curses/gui-curses-chat.c
@@ -490,39 +490,47 @@ gui_chat_display_word (struct t_gui_window *window,
{
/* insert spaces for aligning text under time/nick */
length_align = gui_line_get_align (window->buffer, line, 0, 0);
+
+ /* in the beginning of a line */
if ((window->win_chat_cursor_x == 0)
&& (*lines_displayed > pre_lines_displayed)
/* FIXME: modify arbitrary value for non aligning messages on time/nick? */
&& (length_align < (window->win_chat_width - 5)))
{
- window->win_chat_cursor_x += length_align;
- if ((CONFIG_INTEGER(config_look_align_end_of_lines) == CONFIG_LOOK_ALIGN_END_OF_LINES_MESSAGE)
- && (CONFIG_INTEGER(config_look_prefix_align) != CONFIG_LOOK_PREFIX_ALIGN_NONE)
- && CONFIG_STRING(config_look_prefix_suffix)
- && CONFIG_STRING(config_look_prefix_suffix)[0]
- && line->data->date > 0)
+ /* in the beginning of a word or in the middle of a word with multiline word align */
+ if ((chars_displayed == 0)
+ || CONFIG_BOOLEAN(config_look_align_multiline_words))
{
- if (!simulate)
+ window->win_chat_cursor_x += length_align;
+
+ if ((CONFIG_INTEGER(config_look_align_end_of_lines) == CONFIG_LOOK_ALIGN_END_OF_LINES_MESSAGE)
+ && (CONFIG_INTEGER(config_look_prefix_align) != CONFIG_LOOK_PREFIX_ALIGN_NONE)
+ && CONFIG_STRING(config_look_prefix_suffix)
+ && CONFIG_STRING(config_look_prefix_suffix)[0]
+ && line->data->date > 0)
{
- gui_window_save_style (GUI_WINDOW_OBJECTS(window)->win_chat);
- gui_window_set_weechat_color (GUI_WINDOW_OBJECTS(window)->win_chat,
- GUI_COLOR_CHAT_PREFIX_SUFFIX);
- gui_window_current_emphasis = 0;
+ if (!simulate)
+ {
+ gui_window_save_style (GUI_WINDOW_OBJECTS(window)->win_chat);
+ gui_window_set_weechat_color (GUI_WINDOW_OBJECTS(window)->win_chat,
+ GUI_COLOR_CHAT_PREFIX_SUFFIX);
+ gui_window_current_emphasis = 0;
+ }
+ chars_displayed += gui_chat_display_word_raw (window, line,
+ CONFIG_STRING(config_look_prefix_suffix),
+ 0, simulate,
+ apply_style_inactive,
+ nick_offline);
+ window->win_chat_cursor_x += gui_chat_strlen_screen (CONFIG_STRING(config_look_prefix_suffix));
+ chars_displayed += gui_chat_display_word_raw (window, line,
+ str_space,
+ 0, simulate,
+ apply_style_inactive,
+ nick_offline);
+ window->win_chat_cursor_x += gui_chat_strlen_screen (str_space);
+ if (!simulate)
+ gui_window_restore_style (GUI_WINDOW_OBJECTS(window)->win_chat);
}
- chars_displayed += gui_chat_display_word_raw (window, line,
- CONFIG_STRING(config_look_prefix_suffix),
- 0, simulate,
- apply_style_inactive,
- nick_offline);
- window->win_chat_cursor_x += gui_chat_strlen_screen (CONFIG_STRING(config_look_prefix_suffix));
- chars_displayed += gui_chat_display_word_raw (window, line,
- str_space,
- 0, simulate,
- apply_style_inactive,
- nick_offline);
- window->win_chat_cursor_x += gui_chat_strlen_screen (str_space);
- if (!simulate)
- gui_window_restore_style (GUI_WINDOW_OBJECTS(window)->win_chat);
}
if (window->win_chat_cursor_y < window->coords_size)
window->coords[window->win_chat_cursor_y].data = (char *)word + (ptr_data - data);
@@ -592,7 +600,7 @@ gui_chat_display_word (struct t_gui_window *window,
if ((!prefix && (ptr_data >= end_line)) ||
((!simulate) && (window->win_chat_cursor_y >= window->win_chat_height)))
ptr_data = NULL;
-}
+ }
free (data);