1

I am using the OS X Terminal (I know, not Linux or Unix, but hopefully that's irrelevant here) for a number of operations, and commonly use nano to quickly edit files. In doing so I often resize the Terminal window, and the nano interface resizes accordingly to fit the window. This is great, allows me to see my work better, and is expected behavior.

However, I also use ipython for computations and development in python, but when I load this interactive shell it seems to size the shell's width and height at the current Terminal window's bounds, but then will not resize dynamically if the window is resized.

As a result, if I use a command like "!nano" in ipython to launch the nano editor, it will initially load and look correct at the current window size, but resizing the window will garble the nano interface as it wraps around or extends beyond the apparent bounds of the ipython shell.

This appears to be some limitation with how ipython is interacting with the bounds of the window or shell running in the window. I cannot tell, and am hoping someone with experience in this can point me to a way (if possible) of having ipython (or whatever is involved here) properly resize itself according to the Terminal's window.

Here is a screenshot of what it looks like. The window was initially larger, so I ran ipython to load the interpreter, and then ran !nano to launch nano within ipython. I then resized the window and this is what results. I'd expect (and hope to find a way) for such resizing to preserve the nano interface. This only happens in ipython, so its clearly a restriction somewhere in that environment.

Garbled nano interface when launched in ipython

2

Terminal resize generates a SIGWINCH signal that is sent to the foreground applications. Said applications are supposed to catch that signal (provided they care about terminal size to begin with), and adjust accordingly. What seems to be going on when you resize the terminal while nano is running from ipython is that ipython receives the SIGWINCH, but doesn't re-send it to nano. I don't think there is anything you can do about that (except report it as a bug to IPython developers).

  • Ah nuts! Thanks I'll see if I can get in touch with them and file a bug (thumbs up, since I can't vote up yet). – Topher May 24 '15 at 19:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.