]> git.lizzy.rs Git - plan9front.git/commitdiff
stats: fix crash with -Y fag when window too narrow
authorcinap_lenrek <cinap_lenrek@felloff.net>
Wed, 13 Jun 2018 23:10:52 +0000 (01:10 +0200)
committercinap_lenrek <cinap_lenrek@felloff.net>
Wed, 13 Jun 2018 23:10:52 +0000 (01:10 +0200)
sys/src/cmd/stats.c

index dfb71a1cd64b3fe0174c6caf6b56808f7bbf64e1..c7cf55cee3b2819ac7c8cf71469b09179ddf7f5f 100644 (file)
@@ -1131,7 +1131,7 @@ resize(void)
        /* label right, if requested */
        if(ylabels && dy>Nlab*(font->height+1)){
                wid = labelwidth();
-               if(wid < (maxx-startx)-30){
+               if(wid < dx-10){
                        /* else there's not enough room */
                        maxx -= 1+Lx+wid;
                        draw(screen, Rect(maxx, starty, maxx+1, screen->r.max.y), display->black, nil, ZP);
@@ -1156,9 +1156,9 @@ resize(void)
 
        /* create graphs */
        for(i=0; i<nmach; i++){
-               machr = Rect(startx+i*dx, starty, maxx, screen->r.max.y);
-               if(i < nmach-1)
-                       machr.max.x = startx+(i+1)*dx - 1;
+               machr = Rect(startx+i*dx, starty, startx+(i+1)*dx - 1, screen->r.max.y);
+               if(i == nmach-1)
+                       machr.max.x = maxx;
                y = starty;
                for(j=0; j<ngraph; j++, y+=dy){
                        g = &graph[i*ngraph+j];