mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
fix indent code
This commit is contained in:
parent
f2629aca7b
commit
3842daa334
@ -61,7 +61,7 @@
|
||||
|
||||
static void _win_print(ProfWin *window, const char show_char, GDateTime *time,
|
||||
int flags, theme_item_t theme_item, const char * const from, const char * const message, DeliveryReceipt *receipt);
|
||||
static void _win_print_wrapped(WINDOW *win, const char * const message);
|
||||
static void _win_print_wrapped(WINDOW *win, const char * const message, size_t indent);
|
||||
|
||||
int
|
||||
win_roster_cols(void)
|
||||
@ -952,12 +952,18 @@ _win_print(ProfWin *window, const char show_char, GDateTime *time,
|
||||
gboolean me_message = FALSE;
|
||||
int offset = 0;
|
||||
int colour = theme_attrs(THEME_ME);
|
||||
size_t indent = 0;
|
||||
|
||||
if ((flags & NO_DATE) == 0) {
|
||||
gchar *date_fmt = NULL;
|
||||
char *time_pref = prefs_get_string(PREF_TIME);
|
||||
date_fmt = g_date_time_format(time, time_pref);
|
||||
free(time_pref);
|
||||
assert(date_fmt != NULL);
|
||||
|
||||
if(strlen(date_fmt) != 0){
|
||||
indent = 3 + strlen(date_fmt);
|
||||
}
|
||||
|
||||
if (date_fmt && strlen(date_fmt)) {
|
||||
if ((flags & NO_COLOUR_DATE) == 0) {
|
||||
@ -1004,7 +1010,7 @@ _win_print(ProfWin *window, const char show_char, GDateTime *time,
|
||||
}
|
||||
|
||||
if (prefs_get_boolean(PREF_WRAP)) {
|
||||
_win_print_wrapped(window->layout->win, message+offset);
|
||||
_win_print_wrapped(window->layout->win, message+offset, indent);
|
||||
} else {
|
||||
wprintw(window->layout->win, "%s", message+offset);
|
||||
}
|
||||
@ -1034,20 +1040,11 @@ _win_indent(WINDOW *win, int size)
|
||||
}
|
||||
|
||||
static void
|
||||
_win_print_wrapped(WINDOW *win, const char * const message)
|
||||
_win_print_wrapped(WINDOW *win, const char * const message, size_t indent)
|
||||
{
|
||||
int wordi = 0;
|
||||
char *word = malloc(strlen(message) + 1);
|
||||
|
||||
char *time_pref = prefs_get_string(PREF_TIME);
|
||||
int indent = 0;
|
||||
if (g_strcmp0(time_pref, "minutes") == 0) {
|
||||
indent = 8;
|
||||
} else if (g_strcmp0(time_pref, "seconds") == 0) {
|
||||
indent = 11;
|
||||
}
|
||||
free(time_pref);
|
||||
|
||||
gchar *curr_ch = g_utf8_offset_to_pointer(message, 0);
|
||||
|
||||
while (*curr_ch != '\0') {
|
||||
|
Loading…
Reference in New Issue
Block a user