1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-12-25 23:02:35 +03:00

Merge branch 'issue/214-cursor'

This commit is contained in:
Tae Won Ha 2016-08-07 18:14:58 +02:00
commit c78d8f8f80
No known key found for this signature in database
GPG Key ID: E40743465B5B8B44

View File

@ -213,14 +213,14 @@ public class NeoVimView: NSView, NSUserInterfaceValidations {
context: context)
}
self.drawCursor(self.grid.background)
self.drawCursor(self.grid.foreground)
}
public func hasDirtyDocs() -> Bool {
return self.agent.hasDirtyDocs()
}
private func drawCursor(background: UInt32) {
private func drawCursor(foreground: UInt32) {
// FIXME: for now do some rudimentary cursor drawing
let cursorPosition = self.mode == .Cmdline ? self.grid.putPosition : self.grid.screenCursor
// NSLog("\(#function): \(cursorPosition)")
@ -231,11 +231,15 @@ public class NeoVimView: NSView, NSUserInterfaceValidations {
cursorRect = cursorRect.union(self.cellRectFor(row: nextPosition.row, column:nextPosition.column))
}
ColorUtils.colorIgnoringAlpha(background).set()
ColorUtils.colorIgnoringAlpha(foreground).set()
NSRectFillUsingOperation(cursorRect, .CompositeDifference)
}
private func drawBackground(positions positions: [CGPoint], background: UInt32) {
if background == self.grid.background {
return
}
ColorUtils.colorIgnoringAlpha(background).set()
// NSColor(calibratedRed: CGFloat(drand48()), green: CGFloat(drand48()), blue: CGFloat(drand48()), alpha: 1.0).set()
let backgroundRect = CGRect(