Skip to content

Find: Replace and Match Case Toggle #301

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 40 commits into from
May 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
8d9dbd1
Added replace and match case toggle UI.
austincondiff Apr 10, 2025
34f606d
Insets are updating on mode change, still a WIP.
austincondiff Apr 11, 2025
397428b
Implemented wrap around setting logic. Now when disabled, we do not l…
austincondiff Apr 14, 2025
4a852a5
Fixed SwiftLint issues
austincondiff Apr 14, 2025
d15603b
More SwiftLint fixes
austincondiff Apr 14, 2025
97b468d
We are retaining our find match emphases when the replace text field …
austincondiff Apr 16, 2025
58d8391
Enabled match case functionality so now the match case toggle in the …
austincondiff Apr 16, 2025
0b7a36c
Added replace current match functionality.
austincondiff Apr 16, 2025
938e279
Added replace all logic. Adjusted panel text field coloring.
austincondiff Apr 17, 2025
d45d727
Merge branch 'main' into feat/find-replace
thecoolwinter Apr 21, 2025
a67b451
Update TextViewController+StyleViews.swift
thecoolwinter Apr 21, 2025
3bd9c71
Find and Replace Refactor (#311)
thecoolwinter Apr 22, 2025
a9f134e
Fix Fialing Test
thecoolwinter Apr 25, 2025
c6c9e52
Merge branch 'main' into feat/find-replace
thecoolwinter Apr 25, 2025
a55bd4b
Added replace and match case toggle UI.
austincondiff Apr 10, 2025
b6d0a07
Insets are updating on mode change, still a WIP.
austincondiff Apr 11, 2025
ab32c92
Implemented wrap around setting logic. Now when disabled, we do not l…
austincondiff Apr 14, 2025
717d3f9
Fixed SwiftLint issues
austincondiff Apr 14, 2025
4f0ddd2
More SwiftLint fixes
austincondiff Apr 14, 2025
09555f6
We are retaining our find match emphases when the replace text field …
austincondiff Apr 16, 2025
88a364a
Enabled match case functionality so now the match case toggle in the …
austincondiff Apr 16, 2025
8f8c81a
Added replace current match functionality.
austincondiff Apr 16, 2025
2215aa3
Added replace all logic. Adjusted panel text field coloring.
austincondiff Apr 17, 2025
26edd07
Update TextViewController+StyleViews.swift
thecoolwinter Apr 21, 2025
53c6b80
Find and Replace Refactor (#311)
thecoolwinter Apr 22, 2025
35df1a2
Fix Fialing Test
thecoolwinter Apr 25, 2025
86d20a7
Fixed most of the bugs introduced in the find replace refactor.
austincondiff Apr 29, 2025
8213913
Merge branch 'feat/find-replace' of https://github.com/CodeEditApp/Co…
thecoolwinter May 2, 2025
d23caf6
Made find panel responsive to width. When too narrow control text tur…
austincondiff May 2, 2025
b683d1c
Remove Hard Dependency on `TextViewController`
thecoolwinter May 2, 2025
923cb88
Added to the last commit, forgot to stage all.
austincondiff May 2, 2025
9abe5ae
Maintain find matches when typing, respect wrap around preference whe…
austincondiff May 6, 2025
080f0cc
Fixed issue where reformatting guide was not allowing text view to ge…
austincondiff May 6, 2025
e840a64
Fixed failing test
austincondiff May 6, 2025
9161bef
Added file header
austincondiff May 6, 2025
83b9865
Clean Up Boolean Statements in Views
thecoolwinter May 7, 2025
5875e40
Revert Help Modifier Changes
thecoolwinter May 8, 2025
4efb3e5
Wrote documentation for find subviews.
austincondiff May 9, 2025
4600f9b
Added previews for find views
austincondiff May 9, 2025
dd8a657
Update ReformattingGuideView.swift
austincondiff May 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
"version" : "0.1.20"
}
},
{
"identity" : "codeeditsymbols",
"kind" : "remoteSourceControl",
"location" : "https://github.com/CodeEditApp/CodeEditSymbols.git",
"state" : {
"revision" : "ae69712b08571c4469c2ed5cd38ad9f19439793e",
"version" : "0.2.3"
}
},
{
"identity" : "codeedittextview",
"kind" : "remoteSourceControl",
Expand Down
9 changes: 9 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
"version" : "0.1.20"
}
},
{
"identity" : "codeeditsymbols",
"kind" : "remoteSourceControl",
"location" : "https://github.com/CodeEditApp/CodeEditSymbols.git",
"state" : {
"revision" : "ae69712b08571c4469c2ed5cd38ad9f19439793e",
"version" : "0.2.3"
}
},
{
"identity" : "codeedittextview",
"kind" : "remoteSourceControl",
Expand Down
8 changes: 7 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ let package = Package(
url: "https://github.com/CodeEditApp/CodeEditLanguages.git",
exact: "0.1.20"
),
// CodeEditSymbols
.package(
url: "https://github.com/CodeEditApp/CodeEditSymbols.git",
exact: "0.2.3"
),
// SwiftLint
.package(
url: "https://github.com/lukepistrol/SwiftLintPlugin",
Expand All @@ -43,7 +48,8 @@ let package = Package(
dependencies: [
"CodeEditTextView",
"CodeEditLanguages",
"TextFormation"
"TextFormation",
"CodeEditSymbols"
],
plugins: [
.plugin(name: "SwiftLint", package: "SwiftLintPlugin")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import AppKit
extension TextViewController {
/// Sets new cursor positions.
/// - Parameter positions: The positions to set. Lines and columns are 1-indexed.
public func setCursorPositions(_ positions: [CursorPosition]) {
public func setCursorPositions(_ positions: [CursorPosition], scrollToVisible: Bool = false) {
if isPostingCursorNotification { return }
var newSelectedRanges: [NSRange] = []
for position in positions {
Expand All @@ -33,6 +33,10 @@ extension TextViewController {
}
}
textView.selectionManager.setSelectedRanges(newSelectedRanges)

if scrollToVisible {
textView.scrollSelectionToVisible()
}
}

/// Update the ``TextViewController/cursorPositions`` variable with new text selections from the text view.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@
// Created by Khan Winter on 3/16/25.
//

import Foundation
import AppKit
import CodeEditTextView

extension TextViewController: FindPanelTarget {
var findPanelTargetView: NSView {
textView
}

func findPanelWillShow(panelHeight: CGFloat) {
updateContentInsets()
}
Expand All @@ -17,6 +21,10 @@ extension TextViewController: FindPanelTarget {
updateContentInsets()
}

func findPanelModeDidChange(to mode: FindPanelMode) {
updateContentInsets()
}

var emphasisManager: EmphasisManager? {
textView?.emphasisManager
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ extension TextViewController {
self.findViewController?.showFindPanel()
return nil
case (0, "\u{1b}"): // Escape key
self.findViewController?.findPanel.dismiss()
self.findViewController?.hideFindPanel()
return nil
case (_, _):
return event
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,11 @@ extension TextViewController {
minimapView.scrollView.contentInsets.bottom += additionalTextInsets?.bottom ?? 0

// Inset the top by the find panel height
let findInset = (findViewController?.isShowingFindPanel ?? false) ? FindPanel.height : 0
let findInset: CGFloat = if findViewController?.viewModel.isShowingFindPanel ?? false {
findViewController?.viewModel.panelHeight ?? 0
} else {
0
}
scrollView.contentInsets.top += findInset
minimapView.scrollView.contentInsets.top += findInset

Expand Down
18 changes: 0 additions & 18 deletions Sources/CodeEditSourceEditor/Find/FindPanelDelegate.swift

This file was deleted.

20 changes: 20 additions & 0 deletions Sources/CodeEditSourceEditor/Find/FindPanelMode.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// FindPanelMode.swift
// CodeEditSourceEditor
//
// Created by Khan Winter on 4/18/25.
//

enum FindPanelMode: CaseIterable {
case find
case replace

var displayName: String {
switch self {
case .find:
return "Find"
case .replace:
return "Replace"
}
}
}
9 changes: 5 additions & 4 deletions Sources/CodeEditSourceEditor/Find/FindPanelTarget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@
// Created by Khan Winter on 3/10/25.
//

import Foundation
import AppKit
import CodeEditTextView

protocol FindPanelTarget: AnyObject {
var emphasisManager: EmphasisManager? { get }
var text: String { get }
var textView: TextView! { get }
var findPanelTargetView: NSView { get }

var cursorPositions: [CursorPosition] { get }
func setCursorPositions(_ positions: [CursorPosition])
func setCursorPositions(_ positions: [CursorPosition], scrollToVisible: Bool)
func updateCursorPosition()

func findPanelWillShow(panelHeight: CGFloat)
func findPanelWillHide(panelHeight: CGFloat)
func findPanelModeDidChange(to mode: FindPanelMode)
}

This file was deleted.

Loading