jupyter icon indicating copy to clipboard operation
jupyter copied to clipboard

Scrolling in REPL and inline images and pdb

Open colormotor opened this issue 4 years ago • 0 comments

Hi, I have an issue when debugging in emacs jupyter. I often use the REPL to display inline images, and this causes problems with scrolling in the REPL when debugging with pdb.

This is a small example that reproduced the problem


import matplotlib as pyplot
import numpy as np
import pdb

for i in range(2):
    # Some unusually "tall" images
    plt.figure(figsize=(3,10))
    plt.plot(np.sin(np.linspace(0, 10, 100)))
    plt.show()
    plt.figure(figsize=(3,10))
    plt.plot(np.sin(np.linspace(0, 10, 100)))
    plt.show()
    plt.figure(figsize=(3,10))
    plt.plot(np.sin(np.linspace(0, 10, 100)))
    plt.show()
    # Break here
    pdb.set_trace()
    print('press n in pdb minibuffer')

If you execute the code and continue execution with n (in the pdb minibuffer), the REPL will scroll so that it only displays an empty input line at the top of the buffer. When this occurs, the buffer gets "stuck" so it is necessary to manually scroll, in order to view any previously displayed text or images. In my experience this only occurs during a pdb session.

I know this is an unusual use-case, and that emacs is not the best environment to display large inline images, but perhaps there a solution in the emacs-jupyter code, or even a method to tell the REPL buffer to "reset" its current scrolling status?

This also leads to the question, are there any upcoming updates on the debugging workflow (pdb/ipdb) in emacs-jupyter?

colormotor avatar Feb 21 '21 12:02 colormotor