1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-10-27 18:34:58 +03:00

Refactor slightly

This commit is contained in:
Tae Won Ha 2016-07-10 13:51:00 +02:00
parent b77ac875ad
commit 6eca26bbc7
No known key found for this signature in database
GPG Key ID: E40743465B5B8B44
6 changed files with 2 additions and 28 deletions

View File

@ -141,8 +141,6 @@ static CFDataRef local_server_callback(CFMessagePortRef local, SInt32 msgid, CFD
}
- (void)handleMessageWithId:(SInt32)msgid data:(NSData *)data {
// NSLog(@"msg received: %d -> %@", msgid, data);
switch (msgid) {
case NeoVimAgentMsgIdAgentReady:
@ -173,7 +171,6 @@ static CFDataRef local_server_callback(CFMessagePortRef local, SInt32 msgid, CFD
case NeoVimAgentMsgIdResize: {
int *values = data_to_int_array(data, 2);
NSLog(@"!!! server rcv resize: %d:%d", values[0], values[1]);
server_resize(values[0], values[1]);
return;
}

View File

@ -51,10 +51,9 @@ int main(int argc, const char *argv[]) {
localServerName:localServerName
remoteServerName:remoteServerName];
[_neovim_server notifyReadiness];
CFRunLoopRun();
}
CFRunLoopRun();
return 0;
}

View File

@ -157,7 +157,6 @@ static void server_ui_resize(UI *ui __unused, int width, int height) {
NSData *data = [[NSData alloc] initWithBytes:values length:(2 * sizeof(int))];
[_neovim_server sendMessageWithId:NeoVimServerMsgIdResize data:data];
[data release];
NSLog(@"resized");
});
}
@ -236,7 +235,6 @@ static void server_ui_set_scroll_region(UI *ui __unused, int top, int bot, int l
static void server_ui_scroll(UI *ui __unused, int count) {
queue(^{
int value = count;
NSLog(@"ui_scroll: %d", count);
NSData *data = [[NSData alloc] initWithBytes:&value length:(1 * sizeof(int))];
[_neovim_server sendMessageWithId:NeoVimServerMsgIdScroll data:data];
[data release];
@ -556,7 +554,6 @@ void server_redraw() {
void server_resize(int width, int height) {
queue(^{
NSLog(@"!!! do_resize: %d:%d", width, height);
set_ui_size(_server_ui_data->bridge, width, height);
loop_schedule(&main_loop, event_create(1, refresh_ui, 0));
});

View File

@ -78,7 +78,6 @@ static CFDataRef local_server_callback(CFMessagePortRef local, SInt32 msgid, CFD
_neoVimServerTask = [[NSTask alloc] init];
_neoVimServerTask.launchPath = [self neoVimServerExecutablePath];
NSLog(@"%@", [self neoVimServerExecutablePath]);
_neoVimServerTask.arguments = @[ _uuid, [self localServerName], [self remoteServerName] ];
[_neoVimServerTask launch];
@ -104,7 +103,6 @@ static CFDataRef local_server_callback(CFMessagePortRef local, SInt32 msgid, CFD
}
- (void)resizeToWidth:(int)width height:(int)height {
NSLog(@"!!! agent resize: %d:%d", width, height);
int values[] = { width, height };
NSData *data = [[NSData alloc] initWithBytes:values length:(2 * sizeof(int))];
[self sendMessageWithId:NeoVimAgentMsgIdResize data:data];
@ -178,8 +176,6 @@ static CFDataRef local_server_callback(CFMessagePortRef local, SInt32 msgid, CFD
}
- (void)handleMessageWithId:(SInt32)msgid data:(NSData *)data {
// NSLog(@"msg received: %d -> %@", msgid, data);
switch (msgid) {
case NeoVimServerMsgIdServerReady:
@ -248,7 +244,6 @@ static CFDataRef local_server_callback(CFMessagePortRef local, SInt32 msgid, CFD
case NeoVimServerMsgIdScroll: {
int *values = data_to_int_array(data, 1);
NSLog(@"msg rcv scroll: %d", values[0]);
[_bridge scroll:values[0]];
return;
}

View File

@ -150,7 +150,7 @@ public class NeoVimView: NSView {
}
func resizeNeoVimUiTo(size size: CGSize) {
NSLog("\(#function): \(size)")
// NSLog("\(#function): \(size)")
let discreteSize = Size(width: Int(floor(size.width / self.cellSize.width)),
height: Int(floor(size.height / self.cellSize.height)))

View File

@ -9,7 +9,6 @@ extension NeoVimView: NeoVimUiBridgeProtocol {
public func neoVimUiIsReady() {
DispatchUtils.gui {
NSLog("\(#function): \(self.frame)")
self.resizeNeoVimUiTo(size: self.frame.size)
}
}
@ -23,7 +22,6 @@ extension NeoVimView: NeoVimUiBridgeProtocol {
}
public func clear() {
//if self.inLiveResize { return }
DispatchUtils.gui {
self.grid.clear()
self.needsDisplay = true
@ -31,7 +29,6 @@ extension NeoVimView: NeoVimUiBridgeProtocol {
}
public func eolClear() {
//if self.inLiveResize { return }
DispatchUtils.gui {
self.grid.eolClear()
@ -46,7 +43,6 @@ extension NeoVimView: NeoVimUiBridgeProtocol {
}
public func gotoPosition(position: Position, screenCursor: Position) {
//if self.inLiveResize { return }
DispatchUtils.gui {
// NSLog("\(#function): \(position), \(screenCursor)")
@ -77,7 +73,6 @@ extension NeoVimView: NeoVimUiBridgeProtocol {
}
public func setScrollRegionToTop(top: Int32, bottom: Int32, left: Int32, right: Int32) {
//if self.inLiveResize { return }
DispatchUtils.gui {
let region = Region(top: Int(top), bottom: Int(bottom), left: Int(left), right: Int(right))
self.grid.setScrollRegion(region)
@ -86,23 +81,19 @@ extension NeoVimView: NeoVimUiBridgeProtocol {
}
public func scroll(count: Int32) {
//if self.inLiveResize { return }
DispatchUtils.gui {
NSLog("bridge scroll: \(count)")
self.grid.scroll(Int(count))
self.setNeedsDisplay(region: self.grid.region)
}
}
public func highlightSet(attrs: CellAttributes) {
//if self.inLiveResize { return }
DispatchUtils.gui {
self.grid.attrs = attrs
}
}
public func put(string: String) {
//if self.inLiveResize { return }
DispatchUtils.gui {
let curPos = self.grid.putPosition
// NSLog("\(#function): \(curPos) -> \(string)")
@ -114,7 +105,6 @@ extension NeoVimView: NeoVimUiBridgeProtocol {
}
public func putMarkedText(markedText: String) {
//if self.inLiveResize { return }
DispatchUtils.gui {
NSLog("\(#function): '\(markedText)'")
let curPos = self.grid.putPosition
@ -129,7 +119,6 @@ extension NeoVimView: NeoVimUiBridgeProtocol {
}
public func unmarkRow(row: Int32, column: Int32) {
//if self.inLiveResize { return }
DispatchUtils.gui {
let position = Position(row: Int(row), column: Int(column))
@ -156,14 +145,12 @@ extension NeoVimView: NeoVimUiBridgeProtocol {
}
public func updateForeground(fg: Int32) {
//if self.inLiveResize { return }
DispatchUtils.gui {
self.grid.foreground = UInt32(bitPattern: fg)
}
}
public func updateBackground(bg: Int32) {
//if self.inLiveResize { return }
DispatchUtils.gui {
self.grid.background = UInt32(bitPattern: bg)
self.layer?.backgroundColor = ColorUtils.colorIgnoringAlpha(self.grid.background).CGColor
@ -171,7 +158,6 @@ extension NeoVimView: NeoVimUiBridgeProtocol {
}
public func updateSpecial(sp: Int32) {
//if self.inLiveResize { return }
DispatchUtils.gui {
self.grid.special = UInt32(bitPattern: sp)
}