[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#263374: marked as done (cplay: saner list window handling)



Your message dated Thu, 28 Nov 2019 06:35:41 +0000
with message-id <E1iaDOv-000FIh-5x@fasolo.debian.org>
and subject line Bug#827890: Removed package(s) from unstable
has caused the Debian Bug report #263374,
regarding cplay: saner list window handling
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
263374: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=263374
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: cplay
Version: 1.49-4
Severity: wishlist
Tags: patch

The cplay handling of scrolling lists has always seemed suboptimal.  In
both the directory / file window and the playlist window, as you scroll
up or down, there is no text overlap between screenfuls.  In addition,
the PgUp and PgDown keys always reposition your cursor at the top of
the window.

The following patch provides a 2-line overlap between screenfuls, and,
as much as possible, keeps your cursor on the same screen line as you
page up and down.  Despite the length of the patch (it was harder than
it looked!) there are no other changes.

It is reasonably well tested, but I'm not a Python programmer, so
caveat maintainor.

Peter
--- cplay.orig	2003-12-05 02:20:56.000000000 -0600
+++ cplay	2004-08-03 19:16:44.000000000 -0500
@@ -169,6 +169,7 @@
         self.w = self.newwin()
         self.ypos, self.xpos = self.getbegyx()
         self.rows, self.cols = self.getmaxyx()
+        self.scrollinc = self.rows - 2
         self.keypad(1)
         self.leaveok(0)
         self.scrollok(0)
@@ -400,10 +401,16 @@
                              self.parent.ypos+2, self.parent.xpos)
 
     def update(self, force = 1):
-        self.bufptr = max(0, min(self.bufptr, len(self.buffer) - 1))
-        scrptr = (self.bufptr / self.rows) * self.rows
-        if force or self.scrptr != scrptr:
-            self.scrptr = scrptr
+        bufmax = len(self.buffer) - 1
+        self.bufptr = max(0, min(self.bufptr, bufmax))
+        self.scrptr = max(0, min(self.scrptr, bufmax))
+        if force or \
+               self.bufptr < self.scrptr or \
+               self.bufptr > self.scrptr + self.rows - 1:
+            self.scrptr = self.bufptr - self.bufptr % self.scrollinc
+            if self.scrptr >= self.scrollinc and \
+                   self.scrptr + self.rows - self.scrollinc > bufmax:
+                self.scrptr -= self.scrollinc
             self.move(0, 0)
             self.clrtobot()
             i = 0
@@ -445,30 +452,55 @@
         if self.bufptr >= len(self.buffer): self.bufptr = len(self.buffer) - 1
         return self.buffer[self.bufptr]
 
-    def cursor_move(self, ydiff):
+    def cursor_moveto(self, y):
         if app.input_mode: app.cancel_input()
         if not self.buffer: return
         self.update_line(refresh = 0)
-        self.bufptr = (self.bufptr + ydiff) % len(self.buffer)
+        self.bufptr = y % len(self.buffer)
         self.update(force = 0)
+        
+    def cursor_move(self, ydiff):
+        self.cursor_moveto(self.bufptr + ydiff)
 
     def cursor_ppage(self):
-        tmp = self.bufptr % self.rows
-        if tmp == self.bufptr:
-            self.cursor_move(-(tmp+(len(self.buffer) % self.rows) or self.rows))
+        if self.scrptr > 0:
+            # Yes, ugly.  The double move is in order to force the
+            # cursor onto the correct page ("scrptr"), since lines at the
+            # top / bottom of a page could go on either of two pages.  The
+            # same thing, for the same reason, appears in 3 other places.
+            tmp = max(0, self.bufptr - self.rows)
+            tmp2 = max(0, self.bufptr - self.scrollinc)
+            self.cursor_moveto(tmp)
+            self.cursor_moveto(tmp2)
         else:
-            self.cursor_move(-(tmp+self.rows))
+            # Wrap to last page.  This is complicated by the fact that
+            # the "last page" as calculated by "% scrollinc" sometimes
+            # overestimates by one page.
+            buflen = len(self.buffer)
+            lastscr = buflen - buflen % self.scrollinc
+            if lastscr + self.rows - self.scrollinc > buflen - 1:
+                lastscr -= self.scrollinc
+            bufptr = min(self.bufptr + lastscr, buflen - 1)
+            self.cursor_moveto(buflen - 1)
+            self.cursor_moveto(bufptr)
 
     def cursor_npage(self):
-        tmp = self.rows - self.bufptr % self.rows
-        if self.bufptr + tmp > len(self.buffer):
-            self.cursor_move(len(self.buffer) - self.bufptr)
+        buflen = len(self.buffer)
+        if self.scrptr + self.rows < buflen:
+            # See comment in cursor_ppage re: double move.
+            tmp = min(self.bufptr + self.rows, buflen - 1)
+            tmp2 = min(self.bufptr + self.scrollinc, buflen - 1)
+            self.cursor_moveto(tmp)
+            self.cursor_moveto(tmp2)
         else:
-            self.cursor_move(tmp)
+            # Wrap to top.
+            tmp = self.bufptr - self.scrptr
+            self.cursor_moveto(0)
+            self.cursor_moveto(tmp)
 
-    def cursor_home(self): self.cursor_move(-self.bufptr)
+    def cursor_home(self): self.cursor_moveto(0)
 
-    def cursor_end(self): self.cursor_move(-self.bufptr - 1)
+    def cursor_end(self): self.cursor_moveto(-1)
 
     def start_search(self, type, direction):
         self.search_direction = direction

Attachment: signature.asc
Description: Digital signature


--- End Message ---
--- Begin Message ---
Version: 1.50-2+rm

Dear submitter,

as the package cplay has just been removed from the Debian archive
unstable we hereby close the associated bug reports.  We are sorry
that we couldn't deal with your issue properly.

For details on the removal, please see https://bugs.debian.org/827890

The version of this package that was in Debian prior to this removal
can still be found using http://snapshot.debian.org/.

Please note that the changes have been done on the master archive and
will not propagate to any mirrors until the next dinstall run at the
earliest.

This message was generated automatically; if you believe that there is
a problem with it please contact the archive administrators by mailing
ftpmaster@ftp-master.debian.org.

Debian distribution maintenance software
pp.
Scott Kitterman (the ftpmaster behind the curtain)

--- End Message ---

Reply to: