aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ex_cmds/help_spec.lua
blob: 0ec724921845c7500785ddf9f42b8c336b604ba2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
local helpers = require('test.functional.helpers')(after_each)

local clear = helpers.clear
local command = helpers.command
local eq = helpers.eq
local funcs = helpers.funcs

describe(':help', function()
  before_each(clear)

  it('window closed makes cursor return to a valid win/buf #9773', function()
    helpers.add_builddir_to_rtp()
    command('help help')
    eq(1001, funcs.win_getid())
    command('quit')
    eq(1000, funcs.win_getid())

    command('autocmd WinNew * wincmd p')

    command('help help')
    -- Window 1002 is opened, but the autocmd switches back to 1000 and
    -- creates the help buffer there instead.
    eq(1000, funcs.win_getid())
    command('quit')
    -- Before #9773, Nvim would crash on quitting the help window.
    eq(1002, funcs.win_getid())
  end)
end)