1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-12-25 14:52:19 +03:00

Rename some methods

This commit is contained in:
Tae Won Ha 2016-07-05 20:13:46 +02:00
parent 5b55c9522d
commit edfd5ccf4a
No known key found for this signature in database
GPG Key ID: E40743465B5B8B44
3 changed files with 16 additions and 20 deletions

View File

@ -158,13 +158,13 @@ public class NeoVimView: NSView {
// For background drawing we don't filter out the put(0, 0)s: in some cases only the put(0, 0)-cells should be
// redrawn. => 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.pointInView(rowFrag.row, column: $0) },
self.drawBackground(positions: rowFrag.range.map { self.pointInViewFor(row: rowFrag.row, column: $0) },
background: rowFrag.attrs.background)
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.pointInView(rowFrag.row, column: $0) }
.map { self.pointInViewFor(row: rowFrag.row, column: $0) }
if positions.isEmpty {
return
@ -186,10 +186,10 @@ public class NeoVimView: NSView {
let cursorPosition = self.grid.screenCursor
// Swift.print("\(#function): \(cursorPosition)")
var cursorRect = self.cellRect(row: cursorPosition.row, column: cursorPosition.column)
var cursorRect = self.cellRectFor(row: cursorPosition.row, column: cursorPosition.column)
if self.grid.isNextCellEmpty(cursorPosition) {
let nextPosition = self.grid.nextCellPosition(cursorPosition)
cursorRect = cursorRect.union(self.cellRect(row: nextPosition.row, column:nextPosition.column))
cursorRect = cursorRect.union(self.cellRectFor(row: nextPosition.row, column:nextPosition.column))
}
ColorUtils.colorIgnoringAlpha(background).set()
@ -251,26 +251,22 @@ public class NeoVimView: NSView {
.flatMap { $0 } // Flattened RowRuns for all Regions.
}
func pointInView(position: Position) -> CGPoint {
return self.pointInView(position.row, column: position.column)
func pointInViewFor(position position: Position) -> CGPoint {
return self.pointInViewFor(row: position.row, column: position.column)
}
func pointInView(row: Int, column: Int) -> CGPoint {
func pointInViewFor(row row: Int, column: Int) -> CGPoint {
return CGPoint(
x: CGFloat(column) * self.cellSize.width + self.xOffset,
y: self.frame.size.height - CGFloat(row) * self.cellSize.height - self.cellSize.height - self.yOffset
)
}
func cellRect(position: Position) -> CGRect {
return self.cellRect(row: position.row, column: position.column)
func cellRectFor(row row: Int, column: Int) -> CGRect {
return CGRect(origin: self.pointInViewFor(row: row, column: column), size: self.cellSize)
}
func cellRect(row row: Int, column: Int) -> CGRect {
return CGRect(origin: self.pointInView(row, column: column), size: self.cellSize)
}
func regionRect(region: Region) -> CGRect {
func regionRectFor(region region: Region) -> CGRect {
let top = CGFloat(region.top)
let bottom = CGFloat(region.bottom)
let left = CGFloat(region.left)

View File

@ -52,7 +52,7 @@ extension NeoVimView: NSTextInputClient {
self.keyDownDone = true
// TODO: necessary?
self.setNeedsDisplayInRect(self.cellRect(row: self.grid.putPosition.row, column: self.grid.putPosition.column))
self.setNeedsDisplayInRect(self.cellRectFor(row: self.grid.putPosition.row, column: self.grid.putPosition.column))
}
public override func doCommandBySelector(aSelector: Selector) {
@ -103,7 +103,7 @@ extension NeoVimView: NSTextInputClient {
self.keyDownDone = true
// TODO: necessary?
self.setNeedsDisplayInRect(self.cellRect(row: self.grid.putPosition.row, column: self.grid.putPosition.column))
self.setNeedsDisplayInRect(self.cellRectFor(row: self.grid.putPosition.row, column: self.grid.putPosition.column))
}
/// Return the current selection (or the position of the cursor with empty-length range). For example when you enter
@ -174,7 +174,7 @@ extension NeoVimView: NSTextInputClient {
// NSLog("\(#function): \(aRange),\(actualRange[0]) -> \(position.row):\(position.column)")
let resultInSelf = self.cellRect(row: position.row, column: position.column)
let resultInSelf = self.cellRectFor(row: position.row, column: position.column)
let result = self.window?.convertRectToScreen(self.convertRect(resultInSelf, toView: nil))
return result!

View File

@ -35,7 +35,7 @@ extension NeoVimView: NeoVimUiBridgeProtocol {
DispatchUtils.gui {
self.grid.eolClear()
let origin = self.pointInView(self.grid.putPosition)
let origin = self.pointInViewFor(position: self.grid.putPosition)
let size = CGSize(
width: CGFloat(self.grid.region.right - self.grid.putPosition.column + 1) * self.cellSize.width,
height: self.cellSize.height
@ -190,7 +190,7 @@ extension NeoVimView: NeoVimUiBridgeProtocol {
}
private func setNeedsDisplay(region region: Region) {
self.setNeedsDisplayInRect(self.regionRect(region))
self.setNeedsDisplayInRect(self.regionRectFor(region: region))
}
private func setNeedsDisplay(cellPosition position: Position) {
@ -211,7 +211,7 @@ extension NeoVimView: NeoVimUiBridgeProtocol {
private func setNeedsDisplay(row row: Int, column: Int) {
// Swift.print("\(#function): \(row):\(column)")
self.setNeedsDisplayInRect(self.cellRect(row: row, column: column))
self.setNeedsDisplayInRect(self.cellRectFor(row: row, column: column))
}
private func setNeedsDisplay(screenCursor position: Position) {