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 lcd/tcd #1078

Merged
merged 1 commit into from
Jun 30, 2024
Merged

Fix lcd/tcd #1078

merged 1 commit into from
Jun 30, 2024

Conversation

shanesmith
Copy link
Contributor

The following code path effectively turned any lcd or tcd into a cd.

  • lcd (or tcd) from nvim
  • handled by DirChanged autocmd from NvimView.swift
  • fires .dirchanged event
  • handled by autoCommandEvent() in NvimView+UiBridge.swift
  • calls cwdChanged() in NvimView+UiBridge.swift
  • fires event .cwdChanged
  • handled by subscribeToNvimViewEvents() in MainWindow.swift
  • calls cwdChanged() in MainWindow+Delegates.swift
  • fires even .cd
  • handled by typedReduce() in MainWindowReducer.swift
  • sets state.cwdToSet
  • state change handled by subscribeToStateChange() in MainWindow.swift
  • sets self.neoVimView.cwd
  • handled by var cwd setter in NvimView.swift
  • calls nvimSetCurrentDir() which sets global nvim cwd

This chain had to be broken somewhere. The state.cwdToSet line in MainWindowReducer.swift has a comment that it's set to "ensure updates also send to tab bar". To fix we remove that line and instead set the tab bar cwd earlier in the cahin in NvimView+UiBridge.swift.

I don't normally use the custom tab bar or file browser, but have tested them with this change and they seem to still work well.

Fixes #1027

The following code path effectively turned any `lcd` or `tcd` into a
`cd`.

- `lcd` (or `tcd`) from nvim
- handled by `DirChanged` autocmd from NvimView.swift
- fires `.dirchanged` event
- handled by autoCommandEvent() in NvimView+UiBridge.swift
- calls cwdChanged() in NvimView+UiBridge.swift
- fires event `.cwdChanged`
- handled by `subscribeToNvimViewEvents()` in MainWindow.swift
- calls `cwdChanged()` in MainWindow+Delegates.swift
- fires even `.cd`
- handled by `typedReduce()` in MainWindowReducer.swift
- sets `state.cwdToSet`
- state change handled by `subscribeToStateChange()` in MainWindow.swift
- sets `self.neoVimView.cwd`
- handled by `var cwd` setter in NvimView.swift
- calls `nvimSetCurrentDir()` which sets global nvim cwd

This chain had to be broken somewhere. The `state.cwdToSet` line in
MainWindowReducer.swift has a comment that it's set to "ensure updates
also send to tab bar". To fix we remove that line and instead set the
tab bar cwd earlier in the cahin in NvimView+UiBridge.swift.

I don't normally use the custom tab bar or file browser, but have tested
them with this change and they seem to still work well.

Fixes qvacua#1027
@georgeharker
Copy link
Collaborator

georgeharker commented Jun 30, 2024 via email

@qvacua qvacua merged commit 4a6adfd into qvacua:master Jun 30, 2024
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.

tcd & lcd not working in 0.45
3 participants