Rudimentary Touch Bar support #528
Conversation
- in addition to being called when a file is read or written, as before
…e tracking Also adds -currentWindow to NeoVimTab for convenience
Thank you for the PR. I'll review it and come back to you. |
I couldn't reproduce this on macOS 10.13, but it looks like I was setting the segmented control titles incorrectly — I've pushed a fix that will hopefully correct this on earlier versions. (If you are also on 10.13, then I'm a little lost as to why this issue would occur |
Thanks. Yes, I'm on 10.12... I'll re-check and give you feedback. :) |
func updateTouchBarTab() { | ||
guard let tabsControl = getTabsControl() else { return } | ||
tabsCache = self.agent.tabs() | ||
if tabsControl.numberOfItems != tabsCache.count { |
qvacua
Oct 24, 2017
Owner
This seems to be the problematic check (on 10.12.x at least): If I remove it
guard ...
tabsCache = ...
tabsControl.reloadData()
tabsControl.selectedIndex = selectedTabIndex()
return // do we need `reloadItems(at:)` even we reload completely?
the touch bar is updated correctly.
I think that the count check is too coarse and it's not expensive just to reload here. (We could iterate through all the tabs and windows and update the touch bar items individually, but that's probably an overkill.) The transition of the touch bar when the number of tabs changes is not smooth, but I think that that's a minor detail we can improve later. 😀
This seems to be the problematic check (on 10.12.x at least): If I remove it
guard ...
tabsCache = ...
tabsControl.reloadData()
tabsControl.selectedIndex = selectedTabIndex()
return // do we need `reloadItems(at:)` even we reload completely?
the touch bar is updated correctly.
I think that the count check is too coarse and it's not expensive just to reload here. (We could iterate through all the tabs and windows and update the touch bar items individually, but that's probably an overkill.) The transition of the touch bar when the number of tabs changes is not smooth, but I think that that's a minor detail we can improve later.
|
||
func updateTouchBarCurrentBuffer() { | ||
guard let tabsControl = getTabsControl() else { return } | ||
tabsCache = self.agent.tabs() |
qvacua
Oct 24, 2017
Owner
I think that it'd be better to update tabsCache
at appropriate places in NeoVimView+UiBridge
since it's not necessarily touch bar specific (although it's currently used only by the touch bar logic)
I think that it'd be better to update tabsCache
at appropriate places in NeoVimView+UiBridge
since it's not necessarily touch bar specific (although it's currently used only by the touch bar logic)
Adds a basic Safari-style control for switching between open tabs, showing the filename of the most recently selected window within that tab as the title (which the nvim provided tab bar behaviour).
This addition required some modifications to
NeoVimServer
andNeoVimView+Api
which do not appear to have broken anything, but I am not familiar enough with the codebase to be completely sure.I hope this is useful for some people; if it is, I'll work on adding more Touch Bar features.
Testing note: if you don't have a Touch Bar, Xcode has a Touch Bar simulator (Window > Show Touch Bar, or ⌘⇧5).