Thanks Alex! This is very elegant and concise. And it works.

One other problem I noticed with my Vip (this is under Termux) is that
for some reason it won't allow me to exit insert mode. It worked fine
yesterday and I have no idea what changed. Initially I thought it
might be some escaping issue, i.e. Esc/C-[ being interpreted as some
other symbol, but it works fine for Vim (both Esc and C-[). What I'm
getting now is that pressing Esc results in an open bracket being
inserted into the buffer. No way to return to command mode. When I
fresh instance of Vip, I can enter commands normally. But the first
switch to insert mode breaks things. I was worried that perhaps messed
something up in the "vip.l" file I had open on the side, but have
since replaced its contents with the upstream version and even
reinstalled Picolisp and the issue persists.


On Thu, Apr 9, 2020 at 7:37 AM Alexander Burger <a...@software-lab.de> wrote:

> 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