#! /bin/sh /usr/share/dpatch/dpatch-run
## 13_screensize.dpatch by Anders Kaseorg <andersk@mit.edu>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Fixes a bug that stops outputting aptitude downloads on big screens


@DPATCH@
Index: aptitude/src/generic/apt/acqprogress.cc
===================================================================
--- aptitude.orig/src/generic/apt/acqprogress.cc
+++ aptitude/src/generic/apt/acqprogress.cc
@@ -178,6 +178,8 @@
    char Buffer[1024];
    char *End = Buffer + sizeof(Buffer);
    char *S = Buffer;
+   // this->ScreenWidth is a reference that is updated by the SIGWINCH handler
+   unsigned int ScreenWidth = this->ScreenWidth;
    if (ScreenWidth >= sizeof(Buffer))
       ScreenWidth = sizeof(Buffer)-1;
 
Index: aptitude/src/generic/apt/acqprogress.h
===================================================================
--- aptitude.orig/src/generic/apt/acqprogress.h
+++ aptitude/src/generic/apt/acqprogress.h
@@ -20,7 +20,8 @@
 class AcqTextStatus : public sigc::trackable
 {
    unsigned int &ScreenWidth;
-   char BlankLine[300];
+   // Must be the same size as Buffer in AcqTextStatus::Pulse
+   char BlankLine[1024];
    unsigned long ID;
    unsigned long Quiet;
    
