Hi Mansur, Could be done, but since the function is meant to be run by manual invocation *and* after an infrequent operation (Tmux window resize), I'm not sure it matters that much. Assuming, that is, that (eqwin) is cheap to run.
Wojtek On Thu, Apr 9, 2020 at 1:21 PM Мансур Мамкин <mmam...@gmail.com> wrote: > Hi all, > what about also comparing new values with current values, and do something > only when anything has changed. > > Best regards, > Mansur Mamkin > > On Wed, Apr 8, 2020 at 10:08 PM Wojciech Gac <wojciech.s....@gmail.com> > wrote: > >> Hi, >> >> I typically use my Vip/Picolisp setup inside Tmux. I've noticed that when >> I 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 >> 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. >> 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? >> >> Wojtek >> >> # Return a list of screen dimensions in the form (Lines Columns) >> (de GetScreenSize () >> (mapcar format >> (mapcar pack >> (split >> (chop (in '(stty size) (line T))) >> " ")))) >> >> # Update environment variables and internal variables holding the screen >> size >> (de UpdateScreenSize (Lines Columns) >> (sys "LINES" Lines) >> (sys "COLUMNS" Columns) >> (setq vip~*Lines Lines >> vip~*Columns Columns)) >> >