dbrock / bongo

Play music with GNU Emacs
http://www.emacswiki.org/emacs/Bongo
Other
207 stars 22 forks source link

`bongo-default-mode-line-indicator-function` cause images open in Emacs to continuosly scroll down #21

Closed iqbalansari closed 9 years ago

iqbalansari commented 9 years ago

Really sorry accidentally pressed enter before completing the issue causing github to submit the incomplete issue.

I recently observed that if I start playing a track in bongo and switch to buffer displaying an image (can be a docview buffer or a pdfview buffer) the buffer would constantly scroll down making it impossible to scroll the buffer.

Steps to reproduce

1) Create a new bongo-playlist-buffer 2) Insert atleast two files in the buffer 3) Start playing the first file 4) Now open an image in emacs, the image should be larger than the emacs window (so that we can scroll the image) 5) Try going to next line in image by pressing down arrow key

You will notice at regular intervals the image scrolls to the top, making it impossible to scroll through the image

On investigating further I was able to nail this down to bongo-default-mode-line-indicator-function, which internally calls the functions bongo-mode-line-backward/previous-button and bongo-mode-line-forward/next-button, I am going to describe the problem with bongo-mode-line-backward/previous-button the problem with bongo-mode-line-forward/next-button is similar.

The problematic call sequence is bongo-mode-line-forward/next-button > bongo-point-at-next-track-line > bongo-point-before-next-line-satisfying > next-line > line-move. Now the problem is that line-move scrolls the currently selected window by 0 pixels, for some reason this behaves weirdly for windows containing image causing them to scroll to start of the window.

Not exactly sure why this happens but I am guessing this due to the fact that image internally is represented as some characters with the display text-property set to an image, so moving a single logical line does not correspond to moving just the one line height but larger portion of the screen displaying the image. Also please notice the currently selected window is scrolled, irrespective of the current buffer (which would be a bongo-buffer in our case)

Proposed fix

Using forward-line for moving to lines fixes this issue, the code anyways seems to be using forward-line at rest of the places.