changeset 2344:1579ed96d501

Simplify Log_Win_Height calculation
author franky
date Wed, 29 May 2019 21:08:59 +0200
parents 762ee698c8cd
children 462f4359391c
files mcabber/mcabber/screen.c
diffstat 1 files changed, 8 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/mcabber/screen.c	Tue May 28 22:28:49 2019 +0200
+++ b/mcabber/mcabber/screen.c	Wed May 29 21:08:59 2019 +0200
@@ -137,7 +137,6 @@
 static int chatmode;
 static int multimode;
 static char *multiline, *multimode_subj;
-static int roster_no_leading_space;
 
 static bool Curses;
 static bool log_win_on_top;
@@ -1681,26 +1680,19 @@
   int chat_y_pos, chatstatus_y_pos, log_y_pos;
   int roster_x_pos, chat_x_pos;
 
-  roster_no_leading_space = settings_opt_get_int("roster_no_leading_space");
+  if (maxY < 4)
+    maxY = 4;
 
   if (NULL == settings_opt_get("log_win_height"))
     requested_size = DEFAULT_LOG_WIN_HEIGHT;
   else
     requested_size = settings_opt_get_int("log_win_height");
-  if (requested_size > 0) {
-    if (maxY > requested_size + 3)
-      Log_Win_Height = requested_size;
-    else
-      Log_Win_Height = ((maxY > 5) ? (maxY - 4) : 1);
-  } else if (requested_size <= 0) {
+  if (requested_size <= 0) {
     Log_Win_Height = 0;
-  }
-
-  if (maxY < Log_Win_Height+4) {
-    if (maxY < 5) {
-      Log_Win_Height = 1;
-      maxY = 5;
-    } else {
+  } else {
+    if (maxY >= requested_size + 4)
+      Log_Win_Height = requested_size;
+    else {
       Log_Win_Height = maxY - 4;
     }
   }
@@ -2174,7 +2166,7 @@
   else
     x_pos = 0;
 
-  if (roster_no_leading_space) {
+  if (settings_opt_get_int("roster_no_leading_space") == 1) {
     space[0] = '\0';
     prefix_length = 6;
   } else {