zsh-workers
 help / color / mirror / code / Atom feed
* Extend `zed' with status bar, is it possible?
@ 2018-10-18  5:10 Sebastian Gniazdowski
  2018-10-18 16:27 ` Sebastian Gniazdowski
  2018-10-20 17:35 ` Bart Schaefer
  0 siblings, 2 replies; 4+ messages in thread
From: Sebastian Gniazdowski @ 2018-10-18  5:10 UTC (permalink / raw)
  To: Zsh hackers list

Hello
I'm looking at vared and it seems that there is no way to
replace/append-to vared's last line (last POSTDISPLAY line?) with some
custom contents, basically a status bar. Does someone know a way?

Using zed to add debug-print lines / fine-tune modifications is a nice
use-case, if done with syntax highlighting that includes
brackets-highlighting. There is a group of developers that edit
in-session (not hash-bang) scripts and could benefit from this – theme
(prompt) creators. As established earlier, this would be for say
`zedex', an extended version of zed (unsure if  it will succeed to
include in upstream).

--
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Extend `zed' with status bar, is it possible?
  2018-10-18  5:10 Extend `zed' with status bar, is it possible? Sebastian Gniazdowski
@ 2018-10-18 16:27 ` Sebastian Gniazdowski
  2018-10-20 17:35 ` Bart Schaefer
  1 sibling, 0 replies; 4+ messages in thread
From: Sebastian Gniazdowski @ 2018-10-18 16:27 UTC (permalink / raw)
  To: Zsh hackers list

I got some progress on this. vared's option -t allows to select tty. So I have:

% cat /usr/local/bin/bash5
#!/bin/sh
tty
tty > /tmp/ttynum
sleep 200

Above is to get the tty created/used by tmux and make tmux just hang
on sleep. Then to run:

killtmux() { tmux kill-session -t vared_se; }
zle -N killtmux
saveterm="$(stty -g)"
tmux set -g default-shell /usr/local/bin/bash5 \; new-session -s vared_se &
sleep 3 && vared -t "$(</tmp/ttynum)" -f killtmux ZSH_VERSION
stty "$saveterm"

The point is, tmux can be configured to start small window at bottom
where ezed's / zedex's status bar will be shown. Above code works very
well except one thing: after 1st run/edit, second run fails with:

open terminal failed: not a terminal

This comes from tmux. Wonder what can happen to... /dev/tty? or
stdin/stdout, so that tmux cannot take control?
On Thu, 18 Oct 2018 at 07:10, Sebastian Gniazdowski
<sgniazdowski@gmail.com> wrote:
>
> Hello
> I'm looking at vared and it seems that there is no way to replace/append-to vared's last line (last POSTDISPLAY line?) with some custom contents, basically a status bar. Does someone know a way?
>
> Using zed to add debug-print lines / fine-tune modifications is a nice use-case, if done with syntax highlighting that includes brackets-highlighting. There is a group of developers that edit in-session (not hash-bang) scripts and could benefit from this – theme (prompt) creators. As established earlier, this would be for say `zedex', an extended version of zed (unsure if  it will succeed to include in upstream).
>
> --
> Sebastian Gniazdowski
> News: https://twitter.com/ZdharmaI
> IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
> Blog: http://zdharma.org



-- 
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Extend `zed' with status bar, is it possible?
  2018-10-18  5:10 Extend `zed' with status bar, is it possible? Sebastian Gniazdowski
  2018-10-18 16:27 ` Sebastian Gniazdowski
@ 2018-10-20 17:35 ` Bart Schaefer
  2018-10-20 21:40   ` Sebastian Gniazdowski
  1 sibling, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2018-10-20 17:35 UTC (permalink / raw)
  To: Sebastian Gniazdowski; +Cc: zsh-workers

On Wed, Oct 17, 2018 at 10:10 PM Sebastian Gniazdowski
<sgniazdowski@gmail.com> wrote:
>
> I'm looking at vared and it seems that there is no way to
> replace/append-to vared's last line (last POSTDISPLAY line?) with some
> custom contents, basically a status bar. Does someone know a way?

Do you mean a status that changes in some way during vared execution,
like showing the line/column of the cursor position or similar?

If all you want is to set POSTDISPLAY on entry, you can do it by
passing a line-init widget to "vared -i ...".  However, POSTDISPLAY
only appears after the bottom of the entire multi-line buffer, so if
you're editing something that fills more than one screen you only see
it on the last page.

I was going to suggest using "vared -r" to set the right prompt, but
that doesn't work correctly either; it's visible only at the top of
the first page and then only the first time it might appear, it never
gets redrawn as you scroll up and down.  And if you set the "vared -p"
prompt to something that contains a newline, everything to the left of
the newline eventually disappears if you scroll to a second screen and
back.  Seems that the only things handled correctly are PREDISPLAY and
POSTDISPLAY.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Extend `zed' with status bar, is it possible?
  2018-10-20 17:35 ` Bart Schaefer
@ 2018-10-20 21:40   ` Sebastian Gniazdowski
  0 siblings, 0 replies; 4+ messages in thread
From: Sebastian Gniazdowski @ 2018-10-20 21:40 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh hackers list

On Sat, 20 Oct 2018 at 19:35, Bart Schaefer <schaefer@brasslantern.com> wrote:
>
> On Wed, Oct 17, 2018 at 10:10 PM Sebastian Gniazdowski
> <sgniazdowski@gmail.com> wrote:
> >
> > I'm looking at vared and it seems that there is no way to
> > replace/append-to vared's last line (last POSTDISPLAY line?) with some
> > custom contents, basically a status bar. Does someone know a way?
>
> Do you mean a status that changes in some way during vared execution,
> like showing the line/column of the cursor position or similar?
>
> If all you want is to set POSTDISPLAY on entry, you can do it by
> passing a line-init widget to "vared -i ...".  However, POSTDISPLAY
> only appears after the bottom of the entire multi-line buffer, so if
> you're editing something that fills more than one screen you only see
> it on the last page.

Tried it, behaves like described, but also isn't permanent, the added
line disappears when going to other page and then back to the last
one.

> I was going to suggest using "vared -r" to set the right prompt, but
> that doesn't work correctly either; it's visible only at the top of
> the first page and then only the first time it might appear, it never
> gets redrawn as you scroll up and down.  And if you set the "vared -p"
> prompt to something that contains a newline, everything to the left of
> the newline eventually disappears if you scroll to a second screen and
> back.  Seems that the only things handled correctly are PREDISPLAY and
> POSTDISPLAY.

The tmux version would work very well. I know this seams a no-go to
use some somewhat large foreign binary project to hack vared, but it's
like git using perl for many of its subcommands – I've read that
someone wrote "A machine without perl is essentially broken to me" in
this context. Tmux isn't as that much widespread as perl, but is also
a basic command commonly available. So it's a reason to be happy that
such command can provide /dev/tty* for vared, to open 2 windows, with
a status bar in one of them, with e.g. vim mode and current line. I've
described use of tmux in other post in this thread. Maybe you could
guess what bad happens with stdin/stdout so that tmux cannot start for
the second time.

--
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-10-20 21:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-18  5:10 Extend `zed' with status bar, is it possible? Sebastian Gniazdowski
2018-10-18 16:27 ` Sebastian Gniazdowski
2018-10-20 17:35 ` Bart Schaefer
2018-10-20 21:40   ` Sebastian Gniazdowski

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).