Skip to content

Commit

Permalink
修复bug
Browse files Browse the repository at this point in the history
  • Loading branch information
coleflowers committed Jun 12, 2020
1 parent c3cc8f9 commit c369b10
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 7 deletions.
26 changes: 26 additions & 0 deletions hookSublimeText/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Xcode
.DS_Store
#build file
build/
#personal settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
#xcode state
*.perspectivev3
!default.perspectivev3
*.xcworkspace
!default.xcworkspace
xcuserdata
profile
*.moved-aside
DerivedData
.idea/

# local path bin
bin/

UserInterface.xcuserstate
18 changes: 11 additions & 7 deletions hookSublimeText/hookSublimeText/Main.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ - (void)m_st_commandLine:(id)arg1 {

// - PXWindow
- (void)m_st_update {
// NSLog(@"SublimeText m_st_update");
NSLog(@"SublimeText m_st_update");
[self m_st_update];
[self m_hidden_registerMarkView];
}
Expand All @@ -42,7 +42,9 @@ - (void)m_hidden_registerMarkView {
NSDictionary *mark = [[NSUserDefaults standardUserDefaults] objectForKey:@"removedMark"];
if (mark) {
if ([[mark allKeys] containsObject:[self m_set_key]]) {
return;
__unused NSNumber *num = [mark valueForKey:[self m_set_key]];
//TODO
//return;
}
}

Expand All @@ -54,6 +56,8 @@ - (void)m_hidden_registerMarkView {
for (id item in titleBars) {
[self m_hidden_registerMarkView:item];
}

[self m_set_removeMark];
}

// Sublime Text 里有一个同名的c函数🐶
Expand Down Expand Up @@ -115,12 +119,13 @@ - (void)m_hidden_registerMarkView:(id)titleBarView {
NSTextField *txtView = (NSTextField *)item;

if ([txtView.stringValue isEqualToString:@"UNREGISTERED"]) {
[txtView removeFromSuperview];
// [txtView removeFromSuperview];
// [txtView setHidden:YES];

[txtView setFrame:NSMakeRect(0, 0, 0, 0)];
}
}
}

[self m_set_removeMark];
}

- (NSString *)m_set_key {
Expand All @@ -129,9 +134,8 @@ - (NSString *)m_set_key {
}

- (void)m_set_removeMark {

NSMutableDictionary *mark = @{}.mutableCopy;
[mark setValue:@"1" forKey:[self m_set_key]];
[mark setValue:@1 forKey:[self m_set_key]];

[[NSUserDefaults standardUserDefaults] setObject:mark forKey:@"removedMark"];
[[NSUserDefaults standardUserDefaults] synchronize];
Expand Down

0 comments on commit c369b10

Please sign in to comment.