[vim/vim] popup-windows: no scrollbar is displayed for terminal buffers (Issue #10497)

7 views
Skip to first unread message

bfrg

unread,
May 28, 2022, 3:39:40 PM5/28/22
to vim/vim, Subscribed

Steps to reproduce

Run vim --clean -S test.vim, with

vim9script

writefile(range(100), '/tmp/testfile')

term_start(['cat', '/tmp/testfile'], {hidden: true})
    ->popup_create({
        minwidth: 80,
        maxwidth: 80,
        minheight: 10,
        maxheight: 10,
        scrollbar: true,
        border: []
    })

Expected behaviour

I would have expected to see a scrollbar just like when a regular buffer is displayed in a popup window.

On the other hand, :h popup-terminal says:

- When the job ends, the popup window closes.

which doesn't occur here.

I think that keeping the popup window open after the job ends can be useful and should therefore be kept as it is right now. One example I can think if is executing the current python (bash, julia, lua, perl, ...) buffer and displaying its output in a popup-terminal, as an alternative to :!python % or :terminal python %.

Example:

# File: after/ftplugin/python.vim
nnoremap <buffer> g<cr> <scriptcmd>term_start(['python', expand('%')], {hidden: true, norestore: true})->popup_create({pos: 'botright', line: &lines - &cmdheight, col: 1, minwidth: &columns - 2, maxwidth: &columns - 2, minheight: float2nr(&lines * 0.35), maxheight: float2nr(&lines * 0.35), border: [], scrollbar: true})<cr>

Version of Vim

8.2.5037

Environment

Linux

Logs and stack traces

No response


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/10497@github.com>

Bram Moolenaar

unread,
May 29, 2022, 9:13:53 AM5/29/22
to vim/vim, Subscribed

Closed #10497 as completed via d28950f.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/10497/issue_event/6698283939@github.com>

Bram Moolenaar

unread,
May 29, 2022, 12:03:56 PM5/29/22
to vim...@googlegroups.com, bfrg

> ### Steps to reproduce
>
> Run `vim --clean -S test.vim`, with
> ```vim
> vim9script
>
> writefile(range(100), '/tmp/testfile')
>
> term_start(['cat', '/tmp/testfile'], {hidden: true})
> ->popup_create({
> minwidth: 80,
> maxwidth: 80,
> minheight: 10,
> maxheight: 10,
> scrollbar: true,
> border: []
> })
> ```
>
> ### Expected behaviour
>
> I would have expected to see a scrollbar just like when a regular
> buffer is displayed in a popup window.

Yes, but it can only appear after the terminal job has finished.
Patch 8.2.5038 makes this work. I also had to fix scrolling by clicking
in the scrollbar.

> On the other hand, `:h popup-terminal` says:
> ```
> - When the job ends, the popup window closes.
> ```
> which doesn't occur here.
>
> I think that keeping the popup window open after the job ends can be
> useful and should therefore be kept as it is right now.

I think that is a documentation error, I'll adjust the help.


--
GUARD #1: What, ridden on a horse?
ARTHUR: Yes!
GUARD #1: You're using coconuts!
ARTHUR: What?
GUARD #1: You've got two empty halves of coconut and you're bangin' 'em
together.
The Quest for the Holy Grail (Monty Python)

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages