[vim/vim] Fail to detect the windows position when start a job in vim (#2559)

36 views
Skip to first unread message

Wang Shidong

unread,
Jan 16, 2018, 10:16:13 AM1/16/18
to vim/vim, Subscribed

I use byzanz-record to record gif.

so I use this command to record a 10 second gif

let g:wsd = job_start(['byzanz-record', '-d', 10, '-x', 0, '-y', 0, '-w', 1366, '-y', 743, '/home/wsdjeg/Pictures/testvim.gif'])

my screen is 1366 * 768, so I want to recort my workspace without i3-status ( 1366 * 743 )

in neovim, it works well ( using jobstart() ), but in vim8 it only record the half of my i3-status

the gif generate in vim8 is:

testvim

but in neovim, it is:
2018-01-16-23-08-57


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub

Wang Shidong

unread,
Jan 16, 2018, 10:17:12 AM1/16/18
to vim/vim, Subscribed

This is my script for record gif

let s:record_window_x = 0
let s:record_window_y = 0
let s:record_window_w = 1366
let s:record_window_h = 743
let s:record_id = 0
let s:record_file = ''
function! s:start_record() abort
  let s:cmd = ['byzanz-record', '-d', 40, '-x', s:record_window_x, '-y', s:record_window_y, '-w', s:record_window_w, '-h', s:record_window_h]
  redraw!
  let time = strftime('%Y-%m-%d-%H-%M-%S')
  let fname = [expand('~/Pictures/') . time . '.gif']
  let s:record_file = 'file://' . fname[0]
  let s:record_id = s:JOB.start(s:cmd + fname, {'on_exit' : funcref('s:record_exit')})
endfunction

Wang Shidong

unread,
Jan 16, 2018, 10:18:40 AM1/16/18
to vim/vim, Subscribed

This is my whole screen:

2018-01-16-23 11 33

Kazunobu Kuriyama

unread,
Jan 16, 2018, 5:37:30 PM1/16/18
to vim/vim, Subscribed
let g:wsd = job_start(['byzanz-record', '-d', 10, '-x', 0, '-y', 0, '-w', 1366, '-y', 743, '/home/wsdjeg/Pictures/testvim.gif'])

Are you sure that the string just left to the number 743 is '-y'? I don't know about byzanz at all, but I guess most people tend to use '-h' instead of '-y' when they have a commma-seprated list like that shown above, guessing they are something about coordinates.

Wang Shidong

unread,
Jan 16, 2018, 6:31:52 PM1/16/18
to vim/vim, Subscribed

oh, yeah,that is a mistake. but you check the script I show in first comment. even if use right argv -x 0 -y 0 -w 1366 -h 743 when using vim8 job, the record aero is wrong.

Kazunobu Kuriyama

unread,
Jan 16, 2018, 7:40:11 PM1/16/18
to vim/vim, Subscribed

oh, yeah,that is a mistake. but you check the script I show in first comment.

Where is "the script I show in first comment"? Are you referring to a snippet of Vim script in your second comment? Then, in that snippet, we have

let s:record_id = s:JOB.start(s:cmd + fname, {'on_exit' : funcref('s:record_exit')})

Where is the definition JOB? With such an incomplete script, how did you verify your claim that "even if use right argv -x 0 -y 0 -w 1366 -h 743 when using vim8 job, the record aero is wrong" with Vim at work?

Saransh

unread,
Jan 20, 2018, 4:04:26 AM1/20/18
to vim/vim, Subscribed

The script works well with -h 743 on ms windows. What OS are you using?

Wang Shidong

unread,
Jan 20, 2018, 8:50:07 AM1/20/18
to vim/vim, Subscribed

@nuko8 here is my test step:

in neovim:

run:

let g:wsd = jobstart(['byzanz-record', '-d', 10, '-x', 0, '-y', 0, '-w', 1366, '-h', 743, '/home/wsdjeg/Pictures/testneovim.gif'])

I get:

testneovim

in vim8:

run:

call job_start(['byzanz-record', '-d', 10, '-x', 0, '-y', 0, '-w', 1366, '-h', 743, '/home/wsdjeg/Pictures/testvim.gif'])

I get:

testvim1

Wang Shidong

unread,
Jan 20, 2018, 8:50:57 AM1/20/18
to vim/vim, Subscribed

my os is archlinux, and I am using i3-wm

Christian Brabandt

unread,
Jan 20, 2018, 9:15:27 AM1/20/18
to vim/vim, Subscribed

isn't that a problem of byzanz then, since the parameters are the same?

Christian Brabandt

unread,
Jan 20, 2018, 9:15:52 AM1/20/18
to vim/vim, Subscribed

BTW, did you check with a different WM, terminal or Operating system?

Wang Shidong

unread,
Jan 20, 2018, 9:20:16 AM1/20/18
to vim/vim, Subscribed

@chrisbra the parameter are same when I run it in vim and neovim. BTW, I have check it in gvim, it is same as vim8. I can not test it in other os/wm now. I think I can do it in the next weekend. I am so sorry.

Kazunobu Kuriyama

unread,
Jan 20, 2018, 6:21:10 PM1/20/18
to vim/vim, Subscribed

EDIT: I think it is a bug about how vim8 detect the topleft position of the whole screen.

It is true that any X client is allowed to request its startup position to the X11 server, but usually, by an established convention, window managers are permitted to intercept such a request and examine whether or not the one is acceptable in view of their resource management policy; if it is acceptable, window managers forward it to the server as it is; otherwise, they modify it so that it will fit the policy, and then the modified one is sent to the server. The client will be notified of the moderation later and is supposed to live with it.

Also, remember that Vim is not an X client itself; it's virtual terminal emulators that primarily communicate with the window manager. As to what is seen as if Vim behaved like an X client (e.g., its changing the contents of the title bar of the terminal), Vim owes it to terminal's functionality (Rigorously speaking, I should talk about the selection mechanism; in view of that, Vim is surely an X client. But I don't want to talk about it further in order to keep our focus on the issue itself.)

Accordingly, for the cases like this issue, what should be investigated first is either the window manager or the terminal in use. IOW, common sense tells us Vim is the last suspect of the case.

I suspect those are the primary reasons most people have been incredulous to your claim. Accordingly, your further effort to address them could help us convince it.

I can not test it in other os/wm now.

Any standard X11 should have twm.

Reply all
Reply to author
Forward
0 new messages