Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(preview): attach to popup if already open #622

Merged
merged 4 commits into from
Sep 14, 2022

Conversation

seblyng
Copy link
Contributor

@seblyng seblyng commented Sep 12, 2022

I agree with your comment here: #609 (comment)

Made it to always attach to the popup if it's already open

@seblyng
Copy link
Contributor Author

seblyng commented Sep 12, 2022

Maybe we should add an option focusable: bool or something in case someone opens a popup with an autocmd or something. I am not too sure if that is necessary. What do you think?

teal/gitsigns/popup.tl Outdated Show resolved Hide resolved
teal/gitsigns/popup.tl Outdated Show resolved Hide resolved
@seblyng seblyng force-pushed the attach_to_popup branch 2 times, most recently from b06b654 to d8b9bbb Compare September 13, 2022 18:10
@seblyng
Copy link
Contributor Author

seblyng commented Sep 13, 2022

I don't really like the name popup.is_open0, but I went with it because of popup.create0, and because I couldn't think of another name

teal/gitsigns/actions.tl Outdated Show resolved Hide resolved
teal/gitsigns/actions.tl Outdated Show resolved Hide resolved
teal/gitsigns/popup.tl Outdated Show resolved Hide resolved
Comment on lines 194 to 195
local exists = pcall(api.nvim_win_get_var, winid, var)
if exists then
Copy link
Owner

@lewis6991 lewis6991 Sep 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
local exists = pcall(api.nvim_win_get_var, winid, var)
if exists then
if vim.w[winid][var] ~= nil then

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing this requires to change types.d.tl so we don't get a compile error. However I couldn't get it to work. Any tips on how to do it?

teal/gitsigns/popup.tl Outdated Show resolved Hide resolved
@lewis6991
Copy link
Owner

I've gone ahead and fixed up the PR

@seblyng
Copy link
Contributor Author

seblyng commented Sep 14, 2022

I've gone ahead and fixed up the PR

Thanks! That looks better

@lewis6991 lewis6991 changed the title feat: attach to popup if already open feat(preview): attach to popup if already open Sep 14, 2022
@lewis6991 lewis6991 merged commit 2300e4e into lewis6991:main Sep 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants