1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-11-28 11:35:35 +03:00
vimr/NeoVimServer/NeoVimWindow.m
Greg Omelaenko f22675fc92
Add -isCurrent to NeoVimTab, -isCurrentInTab to NeoVimWindow for state tracking
Also adds -currentWindow to NeoVimTab for convenience
2017-09-20 04:47:48 +10:00

53 lines
1.4 KiB
Objective-C

//
// Created by Tae Won Ha on 22/10/16.
// Copyright (c) 2016 Tae Won Ha. All rights reserved.
//
#import "NeoVimWindow.h"
#import "NeoVimBuffer.h"
@implementation NeoVimWindow
- (instancetype)initWithHandle:(NSInteger)handle buffer:(NeoVimBuffer *)buffer currentInTab:(bool)current {
self = [super init];
if (self == nil) {
return nil;
}
_handle = handle;
_buffer = buffer;
_isCurrentInTab = current;
return self;
}
- (NSString *)description {
NSMutableString *description = [NSMutableString stringWithFormat:@"<%@: ", NSStringFromClass([self class])];
[description appendFormat:@"self.handle=%li", self.handle];
[description appendFormat:@", self.buffer=%@", self.buffer];
[description appendFormat:@", self.currentInTab=%d", self.isCurrentInTab];
[description appendString:@">"];
return description;
}
- (void)encodeWithCoder:(NSCoder *)coder {
[coder encodeObject:@(self.handle) forKey:@"handle"];
[coder encodeObject:self.buffer forKey:@"buffer"];
[coder encodeBool:self.isCurrentInTab forKey:@"currentInTab"];
}
- (instancetype)initWithCoder:(NSCoder *)coder {
self = [super init];
if (self) {
NSNumber *objHandle = [coder decodeObjectForKey:@"handle"];
_handle = objHandle.integerValue;
_buffer = [coder decodeObjectForKey:@"buffer"];
_isCurrentInTab = [coder decodeBoolForKey:@"currentInTab"];
}
return self;
}
@end