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

fix(events.lua): Listen for default and user-configured sidebar_filetype close events #503

Merged
merged 2 commits into from
May 22, 2023

Conversation

03juan
Copy link
Contributor

@03juan 03juan commented May 22, 2023

Creates default BufWinLeave autocmd and appends custom option.event if it differs from the default.

Fails silently using pcall if the other event already deleted the autocmd from line 192.

Closes #502

Tested with "print debugs"

local ok, _ = pcall(del_autocmd, autocmd)
if not ok then
  print("couldn't delete autocmd", vim.inspect(autocmd), vim.inspect(e))
else
  print("deleted autocmd", vim.inspect(autocmd), vim.inspect(e))
end
  • Closing with :q
    image

  • Toggling
    image

@03juan
Copy link
Contributor Author

03juan commented May 22, 2023

The close events are cleared correctly both when toggling and quitting:

  • Toggle
    • Before
      image
    • After
      image
  • Quit
    • Before
      image
    • After
      image

@03juan
Copy link
Contributor Author

03juan commented May 22, 2023

Possibly needs documentation changes to README?

Copy link
Collaborator

@Iron-E Iron-E left a comment

Choose a reason for hiding this comment

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

Just one question, other than that it looks good. I don't think the README needs adjusting, this seems like something that can/should be done without requiring user knowledge

lua/barbar/events.lua Outdated Show resolved Hide resolved
@Iron-E Iron-E added the bug Something isn't working label May 22, 2023
Short-circuit when `option.event == nil` and simplify testing for equality.
@03juan
Copy link
Contributor Author

03juan commented May 22, 2023

I agree about the documentation, this is an implementation detail.

@Iron-E Iron-E merged commit f0212c3 into romgrk:master May 22, 2023
@Iron-E
Copy link
Collaborator

Iron-E commented May 22, 2023

Thanks for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Closing neo-tree window with :q throws error in WinScrolled autocomd
2 participants