Redo of patch from
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=512342
as it does not apply on git due to some stuff being moved

I've been using it for more than 2 years and haven't noticed any
problems.

Also bugs: 18192 36811

Amadeusz
>From 0a5168130a594f573126d6d858ad2c3bd927b5e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Amadeusz=20S=C5=82awi=C5=84ski?= <am...@asmblr.net>
Date: Sat, 15 Sep 2012 13:48:42 +0200
Subject: [PATCH 1/3] Apply hardstatusfirstline.patch (from
 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=512342)
 onto git
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit


Signed-off-by: Amadeusz Sławiński <am...@asmblr.net>
---
 src/canvas.c  |  2 +-
 src/display.c | 24 +++++++++++++++++++++++-
 src/display.h |  3 ++-
 src/layout.c  |  1 +
 src/process.c |  6 +++++-
 src/resize.c  |  1 +
 6 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/src/canvas.c b/src/canvas.c
index 0121892..93177cb 100644
--- a/src/canvas.c
+++ b/src/canvas.c
@@ -375,7 +375,7 @@ MakeDefaultCanvas()
     return -1;
   cv->c_xs      = 0;
   cv->c_xe      = D_width - 1;
-  cv->c_ys      = 0;
+  cv->c_ys      = (D_has_hstatus == HSTATUS_FIRSTLINE);
   cv->c_ye      = D_height - 1 - (D_has_hstatus == HSTATUS_LASTLINE) - 
captionalways;
   debug2("MakeDefaultCanvas 0,0 %d,%d\n", cv->c_xe, cv->c_ye);
   cv->c_xoff    = 0;
diff --git a/src/display.c b/src/display.c
index 94c05f1..0d9b84c 100644
--- a/src/display.c
+++ b/src/display.c
@@ -2234,6 +2234,28 @@ char *str;
       D_hstatus = *str ? 1 : 0;
       SetRendition(&mchar_null);
     }
+  else if (D_has_hstatus == HSTATUS_FIRSTLINE)
+    {
+      debug("ShowHStatus: using first line\n");
+      ox = D_x;
+      oy = D_y;
+      str = str ? str : "";
+      l = strlen(str);
+      if (l > D_width)
+        l = D_width;
+      GotoPos(0, 0);
+      SetRendition(captionalways || D_cvlist == 0 || D_cvlist->c_next ? 
&mchar_null: &mchar_so);
+      l = PrePutWinMsg(str, 0, l);
+      if (!captionalways || D_cvlist && !D_cvlist->c_next)
+        while (l++ < D_width)
+          PUTCHARLP(' ');
+      if (l < D_width)
+        ClearArea(l, 0, l, D_width - 1, D_width - 1, 0, 0, 0);
+      if (ox != -1 && oy != -1)
+        GotoPos(ox, oy);
+      D_hstatus = *str ? 1 : 0;
+      SetRendition(&mchar_null);
+    }
   else if (str && *str && D_has_hstatus == HSTATUS_MESSAGE)
     {
       debug("ShowHStatus: using message\n");
@@ -2334,7 +2356,7 @@ int y, from, to, isblank;
       isblank = 1;
     }
 
-  if (y == D_height - 1 && D_has_hstatus == HSTATUS_LASTLINE)
+  if (y == D_height - 1 && D_has_hstatus == HSTATUS_LASTLINE || (y == 0 && 
D_has_hstatus == HSTATUS_FIRSTLINE) )
     {
       RefreshHStatus();
       return;
diff --git a/src/display.h b/src/display.h
index e8b3b80..e48741f 100644
--- a/src/display.h
+++ b/src/display.h
@@ -320,7 +320,8 @@ while (0)
 #define HSTATUS_LASTLINE       1
 #define HSTATUS_MESSAGE                2
 #define HSTATUS_HS             3
-#define HSTATUS_ALWAYS         (1<<2)
+#define HSTATUS_FIRSTLINE      4
+#define HSTATUS_ALWAYS         (1<<3)
 
 #endif /* SCREEN_DISPLAY_H */
 
diff --git a/src/layout.c b/src/layout.c
index 584abbd..ec0c400 100644
--- a/src/layout.c
+++ b/src/layout.c
@@ -171,6 +171,7 @@ struct canvas *cv;
   if (!D_forecv)
     MakeDefaultCanvas();
   DupLayoutCv(&lay->lay_canvas, &D_canvas, 0);
+  D_canvas.c_ys = (D_has_hstatus == HSTATUS_FIRSTLINE);
   D_canvas.c_ye = D_height - 1 - ((D_canvas.c_slperp && 
D_canvas.c_slperp->c_slnext) || captionalways) - (D_has_hstatus == 
HSTATUS_LASTLINE);
   ResizeCanvas(&D_canvas);
   RecreateCanvasChain();
diff --git a/src/process.c b/src/process.c
index 30497a3..e22cf47 100644
--- a/src/process.c
+++ b/src/process.c
@@ -2851,7 +2851,9 @@ int key;
          s = args[0];
          if (!strncmp(s, "always", 6))
            s += 6;
-         if (!strcmp(s, "lastline"))
+         if (!strcmp(s, "firstline"))
+           new_use = HSTATUS_FIRSTLINE;
+         else if (!strcmp(s, "lastline"))
            new_use = HSTATUS_LASTLINE;
          else if (!strcmp(s, "ignore"))
            new_use = HSTATUS_IGNORE;
@@ -2886,6 +2888,8 @@ int key;
                  D_has_hstatus = new_use;
                  if ((new_use == HSTATUS_LASTLINE && old_use != 
HSTATUS_LASTLINE) || (new_use != HSTATUS_LASTLINE && old_use == 
HSTATUS_LASTLINE))
                    ChangeScreenSize(D_width, D_height, 1);
+                 if ((new_use == HSTATUS_FIRSTLINE && old_use != 
HSTATUS_FIRSTLINE) || (new_use != HSTATUS_FIRSTLINE && old_use == 
HSTATUS_FIRSTLINE))
+                   ChangeScreenSize(D_width, D_height, 1);
                  RefreshHStatus();
                }
            }
diff --git a/src/resize.c b/src/resize.c
index 3c2b90f..352a415 100644
--- a/src/resize.c
+++ b/src/resize.c
@@ -159,6 +159,7 @@ int change_fore;
 
   cv = &D_canvas;
   cv->c_xe = wi - 1;
+  cv->c_ys = (D_has_hstatus == HSTATUS_FIRSTLINE);
   cv->c_ye = he - 1 - ((cv->c_slperp && cv->c_slperp->c_slnext) || 
captionalways) - (D_has_hstatus == HSTATUS_LASTLINE);
   cv->c_blank.l_height = cv->c_ye - cv->c_ys + 1;
   if (cv->c_slperp)
-- 
1.7.12

Reply via email to