mirror of
https://github.com/qvacua/vimr.git
synced 2024-12-26 07:13:24 +03:00
Replace cursor attributes with defaults from current cell to enable correct handling of guibg=NONE and guig=NONE
This commit is contained in:
parent
4be4923fee
commit
bcb894acc9
@ -21,13 +21,17 @@ final class CellAttributesCollection {
|
||||
init() { self.attributes[CellAttributesCollection.defaultAttributesId] = self.defaultAttributes }
|
||||
|
||||
func attributes(of id: Int) -> CellAttributes? {
|
||||
return self.attributes(of: id, withDefaults: self.defaultAttributes)
|
||||
}
|
||||
|
||||
func attributes(of id: Int, withDefaults defaults: CellAttributes) -> CellAttributes? {
|
||||
if id == Int.max { return self.defaultAttributes.reversed }
|
||||
|
||||
let absId = abs(id)
|
||||
guard let attrs = self.attributes[absId] else { return nil }
|
||||
if id < 0 { return attrs.replacingDefaults(with: self.defaultAttributes).reversed }
|
||||
|
||||
return attrs.replacingDefaults(with: self.defaultAttributes)
|
||||
return attrs.replacingDefaults(with: defaults)
|
||||
}
|
||||
|
||||
func set(attributes: CellAttributes, for id: Int) {
|
||||
|
@ -100,7 +100,8 @@ extension NvimView {
|
||||
|
||||
guard let cursorAttrId = modeInfo.attrId,
|
||||
let cursorShapeAttrs = self.cellAttributesCollection.attributes(
|
||||
of: cursorAttrId
|
||||
of: cursorAttrId,
|
||||
withDefaults: cellAtCursorAttrs
|
||||
) else {
|
||||
self.log.error("Could not get the attributes" +
|
||||
" for cursor in mode: \(mode) \(modeInfo)")
|
||||
|
Loading…
Reference in New Issue
Block a user