comparison mcabber/mcabber/screen.c @ 2344:1579ed96d501

Simplify Log_Win_Height calculation
author franky
date Wed, 29 May 2019 21:08:59 +0200
parents 762ee698c8cd
children 64f1899ff168
comparison
equal deleted inserted replaced
2343:762ee698c8cd 2344:1579ed96d501
135 135
136 static int roster_hidden; 136 static int roster_hidden;
137 static int chatmode; 137 static int chatmode;
138 static int multimode; 138 static int multimode;
139 static char *multiline, *multimode_subj; 139 static char *multiline, *multimode_subj;
140 static int roster_no_leading_space;
141 140
142 static bool Curses; 141 static bool Curses;
143 static bool log_win_on_top; 142 static bool log_win_on_top;
144 static bool roster_win_on_right; 143 static bool roster_win_on_right;
145 static guint autoaway_source = 0; 144 static guint autoaway_source = 0;
1679 int requested_size; 1678 int requested_size;
1680 gchar *ver, *message; 1679 gchar *ver, *message;
1681 int chat_y_pos, chatstatus_y_pos, log_y_pos; 1680 int chat_y_pos, chatstatus_y_pos, log_y_pos;
1682 int roster_x_pos, chat_x_pos; 1681 int roster_x_pos, chat_x_pos;
1683 1682
1684 roster_no_leading_space = settings_opt_get_int("roster_no_leading_space"); 1683 if (maxY < 4)
1684 maxY = 4;
1685 1685
1686 if (NULL == settings_opt_get("log_win_height")) 1686 if (NULL == settings_opt_get("log_win_height"))
1687 requested_size = DEFAULT_LOG_WIN_HEIGHT; 1687 requested_size = DEFAULT_LOG_WIN_HEIGHT;
1688 else 1688 else
1689 requested_size = settings_opt_get_int("log_win_height"); 1689 requested_size = settings_opt_get_int("log_win_height");
1690 if (requested_size > 0) { 1690 if (requested_size <= 0) {
1691 if (maxY > requested_size + 3) 1691 Log_Win_Height = 0;
1692 } else {
1693 if (maxY >= requested_size + 4)
1692 Log_Win_Height = requested_size; 1694 Log_Win_Height = requested_size;
1693 else 1695 else {
1694 Log_Win_Height = ((maxY > 5) ? (maxY - 4) : 1);
1695 } else if (requested_size <= 0) {
1696 Log_Win_Height = 0;
1697 }
1698
1699 if (maxY < Log_Win_Height+4) {
1700 if (maxY < 5) {
1701 Log_Win_Height = 1;
1702 maxY = 5;
1703 } else {
1704 Log_Win_Height = maxY - 4; 1696 Log_Win_Height = maxY - 4;
1705 } 1697 }
1706 } 1698 }
1707 1699
1708 if (roster_hidden) { 1700 if (roster_hidden) {
2172 if (roster_win_on_right) 2164 if (roster_win_on_right)
2173 x_pos = 1; // 1 char offset (vertical line) 2165 x_pos = 1; // 1 char offset (vertical line)
2174 else 2166 else
2175 x_pos = 0; 2167 x_pos = 0;
2176 2168
2177 if (roster_no_leading_space) { 2169 if (settings_opt_get_int("roster_no_leading_space") == 1) {
2178 space[0] = '\0'; 2170 space[0] = '\0';
2179 prefix_length = 6; 2171 prefix_length = 6;
2180 } else { 2172 } else {
2181 prefix_length = 7; 2173 prefix_length = 7;
2182 } 2174 }