Fix auto indent style detection

This commit is contained in:
1024jp 2016-09-23 19:48:23 +09:00
parent 884e0f4a7d
commit 3b183fa48e
2 changed files with 22 additions and 12 deletions

View File

@ -2,6 +2,15 @@
Change Log
==========================
develop
--------------------------
### Fixes
- [beta] Fix an issue where auto indent sytle detection didn't work.
3.0.0-beta.3 (146)
--------------------------

View File

@ -97,6 +97,18 @@ final class DocumentViewController: NSSplitViewController, SyntaxStyleDelegate,
(self.statusBarItem?.viewController as? StatusBarController)?.documentAnalyzer = document.analyzer
document.textStorage.delegate = self
document.syntaxStyle.delegate = self
let editorViewController = self.createEditor(baseViewController: nil)
// start parcing syntax highlights and outline menu
if document.syntaxStyle.canParse {
editorViewController.navigationBarController?.showOutlineIndicator()
}
document.syntaxStyle.invalidateOutline()
self.invalidateSyntaxHighlight()
// detect indent style
if Defaults[.detectsIndentStyle],
let indentStyle = document.textStorage.string.detectedIndentStyle
@ -111,18 +123,6 @@ final class DocumentViewController: NSSplitViewController, SyntaxStyleDelegate,
}()
}
document.textStorage.delegate = self
document.syntaxStyle.delegate = self
let editorViewController = self.createEditor(baseViewController: nil)
// start parcing syntax highlights and outline menu
if document.syntaxStyle.canParse {
editorViewController.navigationBarController?.showOutlineIndicator()
}
document.syntaxStyle.invalidateOutline()
self.invalidateSyntaxHighlight()
// focus text view
self.view.window?.makeFirstResponder(editorViewController.textView)
@ -678,6 +678,7 @@ final class DocumentViewController: NSSplitViewController, SyntaxStyleDelegate,
textView.font = baseTextView.font
textView.theme = baseTextView.theme
textView.tabWidth = baseTextView.tabWidth
textView.isAutomaticTabExpansionEnabled = baseTextView.isAutomaticTabExpansionEnabled
}
NotificationCenter.default.addObserver(self, selector: #selector(textViewDidChangeSelection),