Hi Wojtek,

> I typically use my Vip/Picolisp setup inside Tmux. I've noticed that when I

Me too. I never have any shell session running without Tmux, neither locally nor
remote.


> resize the window occupied by Vip, it does not automatically adapt to the
> new dimensions, nor could I find a quick way to do it manually. So I took a

Yeah, this is a known issue.

Originally, when Vip was written to use Ncurses, it was notified when the
terminal changed in 'getch':

   (de getch ()
      (loop
         (curses "wget_wch" NIL (: ptr) '(*Chr (4 . I)))
         (NIL (= 410 *Chr)  # KEY_RESIZE
            (setq *Chr (unless (= 27 *Chr) (char *Chr))) )
         (setq
            *Lines (car (struct "LINES" '(I)))
            *Columns (car (struct "COLS" '(I))) )
         (eqwin) ) )

Whenever Vip received a SIGWINCH signal, the above 'setq' was triggered.

Now, as Vip does not use Ncurses any longer, the above does not work. The
PicoLisp core does not handle SIGWINCH.

I avoid this situation by either not changing the terminal, or by simply
restarting Vip ;)


> look at the source code and decided to write some helper functions. The
> function GetScreenSize uses "stty size" (to avoid relying on Ncurses). The
> function UpdateScreenSize sets the environment variables LINES and COLUMNS,
> as well as the Vip variables *Lines and *Columns to the appropriate values.

Good.

> The problem is I don't really know how to force Vip to redraw its windows.
> I've tried "repaint" cause it looked like it should do the trick, but it
> did not. Am I missing something?

'repaint' might be the right place, but it is called very often. Not sure if it
slows everything down too much. Also, I would recommend 'eqwin' as in the
example above, to re-calculate the window sizes.


I would recommend to install it into a function key handler. It just needs in
~/.pil/viprc

   (de *F12
      (in '(stty size)
         (setq *Lines (read) *Columns (read)) )
      (eqwin) )

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to