Move FuzzyMatcher to TuskerComponents

This commit is contained in:
Shadowfacts 2024-04-17 22:34:11 -04:00
parent 8960873ff3
commit 4ecc16a93b
3 changed files with 5 additions and 3 deletions

View File

@ -8,6 +8,7 @@
import SwiftUI import SwiftUI
import Pachyderm import Pachyderm
import Combine import Combine
import TuskerComponents
class AutocompleteEmojisController: ViewController { class AutocompleteEmojisController: ViewController {
unowned let composeController: ComposeController unowned let composeController: ComposeController

View File

@ -8,6 +8,7 @@
import SwiftUI import SwiftUI
import Combine import Combine
import Pachyderm import Pachyderm
import TuskerComponents
class AutocompleteHashtagsController: ViewController { class AutocompleteHashtagsController: ViewController {
unowned let composeController: ComposeController unowned let composeController: ComposeController

View File

@ -1,6 +1,6 @@
// //
// FuzzyMatcher.swift // FuzzyMatcher.swift
// ComposeUI // TuskerComponents
// //
// Created by Shadowfacts on 10/10/20. // Created by Shadowfacts on 10/10/20.
// Copyright © 2020 Shadowfacts. All rights reserved. // Copyright © 2020 Shadowfacts. All rights reserved.
@ -8,7 +8,7 @@
import Foundation import Foundation
struct FuzzyMatcher { public struct FuzzyMatcher {
private init() {} private init() {}
@ -21,7 +21,7 @@ struct FuzzyMatcher {
/// +2 points for every char in `pattern` that occurs in `str` sequentially /// +2 points for every char in `pattern` that occurs in `str` sequentially
/// -2 points for every char in `pattern` that does not occur in `str` sequentially /// -2 points for every char in `pattern` that does not occur in `str` sequentially
/// -1 point for every char in `str` skipped between matching chars from the `pattern` /// -1 point for every char in `str` skipped between matching chars from the `pattern`
static func match(pattern: String, str: String) -> (matched: Bool, score: Int) { public static func match(pattern: String, str: String) -> (matched: Bool, score: Int) {
let pattern = pattern.lowercased() let pattern = pattern.lowercased()
let str = str.lowercased() let str = str.lowercased()