mirror of
https://github.com/qvacua/vimr.git
synced 2024-12-29 16:56:40 +03:00
Rename some functions
This commit is contained in:
parent
2e96b09e88
commit
a128ddcae6
@ -39,8 +39,8 @@ extension NeoVimView {
|
||||
|
||||
let dirtyRects = self.rectsBeingDrawn()
|
||||
|
||||
self.logger.debug(dirtyUnionRect)
|
||||
self.logger.debug(dirtyRects)
|
||||
self.logger.debug("dirty union rect: \(dirtyUnionRect)")
|
||||
self.logger.debug("rects being drawn: \(dirtyRects)")
|
||||
|
||||
self.rowRunIntersecting(rects: dirtyRects).forEach { self.draw(rowRun: $0, in: context) }
|
||||
self.drawCursor(context: context)
|
||||
@ -55,7 +55,7 @@ extension NeoVimView {
|
||||
// => FIXME: probably we have to consider this also when drawing further down,
|
||||
// ie when the range starts with '0'...
|
||||
self.drawBackground(
|
||||
positions: rowFrag.range.map { self.pointInViewFor(row: rowFrag.row, column: $0) },
|
||||
positions: rowFrag.range.map { self.pointInView(forRow: rowFrag.row, column: $0) },
|
||||
background: rowFrag.attrs.background,
|
||||
in: context
|
||||
)
|
||||
@ -63,7 +63,7 @@ extension NeoVimView {
|
||||
let positions = rowFrag.range
|
||||
// filter out the put(0, 0)s (after a wide character)
|
||||
.filter { self.grid.cells[rowFrag.row][$0].string.characters.count > 0 }
|
||||
.map { self.pointInViewFor(row: rowFrag.row, column: $0) }
|
||||
.map { self.pointInView(forRow: rowFrag.row, column: $0) }
|
||||
|
||||
if positions.isEmpty {
|
||||
return
|
||||
@ -116,7 +116,7 @@ extension NeoVimView {
|
||||
|
||||
if self.mode == .insert {
|
||||
context.setFillColor(ColorUtils.colorIgnoringAlpha(self.grid.foreground).withAlphaComponent(0.75).cgColor)
|
||||
var cursorRect = self.cellRectFor(row: cursorRow, column: cursorColumnStart)
|
||||
var cursorRect = self.rect(forRow: cursorRow, column: cursorColumnStart)
|
||||
cursorRect.size.width = 2
|
||||
context.fill(cursorRect)
|
||||
return
|
||||
@ -250,10 +250,10 @@ extension NeoVimView {
|
||||
}
|
||||
|
||||
fileprivate func pointInViewFor(position: Position) -> CGPoint {
|
||||
return self.pointInViewFor(row: position.row, column: position.column)
|
||||
return self.pointInView(forRow: position.row, column: position.column)
|
||||
}
|
||||
|
||||
fileprivate func pointInViewFor(row: Int, column: Int) -> CGPoint {
|
||||
fileprivate func pointInView(forRow row: Int, column: Int) -> CGPoint {
|
||||
return CGPoint(
|
||||
x: self.xOffset + CGFloat(column) * self.cellSize.width,
|
||||
y: self.bounds.size.height - self.yOffset - CGFloat(row) * self.cellSize.height
|
||||
@ -261,11 +261,11 @@ extension NeoVimView {
|
||||
)
|
||||
}
|
||||
|
||||
func cellRectFor(row: Int, column: Int) -> CGRect {
|
||||
return CGRect(origin: self.pointInViewFor(row: row, column: column), size: self.cellSize)
|
||||
func rect(forRow row: Int, column: Int) -> CGRect {
|
||||
return CGRect(origin: self.pointInView(forRow: row, column: column), size: self.cellSize)
|
||||
}
|
||||
|
||||
func regionRectFor(region: Region) -> CGRect {
|
||||
func rect(for region: Region) -> CGRect {
|
||||
let top = CGFloat(region.top)
|
||||
let bottom = CGFloat(region.bottom)
|
||||
let left = CGFloat(region.left)
|
||||
|
@ -188,7 +188,7 @@ extension NeoVimView {
|
||||
// self.logger.debug("\(#function): \(aRange),\(actualRange[0]) -> " +
|
||||
// "\(position.row):\(position.column)")
|
||||
|
||||
let resultInSelf = self.cellRectFor(row: position.row, column: position.column)
|
||||
let resultInSelf = self.rect(forRow: position.row, column: position.column)
|
||||
let result = self.window?.convertToScreen(self.convert(resultInSelf, to: nil))
|
||||
|
||||
return result!
|
||||
|
@ -9,7 +9,7 @@ extension NeoVimView {
|
||||
|
||||
public func resize(toWidth width: Int, height: Int) {
|
||||
gui.async {
|
||||
self.logger.debug("\(width) x \(height)")
|
||||
self.bridgeLogger.debug("\(width) x \(height)")
|
||||
|
||||
self.grid.resize(Size(width: width, height: height))
|
||||
self.markForRenderWholeView()
|
||||
@ -18,7 +18,7 @@ extension NeoVimView {
|
||||
|
||||
public func clear() {
|
||||
gui.async {
|
||||
self.logger.mark()
|
||||
self.bridgeLogger.mark()
|
||||
|
||||
self.grid.clear()
|
||||
self.markForRenderWholeView()
|
||||
@ -27,7 +27,7 @@ extension NeoVimView {
|
||||
|
||||
public func eolClear() {
|
||||
gui.async {
|
||||
self.logger.mark()
|
||||
self.bridgeLogger.mark()
|
||||
|
||||
self.grid.eolClear()
|
||||
|
||||
@ -45,7 +45,7 @@ extension NeoVimView {
|
||||
currentPosition: Position) {
|
||||
|
||||
gui.async {
|
||||
self.logger.debug("pos: \(position), screen: \(screenCursor), " +
|
||||
self.bridgeLogger.debug("pos: \(position), screen: \(screenCursor), " +
|
||||
"current-pos: \(currentPosition)")
|
||||
|
||||
self.currentPosition = currentPosition
|
||||
@ -82,14 +82,14 @@ extension NeoVimView {
|
||||
|
||||
public func modeChange(_ mode: CursorModeShape) {
|
||||
gui.async {
|
||||
self.logger.debug(cursorModeShapeName(mode))
|
||||
self.bridgeLogger.debug(cursorModeShapeName(mode))
|
||||
self.mode = mode
|
||||
}
|
||||
}
|
||||
|
||||
public func setScrollRegionToTop(_ top: Int, bottom: Int, left: Int, right: Int) {
|
||||
gui.async {
|
||||
self.logger.debug("\(top):\(bottom):\(left):\(right)")
|
||||
self.bridgeLogger.debug("\(top):\(bottom):\(left):\(right)")
|
||||
|
||||
let region = Region(top: top, bottom: bottom, left: left, right: right)
|
||||
self.grid.setScrollRegion(region)
|
||||
@ -98,7 +98,7 @@ extension NeoVimView {
|
||||
|
||||
public func scroll(_ count: Int) {
|
||||
gui.async {
|
||||
self.logger.debug(count)
|
||||
self.bridgeLogger.debug(count)
|
||||
|
||||
self.grid.scroll(count)
|
||||
self.markForRender(region: self.grid.region)
|
||||
@ -110,7 +110,7 @@ extension NeoVimView {
|
||||
|
||||
public func highlightSet(_ attrs: CellAttributes) {
|
||||
gui.async {
|
||||
self.logger.debug(attrs)
|
||||
self.bridgeLogger.debug(attrs)
|
||||
|
||||
self.grid.attrs = attrs
|
||||
}
|
||||
@ -118,10 +118,9 @@ extension NeoVimView {
|
||||
|
||||
public func put(_ string: String, screenCursor: Position) {
|
||||
gui.async {
|
||||
self.logger.debug("'\(string)' <- screen: \(screenCursor)")
|
||||
|
||||
let curPos = self.grid.putPosition
|
||||
// self.logger.debug("\(#function): \(curPos) -> \(string)")
|
||||
self.bridgeLogger.debug("\(curPos) -> \(string) <- screen: \(screenCursor)")
|
||||
|
||||
self.grid.put(string)
|
||||
|
||||
if self.usesLigatures {
|
||||
@ -140,7 +139,7 @@ extension NeoVimView {
|
||||
|
||||
public func putMarkedText(_ markedText: String, screenCursor: Position) {
|
||||
gui.async {
|
||||
self.logger.debug("'\(markedText)' <- screen: \(screenCursor)")
|
||||
self.bridgeLogger.debug("'\(markedText)' <- screen: \(screenCursor)")
|
||||
|
||||
let curPos = self.grid.putPosition
|
||||
self.grid.putMarkedText(markedText)
|
||||
@ -158,7 +157,7 @@ extension NeoVimView {
|
||||
|
||||
public func unmarkRow(_ row: Int, column: Int) {
|
||||
gui.async {
|
||||
self.logger.debug("\(row):\(column)")
|
||||
self.bridgeLogger.debug("\(row):\(column)")
|
||||
|
||||
let position = Position(row: row, column: column)
|
||||
|
||||
@ -171,13 +170,13 @@ extension NeoVimView {
|
||||
|
||||
public func flush() {
|
||||
gui.async {
|
||||
self.logger.debug("-----------------------------")
|
||||
self.bridgeLogger.debug("-----------------------------")
|
||||
}
|
||||
}
|
||||
|
||||
public func updateForeground(_ fg: Int) {
|
||||
gui.async {
|
||||
self.logger.debug(ColorUtils.colorIgnoringAlpha(fg))
|
||||
self.bridgeLogger.debug(ColorUtils.colorIgnoringAlpha(fg))
|
||||
|
||||
self.grid.foreground = fg
|
||||
}
|
||||
@ -185,7 +184,7 @@ extension NeoVimView {
|
||||
|
||||
public func updateBackground(_ bg: Int) {
|
||||
gui.async {
|
||||
self.logger.debug(ColorUtils.colorIgnoringAlpha(bg))
|
||||
self.bridgeLogger.debug(ColorUtils.colorIgnoringAlpha(bg))
|
||||
|
||||
self.grid.background = bg
|
||||
self.layer?.backgroundColor = ColorUtils.colorIgnoringAlpha(self.grid.background).cgColor
|
||||
@ -194,7 +193,7 @@ extension NeoVimView {
|
||||
|
||||
public func updateSpecial(_ sp: Int) {
|
||||
gui.async {
|
||||
self.logger.debug(ColorUtils.colorIgnoringAlpha(sp))
|
||||
self.bridgeLogger.debug(ColorUtils.colorIgnoringAlpha(sp))
|
||||
|
||||
self.grid.special = sp
|
||||
}
|
||||
@ -202,7 +201,7 @@ extension NeoVimView {
|
||||
|
||||
public func setTitle(_ title: String) {
|
||||
gui.async {
|
||||
self.logger.debug(title)
|
||||
self.bridgeLogger.debug(title)
|
||||
|
||||
self.delegate?.set(title: title)
|
||||
}
|
||||
@ -210,7 +209,7 @@ extension NeoVimView {
|
||||
|
||||
public func stop() {
|
||||
gui.async {
|
||||
self.logger.mark()
|
||||
self.bridgeLogger.mark()
|
||||
|
||||
self.delegate?.neoVimStopped()
|
||||
}
|
||||
@ -219,7 +218,7 @@ extension NeoVimView {
|
||||
|
||||
public func autoCommandEvent(_ event: NeoVimAutoCommandEvent, bufferHandle: Int) {
|
||||
gui.async {
|
||||
self.logger.debug("\(neoVimAutoCommandEventName(event)) -> \(bufferHandle)")
|
||||
self.bridgeLogger.debug("\(neoVimAutoCommandEventName(event)) -> \(bufferHandle)")
|
||||
|
||||
if event == .BUFWINENTER || event == .BUFWINLEAVE {
|
||||
self.bufferListChanged()
|
||||
@ -241,7 +240,7 @@ extension NeoVimView {
|
||||
|
||||
public func ipcBecameInvalid(_ reason: String) {
|
||||
gui.async {
|
||||
self.logger.debug(reason)
|
||||
self.bridgeLogger.debug(reason)
|
||||
|
||||
if self.agent.neoVimIsQuitting {
|
||||
return
|
||||
@ -249,7 +248,7 @@ extension NeoVimView {
|
||||
|
||||
self.delegate?.ipcBecameInvalid(reason: reason)
|
||||
|
||||
self.logger.fault("force-quitting")
|
||||
self.bridgeLogger.fault("force-quitting")
|
||||
self.agent.quit()
|
||||
}
|
||||
}
|
||||
@ -260,7 +259,7 @@ extension NeoVimView {
|
||||
|
||||
public func bell() {
|
||||
gui.async {
|
||||
self.logger.mark()
|
||||
self.bridgeLogger.mark()
|
||||
|
||||
NSBeep()
|
||||
}
|
||||
@ -268,7 +267,7 @@ extension NeoVimView {
|
||||
|
||||
public func setDirtyStatus(_ dirty: Bool) {
|
||||
gui.async {
|
||||
self.logger.debug(dirty)
|
||||
self.bridgeLogger.debug(dirty)
|
||||
|
||||
self.delegate?.set(dirtyStatus: dirty)
|
||||
}
|
||||
@ -276,49 +275,49 @@ extension NeoVimView {
|
||||
|
||||
public func updateMenu() {
|
||||
gui.async {
|
||||
self.logger.mark()
|
||||
self.bridgeLogger.mark()
|
||||
}
|
||||
}
|
||||
|
||||
public func busyStart() {
|
||||
gui.async {
|
||||
self.logger.mark()
|
||||
self.bridgeLogger.mark()
|
||||
}
|
||||
}
|
||||
|
||||
public func busyStop() {
|
||||
gui.async {
|
||||
self.logger.mark()
|
||||
self.bridgeLogger.mark()
|
||||
}
|
||||
}
|
||||
|
||||
public func mouseOn() {
|
||||
gui.async {
|
||||
self.logger.mark()
|
||||
self.bridgeLogger.mark()
|
||||
}
|
||||
}
|
||||
|
||||
public func mouseOff() {
|
||||
gui.async {
|
||||
self.logger.mark()
|
||||
self.bridgeLogger.mark()
|
||||
}
|
||||
}
|
||||
|
||||
public func visualBell() {
|
||||
gui.async {
|
||||
self.logger.mark()
|
||||
self.bridgeLogger.mark()
|
||||
}
|
||||
}
|
||||
|
||||
public func suspend() {
|
||||
gui.async {
|
||||
self.logger.mark()
|
||||
self.bridgeLogger.mark()
|
||||
}
|
||||
}
|
||||
|
||||
public func setIcon(_ icon: String) {
|
||||
gui.async {
|
||||
self.logger.debug(icon)
|
||||
self.bridgeLogger.debug(icon)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -353,11 +352,11 @@ extension NeoVimView {
|
||||
}
|
||||
|
||||
func markForRender(region: Region) {
|
||||
self.setNeedsDisplay(self.regionRectFor(region: region))
|
||||
self.setNeedsDisplay(self.rect(for: region))
|
||||
}
|
||||
|
||||
func markForRender(row: Int, column: Int) {
|
||||
self.setNeedsDisplay(self.cellRectFor(row: row, column: column))
|
||||
self.setNeedsDisplay(self.rect(forRow: row, column: column))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -146,9 +146,9 @@ public class NeoVimView: NSView,
|
||||
}
|
||||
}
|
||||
|
||||
let logger = FileLogger(as: NeoVimView.self,
|
||||
with: URL(fileURLWithPath: "/tmp/nvv.log"),
|
||||
shouldLogDebug: false)
|
||||
let logger = FileLogger(as: NeoVimView.self, with: URL(fileURLWithPath: "/tmp/nvv.log"))
|
||||
let bridgeLogger = FileLogger(as: NeoVimView.self,
|
||||
with: URL(fileURLWithPath: "/tmp/nvv-bridge.log"))
|
||||
let agent: NeoVimAgent
|
||||
let grid = Grid()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user