Skip to content

Commit

Permalink
Merge branch 'feature/initialScroll'
Browse files Browse the repository at this point in the history
  • Loading branch information
1024jp committed Dec 15, 2024
2 parents 53dd3bf + 25f33f9 commit b2f0d7d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

- Provide more Unicode information about the selected character in the document inspector.
- Improve the trimming of whitespaces in the extracted outline labels.
- Adjust the editor’s initial scroll position.


### Fixes
Expand Down
10 changes: 8 additions & 2 deletions CotEditor/Sources/Document Window/Text View/EditorTextView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -370,18 +370,24 @@ final class EditorTextView: NSTextView, CurrentLineHighlighting, MultiCursorEdit

override func setFrameSize(_ newSize: NSSize) {

let didChange = newSize != self.frame.size
let oldSize = self.frame.size

super.setFrameSize(newSize)

guard didChange else { return }
guard newSize != oldSize else { return }

if !self.inLiveResize {
self.overscrollResizingDebouncer.schedule()
}

self.needsUpdateInsertionIndicators = true
self.needsUpdateLineHighlight = true

// set initial scroll position
// -> Otherwise, it would shift by the top inset (2024-12, macOS 15).
if oldSize.width == 0, newSize.width > 0 {
self.scroll(.zero)
}
}


Expand Down

0 comments on commit b2f0d7d

Please sign in to comment.