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 `neoVimBuffer` function was updated in #1015 to used a lua script
through `nvimExecLua`. The script returns the dictionary retrieved from
the `getbufinfo` vim functions. The issue is that this can grow very
large, especially the `variables` entry, and can cause the lua stack to
grow too big and error.
In the end the `neoVimBuffer` function only needs a small handful of the
entries from `getbufinfo`, and so the lua script has been updated to
return a dictionary with only those entries.
At the same time the `hasDirtyBuffers` function was found to also return
the `getbufinfo` dictionary and was similarly fixed. It was also noticed
that the argument passed into `getbuinfo` here was a vim style
dictionary and not valid lua. This made `hasDirtyBuffers` fail and
caused an issue in `MainWindow.windowShouldClose` where selecting `File
> Close Window` would close the window even when dirty buffers were
present. The proper lua dictionary syntax is now used and fixes this
issues.
Fixes#1044
Additionally: Pick up system accent color properly when no colors set.
NvimView+Resize.swift:
- Now transmitting Tabline, TablineFill colors to the VimR
UI, as well as TablineSel
- Replace the built-in get() + nvim_get_hl() method because they don't
have handle 'link' highlights properly (they return -1 for color code)
- defined a new GetHiColor vimscript method that behaves like get()
but also reads `link` type highlight groups by following the
link.
NvimView+Types.swift:
- visualForegroundColor is picked up from user accent color in System
Settings using NSColor.Name("controlAccentColor")
- Updated to include all additional colors
NvimView+UiBridge.swift:
- Updated MessagePackUtils value code to accomodate new color code fields
Tabs/Tab.swift:
- Get Selected tab color from TablineSel
Tabs/TabBar.swift:
- Set tab bar color to TablineFill
Tabs/Theme.swift:
- Add new fields for TablineFill and TablineSel color corresponding to
tab bar background and selected tab colors
- Minor rearranging of field order
VimR/Theme.swift:
- Add new fields for the tab bar, tab, and selected tab colors