fit help message in 80x25 terminal
authorLaurent MAZET <laurent.mazet@thalesgroup.com>
Mon, 20 May 2024 14:33:44 +0000 (16:33 +0200)
committerLaurent MAZET <laurent.mazet@thalesgroup.com>
Mon, 20 May 2024 14:33:44 +0000 (16:33 +0200)
cmore.c

diff --git a/cmore.c b/cmore.c
index b8488d13ac0e81d5f7a6631aa45eddbf64adfa84..a40a94f799d58668172b7e36ff74452e9447a1e0 100644 (file)
--- a/cmore.c
+++ b/cmore.c
@@ -168,19 +168,19 @@ void follow (void)
 
 void about (void)
 {
-    char *message = "CMore: a curses more\n \nThis program is a pager with a text user interface.\n- To move displayed text or in menu, use arrow keys or vim keys (i, j, k, l).\ni- To access menus, use Alt-f (:f) of Alt-h (:h).\n- To edit ligne use arrow keys, ^H, ^U and ^W or press Escape to swithc in vim command (i, j, k, l, x, d, w)\n- To quit displayed text, press Escape or 'q'.";
-
+    char *message = "CMore: a curses more\n \nThis program is a pager with a text user interface.\n- To move displayed text or in menu, use arrow keys or vim keys (i, j, k, l).\n- To access menus, use Alt-f (:f) of Alt-h (:h).\n- To edit ligne use arrow keys, ^H, ^U and ^W or press Escape to swith into vim command mode (i, j, k, l, x, d, w)\n- To quit displayed text, press Escape or 'q'.";
+    float ratio = 0.6;
     int xmax, ymax;
     WINDOW *wbody = bodywin ();
     getmaxyx (stdscr, ymax, xmax);
 
-    wmove (stdscr, ymax / 4, xmax / 4);
-    WINDOW *whelp = winputbox (stdscr, ymax / 2, xmax / 2);
+    wmove (stdscr, ymax * (1 - ratio) / 2, xmax * (1 - ratio) / 2);
+    WINDOW *whelp = winputbox (stdscr, ymax * ratio, xmax * ratio);
 
     int i, j;
-    for (i = 1; i < ymax / 2 - 1; i++) {
+    for (i = 1; i < ymax * ratio - 1; i++) {
         char c[2] = {0};
-        for (j = 1; j < xmax / 2 - 1; j++) {
+        for (j = 1; j < xmax * ratio - 1; j++) {
             *c = *message++;
             if ((*c == '\n') && (j == 1)) {
                 *c = *message++;