mirror of
https://github.com/qvacua/vimr.git
synced 2024-12-25 14:52:19 +03:00
GH-297 Handle also paths with spaces
This commit is contained in:
parent
ea9407b5ad
commit
2dde944a46
@ -11,13 +11,14 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@property (nonatomic, readonly) NSInteger handle;
|
||||
/**
|
||||
* Full path
|
||||
* Full path without escaping, e.g. /some/path with spaces/file.txt
|
||||
*/
|
||||
@property (nonatomic, retain, nullable) NSString *fileName;
|
||||
/**
|
||||
* Only the file name
|
||||
*/
|
||||
@property (nonatomic, readonly, nullable) NSString *name;
|
||||
@property (nonatomic, readonly, nullable) NSURL *url;
|
||||
@property (nonatomic, readonly) bool isReadOnly;
|
||||
@property (nonatomic, readonly) bool isDirty;
|
||||
@property (nonatomic, readonly) bool isCurrent;
|
||||
|
@ -90,6 +90,17 @@
|
||||
return self.fileName.lastPathComponent;
|
||||
}
|
||||
|
||||
- (NSURL *)url {
|
||||
if (self.fileName == nil) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSString *percentageEscaped = [self.fileName stringByAddingPercentEncodingWithAllowedCharacters:
|
||||
[NSCharacterSet URLQueryAllowedCharacterSet]
|
||||
];
|
||||
return [[NSURL alloc] initWithString:percentageEscaped];
|
||||
}
|
||||
|
||||
- (bool)isTransient {
|
||||
if (self.isDirty) {
|
||||
return NO;
|
||||
|
@ -112,11 +112,12 @@ extension BufferListComponent {
|
||||
}
|
||||
|
||||
fileprivate func text(for buffer: NeoVimBuffer) -> NSAttributedString {
|
||||
guard let name = buffer.name, let fileName = buffer.fileName else {
|
||||
guard let name = buffer.name else {
|
||||
return NSAttributedString(string: "No Name")
|
||||
}
|
||||
|
||||
guard let url = URL(string: fileName) else {
|
||||
guard let url = buffer.url else {
|
||||
NSLog("WARN No URL for \(buffer.fileName)")
|
||||
return NSAttributedString(string: name)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user