Package: screen
Version: 4.0.3-11
Severity: wishlist
Tags: patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

A little hacked-in but working support for 'hardstatus firstline'.
I'm not sure if this feature should really be added anywhere or it's not of
enough interest.

I didn't add it into documentation because I'm not so sure about editing it.

The patch supplied should be applied after all debian-provided patches, not
to the original source (e.g. it might be added as 52nd to dpatch).

If it's not to be included into sources, I think it sould be made available
somewhere because there are some interest into this feature after all
(actually, I wrote it just-for-fun after Attentah asked about it on
#screen).

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkl07AoACgkQzTyLW6lmguX3pACeOkQk36IzwpyZ5s8eyOgvsXjs
pHsAoJtCvYzdW3p1ocN2Ch5vBmBxL8sg
=ih6/
-----END PGP SIGNATURE-----
diff -dpr screen-4.0.3-h2-start/display.c screen-4.0.3-h2/display.c
*** screen-4.0.3-h2-start/display.c	2009-01-19 18:03:12.848855058 +0400
--- screen-4.0.3-h2/display.c	2009-01-19 18:15:37.111854611 +0400
*************** MakeDefaultCanvas()
*** 422,428 ****
      return -1;
    cv->c_xs      = 0;
    cv->c_xe      = D_width - 1;
!   cv->c_ys      = 0;
    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;
--- 422,428 ----
      return -1;
    cv->c_xs      = 0;
    cv->c_xe      = D_width - 1;
!   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;
*************** char *str;
*** 2856,2861 ****
--- 2856,2883 ----
        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);
+       PutWinMsg(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");
*************** int y, from, to, isblank;
*** 2943,2949 ****
    if (D_status == STATUS_ON_WIN && y == STATLINE)
      return;	/* can't refresh status */
  
!   if (y == D_height - 1 && D_has_hstatus == HSTATUS_LASTLINE)
      {
        RefreshHStatus();
        return;
--- 2965,2971 ----
    if (D_status == STATUS_ON_WIN && y == STATLINE)
      return;	/* can't refresh status */
  
!   if ( (y == D_height - 1 && D_has_hstatus == HSTATUS_LASTLINE)||(y == 0 && D_has_hstatus == HSTATUS_FIRSTLINE) )
      {
        RefreshHStatus();
        return;
*************** struct canvas *cv;
*** 4540,4545 ****
--- 4562,4568 ----
    D_cvlist = 0;
    D_forecv = lay->lay_forecv;
    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();
Only in screen-4.0.3-h2: display.c~
diff -dpr screen-4.0.3-h2-start/display.h screen-4.0.3-h2/display.h
*** screen-4.0.3-h2-start/display.h	2009-01-19 18:03:10.705855688 +0400
--- screen-4.0.3-h2/display.h	2009-01-19 18:03:21.556856374 +0400
*************** while (0)
*** 377,380 ****
  #define HSTATUS_LASTLINE	1
  #define HSTATUS_MESSAGE		2
  #define HSTATUS_HS		3
! #define HSTATUS_ALWAYS		(1<<2)
--- 377,381 ----
  #define HSTATUS_LASTLINE	1
  #define HSTATUS_MESSAGE		2
  #define HSTATUS_HS		3
! #define HSTATUS_FIRSTLINE	4
! #define HSTATUS_ALWAYS		(1<<3)
diff -dpr screen-4.0.3-h2-start/process.c screen-4.0.3-h2/process.c
*** screen-4.0.3-h2-start/process.c	2009-01-19 18:03:12.383855446 +0400
--- screen-4.0.3-h2/process.c	2009-01-19 18:27:36.839856182 +0400
*************** int key;
*** 2662,2668 ****
  	  s = args[0];
  	  if (!strncmp(s, "always", 6))
  	    s += 6;
! 	  if (!strcmp(s, "lastline"))
  	    new_use = HSTATUS_LASTLINE;
  	  else if (!strcmp(s, "ignore"))
  	    new_use = HSTATUS_IGNORE;
--- 2662,2670 ----
  	  s = args[0];
  	  if (!strncmp(s, "always", 6))
  	    s += 6;
! 	  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;
*************** int key;
*** 2697,2702 ****
--- 2699,2706 ----
  		  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 -dpr screen-4.0.3-h2-start/resize.c screen-4.0.3-h2/resize.c
*** screen-4.0.3-h2-start/resize.c	2009-01-19 18:03:09.851855366 +0400
--- screen-4.0.3-h2/resize.c	2009-01-19 18:03:21.623855067 +0400
*************** int change_fore;
*** 154,159 ****
--- 154,160 ----
  
    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);
    if (cv->c_slperp)
      {

Reply via email to