Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buffer refactor #535

Open
wants to merge 44 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
552460a
Make XVimBuffer a reality
JohnTheAppleSeed Nov 17, 2013
04a77f2
Migrate most of XVimTextStoring to XVimBuffer
JohnTheAppleSeed Nov 17, 2013
0211582
Have initializer that makes more sense
JohnTheAppleSeed Nov 18, 2013
e3bcb62
Rework undo to take complete ownership of some operations
JohnTheAppleSeed Nov 18, 2013
694d02e
Move xvim_incrementNumber to XVimBuffer, where it belongs
JohnTheAppleSeed Nov 19, 2013
01d9100
Disable GC on the XCode5 plugin
JohnTheAppleSeed Nov 19, 2013
b9709a6
Remove useless __USE_DVTKIT__ dependency
JohnTheAppleSeed Nov 19, 2013
1715526
Get rid of the lastVisual* properties on the XVim instance
JohnTheAppleSeed Nov 19, 2013
030a795
Reimplement paragraph moves using XVimBuffer clean methods
JohnTheAppleSeed Nov 20, 2013
eebc66a
Dead code
JohnTheAppleSeed Nov 20, 2013
98bb868
fix Off-by-one
JohnTheAppleSeed Nov 21, 2013
a776bfd
Try not to change -[XVimMotion motion] gratuitously
JohnTheAppleSeed Nov 20, 2013
4917b21
+load really isn't the place to initialize a bundle
JohnTheAppleSeed Nov 21, 2013
51f6b2d
Add an NSObject(XVimAdditions) category for swizzling
JohnTheAppleSeed Nov 21, 2013
09bc132
Have an XVimView much like we have an XVimBuffer
JohnTheAppleSeed Nov 21, 2013
f93d3a6
Get rid of IDEEditorAreaHook and just have a category with swizzling
JohnTheAppleSeed Nov 21, 2013
b7b911c
Remove now completely useless Hook
JohnTheAppleSeed Nov 21, 2013
3afd25b
Move the IDEWorkspaceWindowHook as a swizzle in XVimHookManager
JohnTheAppleSeed Nov 21, 2013
e73d9d5
wibble
JohnTheAppleSeed Nov 22, 2013
e234ef0
Get rid of Hooker, move DVTSourceTextScrollView to a swizzling class too
JohnTheAppleSeed Nov 22, 2013
559770f
Get rid of XVimTextViewProtocol
JohnTheAppleSeed Nov 22, 2013
c068d4a
Migrate scrolling and some drawing code to XVimView
JohnTheAppleSeed Nov 22, 2013
c55fcb6
Make the XCode project happier
JohnTheAppleSeed Nov 16, 2013
ea25af4
To help debugging: log exceptions to the console right away
JohnTheAppleSeed Nov 22, 2013
7533e08
Refactor character swaps operators into XVimBuffer
JohnTheAppleSeed Nov 22, 2013
598f882
Do not call xvim_replaceCharacters with a non printable one
JohnTheAppleSeed Nov 22, 2013
50b42ef
Refactor NSTextView(VimOperation) into the XVimView
JohnTheAppleSeed Nov 24, 2013
55acaf3
Force synthesizing properties
JohnTheAppleSeed Nov 23, 2013
f49d75d
Hunt of DVTKIT: Move -_indentCharacterRange into XVimTextStoring
JohnTheAppleSeed Nov 25, 2013
45b5e26
Begin to remove some things from the NSTextStorage category.
JohnTheAppleSeed Nov 25, 2013
0f824b8
Fix b_v_D
JohnTheAppleSeed Nov 25, 2013
890f5ad
Disable GC for XCode5, it's not a GC App anymore
JohnTheAppleSeed Nov 25, 2013
7e2d1c8
get rid of XVimMotionType.h, merge it in XVimMotion.h
JohnTheAppleSeed Nov 25, 2013
0c2519e
Move some more functions from the NSTextStorage category to XVimBuffer
JohnTheAppleSeed Nov 25, 2013
4fa859c
fix the release build
JohnTheAppleSeed Nov 25, 2013
a659427
Refactor -{prev,next}{,Line}:... in XVimBuffer
JohnTheAppleSeed Nov 25, 2013
4d73d39
Fix a few mistakes, and support movement |
JohnTheAppleSeed Nov 26, 2013
794f94d
Add UUID for XCode 5.0 DP
JohnTheAppleSeed Nov 26, 2013
ec162f0
Fixup position after undo
JohnTheAppleSeed Nov 26, 2013
832005e
This is now unused code
JohnTheAppleSeed Nov 26, 2013
6528a7c
Do not use straight @"\n" in the code
JohnTheAppleSeed Nov 27, 2013
934c8a2
Add some comments
JohnTheAppleSeed Nov 27, 2013
38e71db
Improve performance and correctness of the event handling code
JohnTheAppleSeed Nov 27, 2013
e11416a
Do not swizzle KV Observing and -dealloc on NSTextView
JohnTheAppleSeed Dec 1, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
249 changes: 94 additions & 155 deletions XVim.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0460"
LastUpgradeVersion = "0500"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0460"
LastUpgradeVersion = "0500"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
14 changes: 14 additions & 0 deletions XVim/DVTSourceTextScrollView+XVim.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// DVTSourceTextScrollViewHook.h
// XVim
//
// Created by Suzuki Shuichiro on 11/8/13.
//
//

#import <Foundation/Foundation.h>
#import "DVTKit.h"

@interface DVTSourceTextScrollView (XVim)
+ (void)xvim_initialize;
@end
97 changes: 97 additions & 0 deletions XVim/DVTSourceTextScrollView+XVim.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
//
// DVTSourceTextScrollViewHook.m
// XVim
//
// Created by Suzuki Shuichiro on 11/8/13.
//
//

#import "Logger.h"
#import "XVim.h"
#import "XVimOptions.h"
#import "DVTSourceTextScrollView+XVim.h"
#import "NSObject+XVimAdditions.h"

@implementation DVTSourceTextScrollView (XVim)

+ (void)xvim_initialize
{
if (self == [DVTSourceTextScrollView class]) {
#define swizzle(sel) \
[self xvim_swizzleInstanceMethod:@selector(sel) with:@selector(xvim_##sel)]

swizzle(initWithFrame:);
swizzle(dealloc);
swizzle(hasVerticalScroller);
swizzle(hasHorizontalScroller);
swizzle(observeValueForKeyPath:ofObject:change:context:);

#undef swizzle
}
}

- (instancetype)xvim_initWithFrame:(NSRect)rect
{
if ((self = [self xvim_initWithFrame:rect])) {
TRACE_LOG(@"%p initWithFrame", self);
[XVim.instance.options addObserver:self forKeyPath:@"guioptions"
options:NSKeyValueObservingOptionInitial|NSKeyValueObservingOptionNew context:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_xvim_statusChanged:)
name:XVimEnabledStatusChangedNotification object:nil];
}
return self;
}

- (void)xvim_dealloc
{
@try {
TRACE_LOG(@"%p dealloc", self);
[[NSNotificationCenter defaultCenter] removeObserver:self];
[XVim.instance.options removeObserver:self forKeyPath:@"guioptions"];
}
@catch (NSException* exception){
ERROR_LOG(@"Exception %@: %@", [exception name], [exception reason]);
[Logger logStackTrace:exception];
}
[self xvim_dealloc];
}

- (void)_xvim_statusChanged:(id)unused
{
if (XVim.instance.disabled) {
self.hasHorizontalScroller = YES;
self.hasVerticalScroller = YES;
}
}

- (BOOL)xvim_hasVerticalScroller
{
if (XVim.instance.disabled) {
return [self xvim_hasVerticalScroller];
}
return [XVim.instance.options.guioptions rangeOfString:@"r"].location != NSNotFound;
}

- (BOOL)xvim_hasHorizontalScroller
{
if (XVim.instance.disabled) {
return [self xvim_hasHorizontalScroller];
}
return [XVim.instance.options.guioptions rangeOfString:@"b"].location != NSNotFound;
}

- (void)xvim_observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object
change:(NSDictionary *)change context:(void *)context
{
if (object != XVim.instance.options) {
return [self xvim_observeValueForKeyPath:keyPath ofObject:object
change:change context:context];
}
if ([keyPath isEqualToString:@"guioptions"]) {
// Just updating the scrollers state.
self.hasHorizontalScroller = self.hasHorizontalScroller;
self.hasVerticalScroller = self.hasVerticalScroller;
}
}

@end
22 changes: 0 additions & 22 deletions XVim/DVTSourceTextScrollViewHook.h

This file was deleted.

107 changes: 0 additions & 107 deletions XVim/DVTSourceTextScrollViewHook.m

This file was deleted.

1 change: 0 additions & 1 deletion XVim/DVTSourceTextView+XVim.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@
#import "DVTKit.h"

@interface DVTSourceTextView (XVim)
- (IDEEditorArea*)editorArea;
- (XVimWindow*)xvimWindow;
@end
2 changes: 1 addition & 1 deletion XVim/DVTSourceTextView+XVim.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ - (IDEEditorArea*)editorArea{
}

- (XVimWindow*)xvimWindow{
return [[self editorArea] xvimWindow];
return [[self editorArea] xvim_window];
}
@end
43 changes: 0 additions & 43 deletions XVim/DVTSourceTextViewHook.h

This file was deleted.

Loading