Fix textContainer size after spliting editor

This commit is contained in:
1024jp 2020-02-13 18:23:13 +09:00
parent 1f40a9e7af
commit febdb1b2f9
3 changed files with 10 additions and 13 deletions

View File

@ -11,7 +11,7 @@ Change Log
- Make space to draw the invisible symbol for ZERO WIDTH SPACE (U+200B) when the “other invisible characters” option is enabled.
- Enable “Move Line Down” and “Move Line Up” commands swap lines with the last empty line.
- Improve general performance while typing.
- [tirivial] Keep the visible area after resizing document window even if overscrolling is enabled.
- [tirivial] Keep the visible area after resizing a document window even if overscrolling is enabled.
- [trivial] Adjust the theme “Note”.
@ -22,10 +22,11 @@ Change Log
- Fix an issue where default theme change in the preferences was not applied to opened documents under specific conditions.
- Fix an issue where unescaping replacement string in the regular expression replacement failed with specific text patterns.
- Fix an issue where the editor's line height and tab width in the opened windows did not update even the setting is changed.
- Fix an isue where the rainbow cursor could appear when finding the brace pair in the latter part of a large document.
- Fix an issue where the rainbow cursor could appear when finding the brace pair in the latter part of a large document.
- Fix an issue where the application crashed when moving lines down under specific conditions.
- Fix an issue where the “Sort by Pattern” with column sort key dropped the last character from the sort key string.
- Fix an issue where the current line highlight remained when quickly moving selection by dragging.
- Fix an issue where the writable area of newly added split editors shrank.
- Fix an issue in scripting where settings some properties, such as `tab width`, `tab expands` and `wrap lines`, in the document creation phase were ignored.
- Improve stability.

View File

@ -793,18 +793,18 @@ final class DocumentViewController: NSSplitViewController, SyntaxParserDelegate,
/// split editor view
@IBAction func openSplitTextView(_ sender: Any?) {
guard (self.splitViewController?.splitViewItems.count ?? 0) < maximumNumberOfSplitEditors else {
NSSound.beep()
return
}
guard
let splitViewController = self.splitViewController,
let currentEditorViewController = self.findTargetEditorViewController(for: sender)
else { return assertionFailure() }
guard let currentEditorViewController = self.findTargetEditorViewController(for: sender) else { return }
guard splitViewController.splitViewItems.count < maximumNumberOfSplitEditors else { return NSSound.beep() }
// end current editing
NSTextInputContext.current?.discardMarkedText()
let newEditorViewController = EditorViewController.instantiate(storyboard: "EditorView")
self.splitViewController?.addSubview(for: newEditorViewController, relativeTo: currentEditorViewController)
splitViewController.addSubview(for: newEditorViewController, relativeTo: currentEditorViewController)
self.setup(editorViewController: newEditorViewController, baseViewController: currentEditorViewController)
newEditorViewController.navigationBarController?.outlineItems = self.syntaxParser?.outlineItems ?? []

View File

@ -112,13 +112,11 @@ final class SplitViewController: NSSplitViewController {
func addSubview(for editorViewController: EditorViewController, relativeTo otherEditorViewController: EditorViewController?) {
let splitViewItem = NSSplitViewItem(viewController: editorViewController)
splitViewItem.holdingPriority = NSLayoutConstraint.Priority(251)
if let otherEditorViewController = otherEditorViewController {
guard let baseIndex = self.children.firstIndex(of: otherEditorViewController) else {
assertionFailure("The base editor view is not belong to the same window.")
return
return assertionFailure("The base editor view is not belong to the same window.")
}
self.insertSplitViewItem(splitViewItem, at: baseIndex + 1)
@ -127,8 +125,6 @@ final class SplitViewController: NSSplitViewController {
self.addSplitViewItem(splitViewItem)
}
self.splitView.layoutSubtreeIfNeeded()
self.invalidateOpenSplitEditorButtons()
self.invalidateCloseSplitEditorButtons()
}