Skip to content

Commit

Permalink
Refactor FIndPanelFieldView
Browse files Browse the repository at this point in the history
  • Loading branch information
1024jp committed Nov 5, 2023
1 parent 7d9e851 commit a282b44
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
7 changes: 4 additions & 3 deletions CotEditor/Sources/FindPanelFieldView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,13 @@ final class FindPanelFieldViewController: NSViewController, NSTextViewDelegate {
private var resultObservers: Set<AnyCancellable> = []

@IBOutlet private weak var findTextView: RegexFindPanelTextView?
@IBOutlet private weak var replacementTextView: RegexFindPanelTextView?
@IBOutlet private weak var findHistoryMenu: NSMenu?
@IBOutlet private weak var replaceHistoryMenu: NSMenu?
@IBOutlet private weak var findResultField: NSTextField?
@IBOutlet private weak var replacementResultField: NSTextField?
@IBOutlet private weak var findClearButtonConstraint: NSLayoutConstraint?

@IBOutlet private weak var replacementTextView: RegexFindPanelTextView?
@IBOutlet private weak var replaceHistoryMenu: NSMenu?
@IBOutlet private weak var replacementResultField: NSTextField?
@IBOutlet private weak var replacementClearButtonConstraint: NSLayoutConstraint?


Expand Down
18 changes: 3 additions & 15 deletions CotEditor/Sources/FindPanelTextClipView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//
// ---------------------------------------------------------------------------
//
// © 2015-2022 1024jp
// © 2015-2023 1024jp
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -35,25 +35,13 @@ final class FindPanelTextClipView: NSClipView {


// MARK: -
// MARK: Lifecycle

required init?(coder: NSCoder) {

super.init(coder: coder)

// make sure frame to be initialized (Otherwise, input area can be arranged in a wrong place.)
let frame = self.frame
self.frame = frame
}



// MARK: View Methods

/// add paddings
override var frame: NSRect {

didSet {
// add paddings
// -> Just setting .contentInsets doesn't work with the pinch-zoom (macOS 14, 2023-11).
let leftPadding = self.userInterfaceLayoutDirection == .leftToRight ? self.leadingPadding : self.trailingPadding

guard frame.minX < leftPadding else { return } // avoid infinity loop
Expand Down

0 comments on commit a282b44

Please sign in to comment.