slang-devel mailing list

[2018 Date Index] [2018 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

[slang-devel] Patch to improve behavior on very large screens


Hello there!

Attached is a patch to get better behavior on really big screens. If maximize my terminal emulator, programs that use slang behave as if my window is 80 columns wide. Here's a screenshot showing the issue in nmtui: https://i.imgur.com/fH8nJY1.png

The issue was that if reported columns was greater than SLTT_MAX_SCREEN_COLS, SLtt_Screen_Cols was set to its default value of 80 columns. This patch changes it so that it is set to the max value instead. The same goes for rows.

I realize this may seem like a silly edge case, but I think it will become more prevalent as display technologies improve.

If you have any feedback regarding this patch, please let me know.

Sincerely,

Geoff Greer

From 6ed7001c5adee0ca7ae79c6cb67a0a3d26f50de2 Mon Sep 17 00:00:00 2001
From: Geoff Greer <geoff@xxxxxxxx>
Date: Sat, 15 Dec 2018 18:28:40 -0800
Subject: [PATCH] SLtt_get_screen_size: Better fallback for big terminals.

If reported rows or colums are greater than SLTT_MAX_SCREEN_ROWS/SLTT_MAX_SCREEN_COLS, set SLtt_Screen_Rows/SLtt_Screen_Cols to max values rather than defaults. This fixes an issue on large terminals where displayed information used a tiny fraction of the area available.
---
 src/sldisply.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/sldisply.c b/src/sldisply.c
index fcc4f1c..9890ffc 100644
--- a/src/sldisply.c
+++ b/src/sldisply.c
@@ -3307,8 +3307,10 @@ void SLtt_get_screen_size (void)
 	if (s != NULL) c = atoi (s);
      }
 
-   if ((r <= 0) || (r > SLTT_MAX_SCREEN_ROWS)) r = 24;
-   if ((c <= 0) || (c > SLTT_MAX_SCREEN_COLS)) c = 80;
+   if (r <= 0) r = 24;
+   if (r > SLTT_MAX_SCREEN_ROWS) r = SLTT_MAX_SCREEN_ROWS;
+   if (c <= 0) c = 80;
+   if (c > SLTT_MAX_SCREEN_COLS) c = SLTT_MAX_SCREEN_COLS;
    SLtt_Screen_Rows = r;
    SLtt_Screen_Cols = c;
 }
-- 
2.17.1


[2018 date index] [2018 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]