mirror of
https://github.com/qvacua/vimr.git
synced 2024-09-11 17:15:34 +03:00
Compare commits
8 Commits
8d953fa0a0
...
5193a32cdb
Author | SHA1 | Date | |
---|---|---|---|
|
5193a32cdb | ||
|
39b4618932 | ||
|
483a9e32d4 | ||
|
82b6f33e53 | ||
|
3be3579861 | ||
|
ee45367be5 | ||
|
6396944b81 | ||
|
ef0b105056 |
@ -140,37 +140,6 @@ extension NvimView {
|
|||||||
context.restoreGState()
|
context.restoreGState()
|
||||||
}
|
}
|
||||||
|
|
||||||
private func drawResizeInfo(
|
|
||||||
in context: CGContext, with dirtyUnionRect: CGRect
|
|
||||||
) {
|
|
||||||
context.setFillColor(self.theme.background.cgColor)
|
|
||||||
context.fill(dirtyUnionRect)
|
|
||||||
|
|
||||||
let boundsSize = self.bounds.size
|
|
||||||
|
|
||||||
let emojiSize = self.currentEmoji.size(withAttributes: emojiAttrs)
|
|
||||||
let emojiX = (boundsSize.width - emojiSize.width) / 2
|
|
||||||
let emojiY = (boundsSize.height - emojiSize.height) / 2
|
|
||||||
|
|
||||||
let discreteSize = self.discreteSize(size: boundsSize)
|
|
||||||
let displayStr = "\(discreteSize.width) × \(discreteSize.height)"
|
|
||||||
let infoStr = "(You can turn on live resizing feature in the Advanced preferences)"
|
|
||||||
|
|
||||||
var (sizeAttrs, infoAttrs) = (resizeTextAttrs, infoTextAttrs)
|
|
||||||
sizeAttrs[.foregroundColor] = self.theme.foreground
|
|
||||||
infoAttrs[.foregroundColor] = self.theme.foreground
|
|
||||||
|
|
||||||
let size = displayStr.size(withAttributes: sizeAttrs)
|
|
||||||
let (x, y) = ((boundsSize.width - size.width) / 2, emojiY - size.height)
|
|
||||||
|
|
||||||
let infoSize = infoStr.size(withAttributes: infoAttrs)
|
|
||||||
let (infoX, infoY) = ((boundsSize.width - infoSize.width) / 2, y - size.height - 5)
|
|
||||||
|
|
||||||
self.currentEmoji.draw(at: CGPoint(x: emojiX, y: emojiY), withAttributes: emojiAttrs)
|
|
||||||
displayStr.draw(at: CGPoint(x: x, y: y), withAttributes: sizeAttrs)
|
|
||||||
infoStr.draw(at: CGPoint(x: infoX, y: infoY), withAttributes: infoAttrs)
|
|
||||||
}
|
|
||||||
|
|
||||||
private func drawPinchImage(in context: CGContext) {
|
private func drawPinchImage(in context: CGContext) {
|
||||||
context.interpolationQuality = .none
|
context.interpolationQuality = .none
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import Cocoa
|
import Cocoa
|
||||||
|
import MessagePack
|
||||||
import RxNeovim
|
import RxNeovim
|
||||||
import RxSwift
|
import RxSwift
|
||||||
|
|
||||||
@ -45,28 +46,51 @@ public extension NvimView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override func scrollWheel(with event: NSEvent) {
|
override func scrollWheel(with event: NSEvent) {
|
||||||
let (deltaX, deltaY) = (event.scrollingDeltaX, event.scrollingDeltaY)
|
let (deltaX, deltaY) = self.scrollDelta(forEvent: event)
|
||||||
|
|
||||||
if deltaX == 0, deltaY == 0 { return }
|
if deltaX == 0, deltaY == 0 { return }
|
||||||
|
|
||||||
let cellPosition = self.cellPosition(forEvent: event)
|
let vimInput = self.vimScrollInput(forEvent: event)
|
||||||
|
|
||||||
|
let mousescroll: String
|
||||||
|
if event.hasPreciseScrollingDeltas { // trackpad
|
||||||
|
let (absDeltaX, absDeltaY) = (abs(deltaX), abs(deltaY))
|
||||||
|
mousescroll = "ver:\(absDeltaY),hor:\(absDeltaX)"
|
||||||
|
} else {
|
||||||
|
mousescroll = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
return self.api.nvimExecLua(code: """
|
||||||
|
local arg = {...}
|
||||||
|
|
||||||
|
if vim.g.vimr_save_mousescroll == nil then
|
||||||
|
vim.g.vimr_save_mousescroll = vim.o.mousescroll
|
||||||
|
end
|
||||||
|
|
||||||
|
if arg[1] ~= "" then
|
||||||
|
vim.o.mousescroll = arg[1]
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_input(arg[2])
|
||||||
|
|
||||||
|
-- nvim_input() only queues input, schedule resetting
|
||||||
|
-- mousescroll to after the input hase been processed
|
||||||
|
vim.schedule(function()
|
||||||
|
vim.o.mousescroll = vim.g.vimr_save_mousescroll
|
||||||
|
vim.g.vimr_save_mousescroll = nil
|
||||||
|
end)
|
||||||
|
""", args: [MessagePackValue(mousescroll), MessagePackValue(vimInput)])
|
||||||
|
.subscribe(onFailure: { [weak self] error in
|
||||||
|
self?.log.error("Error in \(#function): \(error)")
|
||||||
|
})
|
||||||
|
.disposed(by: self.disposeBag)
|
||||||
|
}
|
||||||
|
|
||||||
|
internal func scrollDelta(forEvent event: NSEvent) -> (Int, Int) {
|
||||||
let isTrackpad = event.hasPreciseScrollingDeltas
|
let isTrackpad = event.hasPreciseScrollingDeltas
|
||||||
if isTrackpad == false {
|
|
||||||
let (vimInputX, vimInputY) = self.vimScrollInputFor(
|
|
||||||
deltaX: deltaX,
|
|
||||||
deltaY: deltaY,
|
|
||||||
modifierFlags: event.modifierFlags,
|
|
||||||
cellPosition: cellPosition
|
|
||||||
)
|
|
||||||
self.api
|
|
||||||
.nvimInput(keys: vimInputX).asCompletable()
|
|
||||||
.andThen(self.api.nvimInput(keys: vimInputY).asCompletable())
|
|
||||||
.subscribe(onError: { [weak self] error in
|
|
||||||
self?.log.error("Error in \(#function): \(error)")
|
|
||||||
})
|
|
||||||
.disposed(by: self.disposeBag)
|
|
||||||
|
|
||||||
return
|
if !isTrackpad {
|
||||||
|
return (Int(event.scrollingDeltaX), Int(event.scrollingDeltaY))
|
||||||
}
|
}
|
||||||
|
|
||||||
if event.phase == .began {
|
if event.phase == .began {
|
||||||
@ -74,41 +98,23 @@ public extension NvimView {
|
|||||||
self.trackpadScrollDeltaY = 0
|
self.trackpadScrollDeltaY = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
self.trackpadScrollDeltaX += deltaX
|
self.trackpadScrollDeltaX += event.scrollingDeltaX
|
||||||
self.trackpadScrollDeltaY += deltaY
|
self.trackpadScrollDeltaY += event.scrollingDeltaY
|
||||||
|
|
||||||
let (deltaCellX, deltaCellY) = (
|
let (deltaCellX, deltaCellY) = (
|
||||||
(self.trackpadScrollDeltaX / self.cellSize.width).rounded(.toNearestOrEven),
|
(self.trackpadScrollDeltaX / self.cellSize.width).rounded(.toNearestOrEven),
|
||||||
(self.trackpadScrollDeltaY / self.cellSize.height).rounded(.toNearestOrEven)
|
(self.trackpadScrollDeltaY / self.cellSize.height).rounded(.toNearestOrEven)
|
||||||
)
|
)
|
||||||
|
|
||||||
self.trackpadScrollDeltaX.formRemainder(dividingBy: self.cellSize.width)
|
self.trackpadScrollDeltaX.formRemainder(dividingBy: self.cellSize.width)
|
||||||
self.trackpadScrollDeltaY.formRemainder(dividingBy: self.cellSize.height)
|
self.trackpadScrollDeltaY.formRemainder(dividingBy: self.cellSize.height)
|
||||||
|
|
||||||
let (absDeltaX, absDeltaY) = (
|
let (deltaX, deltaY) = (
|
||||||
min(Int(abs(deltaCellX)), maxScrollDeltaX),
|
min(Int(deltaCellX), maxScrollDeltaX),
|
||||||
min(Int(abs(deltaCellY)), maxScrollDeltaY)
|
min(Int(deltaCellY), maxScrollDeltaY)
|
||||||
)
|
)
|
||||||
// Note: sign flip on deltaCellY
|
|
||||||
let (horizSign, vertSign) = (deltaCellX > 0 ? 1 : -1, deltaCellY > 0 ? -1 : 1)
|
|
||||||
self.log
|
|
||||||
.debug(
|
|
||||||
"# scroll: \(cellPosition.row + vertSign * absDeltaY) \(cellPosition.column + horizSign * absDeltaX)"
|
|
||||||
)
|
|
||||||
|
|
||||||
self.api.nvimWinGetCursor(window: RxNeovimApi.Window(0))
|
return (deltaX, deltaY)
|
||||||
.flatMapCompletable { cursor in
|
|
||||||
guard cursor.count == 2 else {
|
|
||||||
self.log.error("Error decoding \(cursor)")
|
|
||||||
return Completable.empty()
|
|
||||||
}
|
|
||||||
return self.api.nvimWinSetCursor(
|
|
||||||
window: RxNeovimApi.Window(0),
|
|
||||||
pos: [cursor[0] + vertSign * absDeltaY, cursor[1] + horizSign * absDeltaX]
|
|
||||||
)
|
|
||||||
}
|
|
||||||
.subscribe(onError: { [weak self] error in
|
|
||||||
self?.log.error("Error in \(#function): \(error)")
|
|
||||||
})
|
|
||||||
.disposed(by: self.disposeBag)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override func magnify(with event: NSEvent) {
|
override func magnify(with event: NSEvent) {
|
||||||
@ -203,35 +209,32 @@ public extension NvimView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func vimScrollEventNamesFor(deltaX: CGFloat, deltaY: CGFloat) -> (String, String) {
|
private func vimScrollInput(forEvent event: NSEvent) -> String {
|
||||||
let typeY = if deltaY > 0 { "ScrollWheelUp" }
|
let cellPosition = self.cellPosition(forEvent: event)
|
||||||
else { "ScrollWheelDown" }
|
|
||||||
|
|
||||||
let typeX = if deltaX < 0 { "ScrollWheelRight" }
|
|
||||||
else { "ScrollWheelLeft" }
|
|
||||||
|
|
||||||
return (typeX, typeY)
|
|
||||||
}
|
|
||||||
|
|
||||||
private func vimScrollInputFor(
|
|
||||||
deltaX: CGFloat, deltaY: CGFloat,
|
|
||||||
modifierFlags: NSEvent.ModifierFlags,
|
|
||||||
cellPosition: Position
|
|
||||||
) -> (String, String) {
|
|
||||||
let vimMouseLocation = self.wrapNamedKeys("\(cellPosition.column),\(cellPosition.row)")
|
let vimMouseLocation = self.wrapNamedKeys("\(cellPosition.column),\(cellPosition.row)")
|
||||||
|
|
||||||
let (typeX, typeY) = self.vimScrollEventNamesFor(deltaX: deltaX, deltaY: deltaY)
|
let vimModifiers = self.vimModifierFlags(event.modifierFlags) ?? ""
|
||||||
|
|
||||||
|
let (deltaX, deltaY) = (event.scrollingDeltaX, event.scrollingDeltaY)
|
||||||
|
|
||||||
let resultX: String
|
let resultX: String
|
||||||
let resultY: String
|
if deltaX == 0 {
|
||||||
if let vimModifiers = self.vimModifierFlags(modifierFlags) {
|
resultX = ""
|
||||||
resultX = self.wrapNamedKeys("\(vimModifiers)\(typeX)") + vimMouseLocation
|
|
||||||
resultY = self.wrapNamedKeys("\(vimModifiers)\(typeY)") + vimMouseLocation
|
|
||||||
} else {
|
} else {
|
||||||
resultX = self.wrapNamedKeys("\(typeX)") + vimMouseLocation
|
let wheel = (deltaX < 0) ? "ScrollWheelRight" : "ScrollWheelLeft"
|
||||||
resultY = self.wrapNamedKeys("\(typeY)") + vimMouseLocation
|
resultX = self.wrapNamedKeys("\(vimModifiers)\(wheel)") + vimMouseLocation
|
||||||
}
|
}
|
||||||
|
|
||||||
return (resultX, resultY)
|
let resultY: String
|
||||||
|
if deltaY == 0 {
|
||||||
|
resultY = ""
|
||||||
|
} else {
|
||||||
|
let wheel = (deltaY < 0) ? "ScrollWheelDown" : "ScrollWheelUp"
|
||||||
|
resultY = self.wrapNamedKeys("\(vimModifiers)\(wheel)") + vimMouseLocation
|
||||||
|
}
|
||||||
|
|
||||||
|
return "\(resultX)\(resultY)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,8 +38,6 @@ extension NvimView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func resizeNeoVimUi(to size: CGSize) {
|
func resizeNeoVimUi(to size: CGSize) {
|
||||||
self.currentEmoji = self.randomEmoji()
|
|
||||||
|
|
||||||
let discreteSize = self.discreteSize(size: size)
|
let discreteSize = self.discreteSize(size: size)
|
||||||
if discreteSize == self.ugrid.size {
|
if discreteSize == self.ugrid.size {
|
||||||
self.markForRenderWholeView()
|
self.markForRenderWholeView()
|
||||||
@ -111,16 +109,26 @@ extension NvimView {
|
|||||||
throw RxNeovimApi.Error.exception(message: "Incompatible neovim version.")
|
throw RxNeovimApi.Error.exception(message: "Incompatible neovim version.")
|
||||||
}
|
}
|
||||||
|
|
||||||
// swiftformat:disable all
|
// swiftformat:disable all
|
||||||
return self.api.nvimExec2(src: """
|
let vimscript = """
|
||||||
let g:gui_vimr = 1
|
function! GetHiColor(hlID, component)
|
||||||
autocmd VimLeave * call rpcnotify(\(channel), 'autocommand', 'vimleave')
|
let color = synIDattr(synIDtrans(hlID(a:hlID)), a:component)
|
||||||
autocmd VimEnter * call rpcnotify(\(channel), 'autocommand', 'vimenter')
|
if empty(color)
|
||||||
autocmd ColorScheme * call rpcnotify(\(channel), 'autocommand', 'colorscheme', get(nvim_get_hl(0, {'id': hlID('Normal')}), 'fg', -1), get(nvim_get_hl(0, {'id': hlID('Normal')}), 'bg', -1), get(nvim_get_hl(0, {'id': hlID('Visual')}), 'fg', -1), get(nvim_get_hl(0, {'id': hlID('Visual')}), 'bg', -1), get(nvim_get_hl(0, {'id': hlID('Directory')}), 'fg', -1), get(nvim_get_hl(0, {'id': hlID('TablineSel')}), 'bg', -1), get(nvim_get_hl(0, {'id': hlID('TablineSel')}), 'fg', -1))
|
return -1
|
||||||
autocmd VimEnter * call rpcrequest(\(channel), 'vimenter')
|
else
|
||||||
""", opts: [:], errWhenBlocked: false)
|
return str2nr(color[1:], 16)
|
||||||
// swiftformat:enable all
|
endif
|
||||||
.asCompletable()
|
endfunction
|
||||||
|
let g:gui_vimr = 1
|
||||||
|
autocmd VimLeave * call rpcnotify(\(channel), 'autocommand', 'vimleave')
|
||||||
|
autocmd VimEnter * call rpcnotify(\(channel), 'autocommand', 'vimenter')
|
||||||
|
autocmd ColorScheme * call rpcnotify(\(channel), 'autocommand', 'colorscheme', GetHiColor('Normal', 'fg'), GetHiColor('Normal', 'bg'), GetHiColor('Visual', 'fg'), GetHiColor('Visual', 'bg'), GetHiColor('Directory', 'fg'), GetHiColor('TablineFill', 'bg'), GetHiColor('TablineFill', 'fg'), GetHiColor('Tabline', 'bg'), GetHiColor('Tabline', 'fg'), GetHiColor('TablineSel', 'bg'), GetHiColor('TablineSel', 'fg'))
|
||||||
|
autocmd VimEnter * call rpcrequest(\(channel), 'vimenter')
|
||||||
|
"""
|
||||||
|
|
||||||
|
return self.api.nvimExec2(src: vimscript, opts: [:], errWhenBlocked: false)
|
||||||
|
.asCompletable()
|
||||||
|
// swiftformat:enable all
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.andThen(
|
.andThen(
|
||||||
|
@ -94,7 +94,8 @@ public extension NvimView {
|
|||||||
public var foreground = NSColor.textColor
|
public var foreground = NSColor.textColor
|
||||||
public var background = NSColor.textBackgroundColor
|
public var background = NSColor.textBackgroundColor
|
||||||
|
|
||||||
public var visualForeground = NSColor.selectedMenuItemTextColor
|
public var visualForeground: NSColor = NSColor(named: NSColor.Name("controlAccentColor")) ?? .selectedMenuItemTextColor
|
||||||
|
// NSColor.selectedMenuItemTextColor
|
||||||
// NSColor.selectedMenuItemColor is deprecated. The doc says that
|
// NSColor.selectedMenuItemColor is deprecated. The doc says that
|
||||||
// NSVisualEffectView.Material.selection should be used instead, but I don't know how to get
|
// NSVisualEffectView.Material.selection should be used instead, but I don't know how to get
|
||||||
// an NSColor from it.
|
// an NSColor from it.
|
||||||
@ -102,13 +103,19 @@ public extension NvimView {
|
|||||||
|
|
||||||
public var directoryForeground = NSColor.textColor
|
public var directoryForeground = NSColor.textColor
|
||||||
|
|
||||||
public var tabForeground = NSColor.textColor
|
public var tabForeground = NSColor.controlColor
|
||||||
public var tabBackground = NSColor.textBackgroundColor
|
public var tabBackground = NSColor.controlBackgroundColor
|
||||||
|
|
||||||
|
public var tabBarForeground = NSColor.textColor
|
||||||
|
public var tabBarBackground = NSColor.windowBackgroundColor
|
||||||
|
|
||||||
|
public var selectedTabForeground = NSColor.selectedTextColor
|
||||||
|
public var selectedTabBackground = NSColor.selectedTextBackgroundColor
|
||||||
|
|
||||||
public init() {}
|
public init() {}
|
||||||
|
|
||||||
public init(_ values: [Int]) {
|
public init(_ values: [Int]) {
|
||||||
if values.count < 7 { preconditionFailure("We need 7 colors!") }
|
if values.count < 11 { preconditionFailure("We need 11 colors!") }
|
||||||
|
|
||||||
let color = ColorUtils.colorIgnoringAlpha
|
let color = ColorUtils.colorIgnoringAlpha
|
||||||
|
|
||||||
@ -121,8 +128,16 @@ public extension NvimView {
|
|||||||
self.directoryForeground = values[4] < 0
|
self.directoryForeground = values[4] < 0
|
||||||
? Theme.default.directoryForeground
|
? Theme.default.directoryForeground
|
||||||
: color(values[4])
|
: color(values[4])
|
||||||
self.tabBackground = values[5] < 0 ? Theme.default.background : color(values[5])
|
|
||||||
self.tabForeground = values[6] < 0 ? Theme.default.foreground : color(values[6])
|
self.tabBarBackground = values[5] < 0 ? Theme.default.tabBarBackground : color(values[5])
|
||||||
|
self.tabBarForeground = values[6] < 0 ? Theme.default.tabBarForeground : color(values[6])
|
||||||
|
|
||||||
|
self.tabBackground = values[7] < 0 ? Theme.default.tabBackground : color(values[7])
|
||||||
|
self.tabForeground = values[8] < 0 ? Theme.default.tabForeground : color(values[8])
|
||||||
|
|
||||||
|
self.selectedTabBackground = values[9] < 0 ? Theme.default.selectedTabBackground : color(values[9])
|
||||||
|
self.selectedTabForeground = values[10] < 0 ? Theme.default.selectedTabForeground : color(values[10])
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public var description: String {
|
public var description: String {
|
||||||
@ -130,6 +145,8 @@ public extension NvimView {
|
|||||||
"fg: \(self.foreground.hex), bg: \(self.background.hex), " +
|
"fg: \(self.foreground.hex), bg: \(self.background.hex), " +
|
||||||
"visual-fg: \(self.visualForeground.hex), visual-bg: \(self.visualBackground.hex)" +
|
"visual-fg: \(self.visualForeground.hex), visual-bg: \(self.visualBackground.hex)" +
|
||||||
"tab-fg: \(self.tabForeground.hex), tab-bg: \(self.tabBackground.hex)" +
|
"tab-fg: \(self.tabForeground.hex), tab-bg: \(self.tabBackground.hex)" +
|
||||||
|
"tabfill-fg: \(self.tabBarForeground.hex), tabfill-bg: \(self.tabBarBackground.hex)" +
|
||||||
|
"tabsel-fg: \(self.selectedTabForeground.hex), tabsel-bg: \(self.selectedTabBackground.hex)" +
|
||||||
">"
|
">"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -513,7 +513,7 @@ extension NvimView {
|
|||||||
|
|
||||||
private func colorSchemeChanged(_ value: MessagePackValue) {
|
private func colorSchemeChanged(_ value: MessagePackValue) {
|
||||||
guard let values = MessagePackUtils.array(
|
guard let values = MessagePackUtils.array(
|
||||||
from: value, ofSize: 7, conversion: { $0.intValue }
|
from: value, ofSize: 11, conversion: { $0.intValue }
|
||||||
) else {
|
) else {
|
||||||
self.bridgeLogger.error("Could not convert \(value)")
|
self.bridgeLogger.error("Could not convert \(value)")
|
||||||
return
|
return
|
||||||
|
@ -310,7 +310,6 @@ public final class NvimView: NSView, NSUserInterfaceValidations, NSTextInputClie
|
|||||||
var pinchBitmap: NSBitmapImageRep?
|
var pinchBitmap: NSBitmapImageRep?
|
||||||
|
|
||||||
var currentlyResizing = false
|
var currentlyResizing = false
|
||||||
var currentEmoji = "😎"
|
|
||||||
|
|
||||||
var _font = NvimView.defaultFont
|
var _font = NvimView.defaultFont
|
||||||
var _cwd = URL(fileURLWithPath: NSHomeDirectory())
|
var _cwd = URL(fileURLWithPath: NSHomeDirectory())
|
||||||
|
@ -107,8 +107,8 @@ extension Tab {
|
|||||||
|
|
||||||
private func adjustColors(_ newIsSelected: Bool) {
|
private func adjustColors(_ newIsSelected: Bool) {
|
||||||
if newIsSelected {
|
if newIsSelected {
|
||||||
self.layer?.backgroundColor = self.theme.tabBackgroundColor.cgColor
|
self.layer?.backgroundColor = self.theme.selectedBackgroundColor.cgColor
|
||||||
self.titleView.textColor = self.theme.tabForegroundColor
|
self.titleView.textColor = self.theme.selectedForegroundColor
|
||||||
self.closeButton.image = self.theme.selectedCloseButtonImage
|
self.closeButton.image = self.theme.selectedCloseButtonImage
|
||||||
} else {
|
} else {
|
||||||
self.layer?.backgroundColor = self.theme.backgroundColor.cgColor
|
self.layer?.backgroundColor = self.theme.backgroundColor.cgColor
|
||||||
|
@ -31,14 +31,14 @@ public final class TabBar<Rep: TabRepresentative>: NSView {
|
|||||||
super.init(frame: .zero)
|
super.init(frame: .zero)
|
||||||
self.configureForAutoLayout()
|
self.configureForAutoLayout()
|
||||||
self.wantsLayer = true
|
self.wantsLayer = true
|
||||||
self.layer?.backgroundColor = theme.backgroundColor.cgColor
|
self.layer?.backgroundColor = theme.tabBarBackgroundColor.cgColor
|
||||||
|
|
||||||
self.addViews()
|
self.addViews()
|
||||||
}
|
}
|
||||||
|
|
||||||
public func update(theme: Theme) {
|
public func update(theme: Theme) {
|
||||||
self._theme = theme
|
self._theme = theme
|
||||||
self.layer?.backgroundColor = theme.backgroundColor.cgColor
|
self.layer?.backgroundColor = theme.tabBarBackgroundColor.cgColor
|
||||||
|
|
||||||
self.needsDisplay = true
|
self.needsDisplay = true
|
||||||
self.tabs.forEach { $0.updateTheme() }
|
self.tabs.forEach { $0.updateTheme() }
|
||||||
|
@ -9,6 +9,8 @@ import MaterialIcons
|
|||||||
public struct Theme {
|
public struct Theme {
|
||||||
public static let `default` = Self()
|
public static let `default` = Self()
|
||||||
|
|
||||||
|
public var separatorColor = NSColor.gridColor
|
||||||
|
public var backgroundColor = NSColor.textBackgroundColor
|
||||||
public var foregroundColor = NSColor.textColor {
|
public var foregroundColor = NSColor.textColor {
|
||||||
didSet {
|
didSet {
|
||||||
self.closeButtonImage = Icon.close.asImage(
|
self.closeButtonImage = Icon.close.asImage(
|
||||||
@ -17,25 +19,21 @@ public struct Theme {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public var backgroundColor = NSColor.textBackgroundColor
|
public var selectedBackgroundColor = NSColor.selectedTextBackgroundColor
|
||||||
public var separatorColor = NSColor.gridColor
|
|
||||||
|
|
||||||
public var selectedForegroundColor = NSColor.selectedTextColor {
|
public var selectedForegroundColor = NSColor.selectedTextColor {
|
||||||
didSet {
|
didSet {
|
||||||
self.selectedCloseButtonImage = Icon.close.asImage(
|
self.selectedCloseButtonImage = Icon.close.asImage(
|
||||||
dimension: self.iconDimension.width,
|
dimension: self.iconDimension.width,
|
||||||
color: self.tabForegroundColor
|
color: self.selectedForegroundColor
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public var selectedBackgroundColor = NSColor.selectedTextBackgroundColor
|
|
||||||
public var tabSelectedIndicatorColor = NSColor.selectedTextColor
|
public var tabSelectedIndicatorColor = NSColor.selectedTextColor
|
||||||
|
|
||||||
public var tabBackgroundColor = NSColor.selectedTextBackgroundColor
|
public var tabBarBackgroundColor = NSColor.windowBackgroundColor
|
||||||
public var tabForegroundColor = NSColor.selectedTextColor
|
public var tabBarForegroundColor = NSColor.textColor
|
||||||
|
|
||||||
public var titleFont = NSFont.systemFont(ofSize: 11)
|
public var titleFont = NSFont.systemFont(ofSize: 11)
|
||||||
public var selectedTitleFont = NSFont.boldSystemFont(ofSize: 11)
|
public var selectedTitleFont = NSFont.boldSystemFont(ofSize: 11)
|
||||||
|
|
||||||
@ -60,12 +58,11 @@ public struct Theme {
|
|||||||
public init() {
|
public init() {
|
||||||
self.closeButtonImage = Icon.close.asImage(
|
self.closeButtonImage = Icon.close.asImage(
|
||||||
dimension: self.iconDimension.width,
|
dimension: self.iconDimension.width,
|
||||||
color: self.tabForegroundColor
|
color: self.foregroundColor
|
||||||
|
|
||||||
)
|
)
|
||||||
self.selectedCloseButtonImage = Icon.close.asImage(
|
self.selectedCloseButtonImage = Icon.close.asImage(
|
||||||
dimension: self.iconDimension.width,
|
dimension: self.iconDimension.width,
|
||||||
color: self.tabForegroundColor
|
color: self.foregroundColor
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1126,7 +1126,7 @@
|
|||||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
CODE_SIGN_IDENTITY = "-";
|
CODE_SIGN_IDENTITY = "-";
|
||||||
COPY_PHASE_STRIP = NO;
|
COPY_PHASE_STRIP = NO;
|
||||||
CURRENT_PROJECT_VERSION = 20240531.221846;
|
CURRENT_PROJECT_VERSION = 20240616.090032;
|
||||||
DEAD_CODE_STRIPPING = YES;
|
DEAD_CODE_STRIPPING = YES;
|
||||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||||
ENABLE_MODULE_VERIFIER = YES;
|
ENABLE_MODULE_VERIFIER = YES;
|
||||||
@ -1192,7 +1192,7 @@
|
|||||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
CODE_SIGN_IDENTITY = "-";
|
CODE_SIGN_IDENTITY = "-";
|
||||||
COPY_PHASE_STRIP = NO;
|
COPY_PHASE_STRIP = NO;
|
||||||
CURRENT_PROJECT_VERSION = 20240531.221846;
|
CURRENT_PROJECT_VERSION = 20240616.090032;
|
||||||
DEAD_CODE_STRIPPING = YES;
|
DEAD_CODE_STRIPPING = YES;
|
||||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
ENABLE_MODULE_VERIFIER = YES;
|
ENABLE_MODULE_VERIFIER = YES;
|
||||||
@ -1225,7 +1225,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 20240531.221846;
|
CURRENT_PROJECT_VERSION = 20240616.090032;
|
||||||
DEFINES_MODULE = YES;
|
DEFINES_MODULE = YES;
|
||||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||||
IBC_MODULE = VimR;
|
IBC_MODULE = VimR;
|
||||||
@ -1250,7 +1250,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 20240531.221846;
|
CURRENT_PROJECT_VERSION = 20240616.090032;
|
||||||
DEFINES_MODULE = YES;
|
DEFINES_MODULE = YES;
|
||||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||||
IBC_MODULE = VimR;
|
IBC_MODULE = VimR;
|
||||||
|
@ -1224,7 +1224,7 @@
|
|||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>0.47.2</string>
|
<string>0.47.3</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleURLTypes</key>
|
<key>CFBundleURLTypes</key>
|
||||||
@ -1241,7 +1241,7 @@
|
|||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>20240531.221846</string>
|
<string>20240616.090032</string>
|
||||||
<key>LSApplicationCategoryType</key>
|
<key>LSApplicationCategoryType</key>
|
||||||
<string>public.app-category.productivity</string>
|
<string>public.app-category.productivity</string>
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSMinimumSystemVersion</key>
|
||||||
|
@ -470,16 +470,16 @@ final class MainWindow: NSObject,
|
|||||||
private func set(tabsThemeWith _: Theme) {
|
private func set(tabsThemeWith _: Theme) {
|
||||||
var tabsTheme = Tabs.Theme.default
|
var tabsTheme = Tabs.Theme.default
|
||||||
|
|
||||||
tabsTheme.foregroundColor = self.theme.foreground
|
tabsTheme.foregroundColor = self.theme.tabForeground
|
||||||
tabsTheme.backgroundColor = self.theme.background
|
tabsTheme.backgroundColor = self.theme.tabBackground
|
||||||
|
|
||||||
tabsTheme.separatorColor = self.theme.background.brightening(by: 0.75)
|
tabsTheme.separatorColor = self.theme.background.brightening(by: 0.75)
|
||||||
|
|
||||||
tabsTheme.selectedForegroundColor = self.theme.highlightForeground
|
tabsTheme.tabBarBackgroundColor = self.theme.tabBarBackground
|
||||||
tabsTheme.selectedBackgroundColor = self.theme.highlightBackground
|
tabsTheme.tabBarForegroundColor = self.theme.tabBarForeground
|
||||||
|
|
||||||
tabsTheme.tabBackgroundColor = self.theme.tabBackground
|
tabsTheme.selectedForegroundColor = self.theme.selectedTabForeground
|
||||||
tabsTheme.tabForegroundColor = self.theme.tabForeground
|
tabsTheme.selectedBackgroundColor = self.theme.selectedTabBackground
|
||||||
|
|
||||||
tabsTheme.tabSelectedIndicatorColor = self.theme.highlightForeground
|
tabsTheme.tabSelectedIndicatorColor = self.theme.highlightForeground
|
||||||
|
|
||||||
|
@ -49,6 +49,12 @@ struct Theme: CustomStringConvertible {
|
|||||||
var tabForeground = NSColor.selectedMenuItemTextColor
|
var tabForeground = NSColor.selectedMenuItemTextColor
|
||||||
var tabBackground = NSColor.selectedContentBackgroundColor
|
var tabBackground = NSColor.selectedContentBackgroundColor
|
||||||
|
|
||||||
|
var tabBarForeground = NSColor.selectedMenuItemTextColor
|
||||||
|
var tabBarBackground = NSColor.selectedContentBackgroundColor
|
||||||
|
|
||||||
|
var selectedTabForeground = NSColor.selectedMenuItemTextColor
|
||||||
|
var selectedTabBackground = NSColor.selectedContentBackgroundColor
|
||||||
|
|
||||||
var cssColor = NSColor(hex: "24292e")!
|
var cssColor = NSColor(hex: "24292e")!
|
||||||
var cssBackgroundColor = NSColor.white
|
var cssBackgroundColor = NSColor.white
|
||||||
var cssA = NSColor(hex: "0366d6")!
|
var cssA = NSColor(hex: "0366d6")!
|
||||||
@ -61,12 +67,14 @@ struct Theme: CustomStringConvertible {
|
|||||||
var cssCodeColor = NSColor(hex: "24292e")!
|
var cssCodeColor = NSColor(hex: "24292e")!
|
||||||
var cssCodeBackgroundColor = NSColor(hex: "1b1f23")!
|
var cssCodeBackgroundColor = NSColor(hex: "1b1f23")!
|
||||||
|
|
||||||
public var description: String {
|
public var description: String {
|
||||||
"Theme<" +
|
"Theme<" +
|
||||||
"fg: \(self.foreground.hex), bg: \(self.background.hex), " +
|
"fg: \(self.foreground.hex), bg: \(self.background.hex), " +
|
||||||
"hl-fg: \(self.highlightForeground.hex), hl-bg: \(self.highlightBackground.hex)" +
|
"hl-fg: \(self.highlightForeground.hex), hl-bg: \(self.highlightBackground.hex), " +
|
||||||
"dir-fg: \(self.directoryForeground.hex)," +
|
"dir-fg: \(self.directoryForeground.hex), " +
|
||||||
"tab-bg: \(self.tabBackground.hex), tab-fg: \(self.tabForeground.hex)" +
|
"tab-fg: \(self.tabForeground.hex), tab-bg: \(self.tabBackground.hex), " +
|
||||||
|
"tabfill-fg: \(self.tabBarForeground.hex), tabfill-bg: \(self.tabBarBackground.hex), " +
|
||||||
|
"tabsel-bg: \(self.selectedTabBackground.hex), tabsel-fg: \(self.selectedTabForeground.hex)" +
|
||||||
">"
|
">"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,6 +92,12 @@ struct Theme: CustomStringConvertible {
|
|||||||
self.tabBackground = nvimTheme.tabBackground
|
self.tabBackground = nvimTheme.tabBackground
|
||||||
self.tabForeground = nvimTheme.tabForeground
|
self.tabForeground = nvimTheme.tabForeground
|
||||||
|
|
||||||
|
self.tabBarBackground = nvimTheme.tabBarBackground
|
||||||
|
self.tabBarForeground = nvimTheme.tabBarForeground
|
||||||
|
|
||||||
|
self.selectedTabBackground = nvimTheme.selectedTabBackground
|
||||||
|
self.selectedTabForeground = nvimTheme.selectedTabForeground
|
||||||
|
|
||||||
self.updateCssColors(additionalColorDict)
|
self.updateCssColors(additionalColorDict)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,10 +15,10 @@
|
|||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>BNDL</string>
|
<string>BNDL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>0.47.2</string>
|
<string>0.47.3</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>20240531.221846</string>
|
<string>20240616.090032</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
22
appcast.xml
22
appcast.xml
@ -6,27 +6,23 @@
|
|||||||
<description>Most recent changes with links to updates for VimR.</description>
|
<description>Most recent changes with links to updates for VimR.</description>
|
||||||
<language>en</language>
|
<language>en</language>
|
||||||
<item>
|
<item>
|
||||||
<title>v0.47.2-20240531.221846</title>
|
<title>v0.47.3-20240616.090032</title>
|
||||||
<link>https://twitter.com/vimrefined</link>
|
<link>https://twitter.com/vimrefined</link>
|
||||||
<sparkle:version>20240531.221846</sparkle:version>
|
<sparkle:version>20240616.090032</sparkle:version>
|
||||||
<sparkle:shortVersionString>v0.47.2</sparkle:shortVersionString>
|
<sparkle:shortVersionString>v0.47.3</sparkle:shortVersionString>
|
||||||
<description><![CDATA[
|
<description><![CDATA[
|
||||||
<ul>
|
<ul>
|
||||||
<li>Always use live resizing</li>
|
<li>GH-1072: Match the tab colors 1:1 with Neovim's <code>colorscheme</code>; thanks @s-daveb for the PR!</li>
|
||||||
<li>Dependencies updates:<ul>
|
<li>GH-1073: Scroll the window content instead of moving the cursor; thanks @shanesmith for the PR!</li>
|
||||||
<li>sparkle-project/Sparkle@2.7.2</li>
|
|
||||||
<li>ReactiveX/RxSwift@6.7.1</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
]]></description>
|
]]></description>
|
||||||
<releaseNotesLink>
|
<releaseNotesLink>
|
||||||
https://github.com/qvacua/vimr/releases/tag/v0.47.2-20240531.221846
|
https://github.com/qvacua/vimr/releases/tag/v0.47.3-20240616.090032
|
||||||
</releaseNotesLink>
|
</releaseNotesLink>
|
||||||
<pubDate>2024-05-31T22:25:28.381821</pubDate>
|
<pubDate>2024-06-16T09:05:41.468955</pubDate>
|
||||||
<minimumSystemVersion>12.0</minimumSystemVersion>
|
<minimumSystemVersion>12.0</minimumSystemVersion>
|
||||||
<enclosure url="https://github.com/qvacua/vimr/releases/download/v0.47.2-20240531.221846/VimR-v0.47.2.tar.bz2"
|
<enclosure url="https://github.com/qvacua/vimr/releases/download/v0.47.3-20240616.090032/VimR-v0.47.3.tar.bz2"
|
||||||
sparkle:edSignature="sYb/KT0vh65Q4DlTe9hKmWu8bGeINujGEjF0Ozsl6MQlwt3wjKJkSZjif/stJE9vHDfr8ggDxhxCvWgt47aoBQ==" length="19388603"
|
sparkle:edSignature="V+/THcm7Alw5JeBs0wiWkI01b7iQe77teESvKPZPim0eQuDeutoTq+UOC8n+t3pBp0Ptlov/9gimKaXWm8RHDQ==" length="19391605"
|
||||||
type="application/octet-stream"/>
|
type="application/octet-stream"/>
|
||||||
</item>
|
</item>
|
||||||
</channel>
|
</channel>
|
||||||
|
@ -6,27 +6,23 @@
|
|||||||
<description>Most recent changes with links to updates for VimR.</description>
|
<description>Most recent changes with links to updates for VimR.</description>
|
||||||
<language>en</language>
|
<language>en</language>
|
||||||
<item>
|
<item>
|
||||||
<title>v0.47.2-20240531.221846</title>
|
<title>v0.47.3-20240616.090032</title>
|
||||||
<link>https://twitter.com/vimrefined</link>
|
<link>https://twitter.com/vimrefined</link>
|
||||||
<sparkle:version>20240531.221846</sparkle:version>
|
<sparkle:version>20240616.090032</sparkle:version>
|
||||||
<sparkle:shortVersionString>v0.47.2</sparkle:shortVersionString>
|
<sparkle:shortVersionString>v0.47.3</sparkle:shortVersionString>
|
||||||
<description><![CDATA[
|
<description><![CDATA[
|
||||||
<ul>
|
<ul>
|
||||||
<li>Always use live resizing</li>
|
<li>GH-1072: Match the tab colors 1:1 with Neovim's <code>colorscheme</code>; thanks @s-daveb for the PR!</li>
|
||||||
<li>Dependencies updates:<ul>
|
<li>GH-1073: Scroll the window content instead of moving the cursor; thanks @shanesmith for the PR!</li>
|
||||||
<li>sparkle-project/Sparkle@2.7.2</li>
|
|
||||||
<li>ReactiveX/RxSwift@6.7.1</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
]]></description>
|
]]></description>
|
||||||
<releaseNotesLink>
|
<releaseNotesLink>
|
||||||
https://github.com/qvacua/vimr/releases/tag/v0.47.2-20240531.221846
|
https://github.com/qvacua/vimr/releases/tag/v0.47.3-20240616.090032
|
||||||
</releaseNotesLink>
|
</releaseNotesLink>
|
||||||
<pubDate>2024-05-31T22:25:28.381821</pubDate>
|
<pubDate>2024-06-16T09:05:41.468955</pubDate>
|
||||||
<minimumSystemVersion>12.0</minimumSystemVersion>
|
<minimumSystemVersion>12.0</minimumSystemVersion>
|
||||||
<enclosure url="https://github.com/qvacua/vimr/releases/download/v0.47.2-20240531.221846/VimR-v0.47.2.tar.bz2"
|
<enclosure url="https://github.com/qvacua/vimr/releases/download/v0.47.3-20240616.090032/VimR-v0.47.3.tar.bz2"
|
||||||
sparkle:edSignature="sYb/KT0vh65Q4DlTe9hKmWu8bGeINujGEjF0Ozsl6MQlwt3wjKJkSZjif/stJE9vHDfr8ggDxhxCvWgt47aoBQ==" length="19388603"
|
sparkle:edSignature="V+/THcm7Alw5JeBs0wiWkI01b7iQe77teESvKPZPim0eQuDeutoTq+UOC8n+t3pBp0Ptlov/9gimKaXWm8RHDQ==" length="19391605"
|
||||||
type="application/octet-stream"/>
|
type="application/octet-stream"/>
|
||||||
</item>
|
</item>
|
||||||
</channel>
|
</channel>
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
# Next
|
# Next
|
||||||
|
|
||||||
|
* GH-1072: Match the tab colors 1:1 with Neovim's `colorscheme`; thanks @s-daveb for the PR!
|
||||||
|
* GH-1073: Scroll the window content instead of moving the cursor; thanks @shanesmith for the PR!
|
||||||
|
|
||||||
|
# v0.47.2-20240531.221846
|
||||||
|
|
||||||
* Always use live resizing
|
* Always use live resizing
|
||||||
* Dependencies updates:
|
* Dependencies updates:
|
||||||
- sparkle-project/Sparkle@2.7.2
|
- sparkle-project/Sparkle@2.7.2
|
||||||
|
Loading…
Reference in New Issue
Block a user