Repository: neovim/neovim
File: test/functional/ui/float_spec.lua (Lua)

Code before:

      api.nvim_win_set_config(win, {hide=true})
      if multigrid then
        screen:expect{grid=[[
        ## grid 1
          [2:----------------------------------------]|*6
          [3:----------------------------------------]|
        ## grid 2
          ^                                        |
          {0:~                                       }|*5
        ## grid 3
                                                  |

        ## grid 4 (hidden)
          {1:          }|
          {2:~         }|
        ]], float_pos = {}}
      else
        screen:expect([[
          ^                                        |
          {0:~                                       }|*5
                                                  |
        ]])
      end

      -- check cursor visible
      api.nvim_set_current_win(win)
      if multigrid then
        screen:expect({
          grid = [[
          ## grid 1
            [2:----------------------------------------]|*6
            [3:----------------------------------------]|
          ## grid 2
                                                    |
            {0:~                                       }|*5
          ## grid 3
                                                    |
          ## grid 4 (hidden)
            {1:          }|
            {2:~         }|
          ]], win_viewport={
          [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
          [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
        }, win_viewport_margins={
          [2] = {
            bottom = 0,
            left = 0,
            right = 0,
            top = 0,
            win = 1000

Review comment (suggestion):
```suggestion
      -- 
      -- Cursor visibility:
      --
      -- Cursor is not visible in a hide=true floating window.
```

Code after:
          ^                                        |
          {0:~                                       }|*7
        ## grid 3
                                                  |
        ## grid 4
          {5:┌────────────────────────────────────────┐}|
          {5:│}{1:                                        }{5:│}|*2
          {5:└────────────────────────────────────────┘}|
        ]], float_pos={
          [4] = {1001, "SW", 1, 8, 0, true, 50, 1, 4, 0};
        }, win_viewport={
          [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
          [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
        }}
      else
        screen:expect{grid=[[
          ^                                        |
          {0:~                                       }|*3
          {5:┌──────────────────────────────────────┐}|
          {5:│}{1:                                      }{5:│}|*2
          {5:└──────────────────────────────────────┘}|
                                                  |
        ]]}
      end

      api.nvim_win_close(win, true)
      if multigrid then
        screen:expect{grid=[[
        ## grid 1
          [2:----------------------------------------]|*8
          [3:----------------------------------------]|
        ## grid 2
          ^                                        |
          {0:~                                       }|*7
        ## grid 3
                                                  |
        ]], win_viewport={
          [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
        }}
      else
        screen:expect{grid=[[
          ^                                        |
          {0:~                                       }|*7
                                                  |
        ]]}
      end
    end)

    describe('no crash after moving and closing float window #21547', function()
      local function test_float_move_close(cmd)
        local float_opts = {relative = 'editor', row = 1, col = 1, width = 10, height = 10}