Skip to content

How to Get Popup Texts (in multi-popup Layout) Before Unmount #356

@harrisoncramer

Description

@harrisoncramer

Hello, thanks for the awesome plugin.

If I have several popups rendered in a Layout, and I want to get their text content before they are closed via normal Vim methods (for instance if someone uses :q to close the layout) how could I do this?

We have tried to get the text content by referencing the popup.bufnr for each, but this does not work. For instance:

  popup:on(event.BufUnload, function()
    -- Get the buffer text here via popup.bufnr
      local lines = vim.api.nvim_buf_get_lines(popup.bufnr, 0, -1, false)
  end)

This does not work because the popup is already removed by the time these events fire, and we see an error: Invalid buffer id: 11

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions