Skip to content

Commit

Permalink
Support highlighting with background color a-la Safari
Browse files Browse the repository at this point in the history
Fixes #830
  • Loading branch information
p0deje committed Sep 14, 2024
1 parent 1bc6755 commit d227e8a
Show file tree
Hide file tree
Showing 26 changed files with 30 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .bartycrouch.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ subpathsToIgnore = [".git", "carthage", "pods", "build", ".build", "docs"]
translator = "deepL"
secret = "<replace>"
sourceLocale = "en"
separateWithEmptyLine = false

[update.normalize]
paths = ["Maccy"]
subpathsToIgnore = [".git", "carthage", "pods", "build", ".build", "docs"]
separateWithEmptyLine = false
sortByKeys = false

[lint]
paths = ["Maccy"]
Expand Down
3 changes: 3 additions & 0 deletions Maccy/HighlightMatch.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Foundation
import Defaults

enum HighlightMatch: String, CaseIterable, Identifiable, CustomStringConvertible, Defaults.Serializable {
case color
case bold
case italic
case underline
Expand All @@ -12,6 +13,8 @@ enum HighlightMatch: String, CaseIterable, Identifiable, CustomStringConvertible
switch self {
case .bold:
return NSLocalizedString("HighlightMatchBold", tableName: "AppearanceSettings", comment: "")
case .color:
return NSLocalizedString("HighlightMatchColor", tableName: "AppearanceSettings", comment: "")
case .italic:
return NSLocalizedString("HighlightMatchItalic", tableName: "AppearanceSettings", comment: "")
case .underline:
Expand Down
5 changes: 4 additions & 1 deletion Maccy/Observables/HistoryItemDecorator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,15 @@ class HistoryItemDecorator: Identifiable, Hashable {
var attributedString = AttributedString(title.shortened(to: 500))
for range in attributedString.ranges(of: query, options: .caseInsensitive) {
switch Defaults[.highlightMatch] {
case .bold:
attributedString[range].font = .bold(.body)()
case .italic:
attributedString[range].font = .italic(.body)()
case .underline:
attributedString[range].underlineStyle = .single
default:
attributedString[range].font = .bold(.body)()
attributedString[range].backgroundColor = .findHighlightColor
attributedString[range].foregroundColor = .black
}
}

Expand Down
1 change: 1 addition & 0 deletions Maccy/Settings/ar.lproj/AppearanceSettings.strings
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"PreviewDelay" = "تأخير المعاينة:";
"PreviewDelayTooltip" = "التأخير بالميللي ثانية حتى يتم عرض معاينة النافذة المنبثقة.\nالافتراضي: 1500.";
"HighlightMatches" = "تسليط الضوء على التطابقات:";
"HighlightMatchColor" = "اللون";
"HighlightMatchBold" = "عريض";
"HighlightMatchItalic" = "مائل";
"HighlightMatchUnderline" = "تسطير";
Expand Down
1 change: 1 addition & 0 deletions Maccy/Settings/bs.lproj/AppearanceSettings.strings
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"PreviewDelay" = "Kašnjenje pregleda:";
"PreviewDelayTooltip" = "Kašnjenje u milisekundama dok se ne prikaže skočni prozor za pregled.\nZadano: 1500.";
"HighlightMatches" = "Istaknite utakmice:";
"HighlightMatchColor" = "Boja";
"HighlightMatchBold" = "Podebljano";
"HighlightMatchItalic" = "Kurziv";
"HighlightMatchUnderline" = "Podvući";
Expand Down
1 change: 1 addition & 0 deletions Maccy/Settings/cs.lproj/AppearanceSettings.strings
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"PreviewDelay" = "Zpoždení náhledu:";
"PreviewDelayTooltip" = "Zpoždění v milisekundách před zobrazením popup okna.\nVýchozí: 1500.";
"HighlightMatches" = "Zvýraznit shody:";
"HighlightMatchColor" = "Barva";
"HighlightMatchBold" = "Tučně";
"HighlightMatchItalic" = "Kurzívou";
"HighlightMatchUnderline" = "Podtržením";
Expand Down
1 change: 1 addition & 0 deletions Maccy/Settings/de.lproj/AppearanceSettings.strings
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"PreviewDelay" = "Vorschauverzögerung:";
"PreviewDelayTooltip" = "Verzögerung in Millisekunden, bis ein Vorschau-Popup angezeigt wird.\nStandard: 1500.";
"HighlightMatches" = "Übereinstimmungen hervorheben:";
"HighlightMatchColor" = "Farbe";
"HighlightMatchBold" = "Fett";
"HighlightMatchItalic" = "Kursiv";
"HighlightMatchUnderline" = "Unterstreichen";
Expand Down
1 change: 1 addition & 0 deletions Maccy/Settings/en.lproj/AppearanceSettings.strings
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"PreviewDelay" = "Preview delay:";
"PreviewDelayTooltip" = "Delay in milliseconds until a preview popup is shown.\nDefault: 1500.";
"HighlightMatches" = "Highlight matches:";
"HighlightMatchColor" = "Color";
"HighlightMatchBold" = "Bold";
"HighlightMatchItalic" = "Italic";
"HighlightMatchUnderline" = "Underline";
Expand Down
1 change: 1 addition & 0 deletions Maccy/Settings/es.lproj/AppearanceSettings.strings
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"PreviewDelay" = "Retraso de vista previa:";
"PreviewDelayTooltip" = "Retraso en milisegundos hasta que se muestra una ventana emergente de vista previa.\nPor defecto: 1500.";
"HighlightMatches" = "Partidos destacados:";
"HighlightMatchColor" = "Color";
"HighlightMatchBold" = "Negrita";
"HighlightMatchItalic" = "Itálica";
"HighlightMatchUnderline" = "Subrayar";
Expand Down
1 change: 1 addition & 0 deletions Maccy/Settings/fr.lproj/AppearanceSettings.strings
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"PreviewDelay" = "Délai de prévisualisation :";
"PreviewDelayTooltip" = "Délai en millisecondes jusqu'à ce qu'une fenêtre d'aperçu s'affiche.\nPar défaut : 1500.";
"HighlightMatches" = "Matchs phares :";
"HighlightMatchColor" = "Couleur";
"HighlightMatchBold" = "Gras";
"HighlightMatchItalic" = "Italique";
"HighlightMatchUnderline" = "Souligner";
Expand Down
1 change: 1 addition & 0 deletions Maccy/Settings/he.lproj/AppearanceSettings.strings
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"PreviewDelay" = "השהיית תצוגה מקדימה:";
"PreviewDelayTooltip" = "השהיה באלפיות השנייה עד להופעת חלונית תצוגה מקדימה.\nברירת מחדל: 1500.";
"HighlightMatches" = "הדגשת תוצאות:";
"HighlightMatchColor" = "צֶבַע";
"HighlightMatchBold" = "מודגש";
"HighlightMatchItalic" = "נטוי";
"HighlightMatchUnderline" = "קו תחתי";
Expand Down
1 change: 1 addition & 0 deletions Maccy/Settings/hr.lproj/AppearanceSettings.strings
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"PreviewDelay" = "Odgoda pregleda:";
"PreviewDelayTooltip" = "Odgoda u milisekundama dok se ne prikaže skočni prozor za pregled.\nStandardno: 1500.";
"HighlightMatches" = "Označite podudaranja:";
"HighlightMatchColor" = "Boja";
"HighlightMatchBold" = "Podebljano";
"HighlightMatchItalic" = "Kurziv";
"HighlightMatchUnderline" = "Naglasiti";
Expand Down
1 change: 1 addition & 0 deletions Maccy/Settings/it.lproj/AppearanceSettings.strings
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"PreviewDelay" = "Anteprima ritardo:";
"PreviewDelayTooltip" = "Ritardo in millisecondi prima che venga visualizzato un popup di anteprima.\nDefault: 1500.";
"HighlightMatches" = "Evidenzia le partite:";
"HighlightMatchColor" = "Colore";
"HighlightMatchBold" = "Grassetto";
"HighlightMatchItalic" = "Corsiva";
"HighlightMatchUnderline" = "Sottolineare";
Expand Down
1 change: 1 addition & 0 deletions Maccy/Settings/ja.lproj/AppearanceSettings.strings
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"PreviewDelay" = "プレビューの遅延:";
"PreviewDelayTooltip" = "プレビュー ポップアップが表示されるまでのミリ秒単位の遅延。\nデフォルト:1500。";
"HighlightMatches" = "一致を強調表示する:";
"HighlightMatchColor" = "カラー";
"HighlightMatchBold" = "太字";
"HighlightMatchItalic" = "イタリック";
"HighlightMatchUnderline" = "下線";
Expand Down
1 change: 1 addition & 0 deletions Maccy/Settings/ko.lproj/AppearanceSettings.strings
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"PreviewDelay" = "미리보기 지연:";
"PreviewDelayTooltip" = "미리보기 팝업이 표시될 때까지 밀리초 단위로 지연됩니다.\n기본값: 1500.";
"HighlightMatches" = "경기 하이라이트:";
"HighlightMatchColor" = "색상";
"HighlightMatchBold" = "굵게";
"HighlightMatchItalic" = "이탤릭체";
"HighlightMatchUnderline" = "밑줄";
Expand Down
1 change: 1 addition & 0 deletions Maccy/Settings/nb.lproj/AppearanceSettings.strings
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"PreviewDelay" = "Forsinkelse for forhåndsvisning:";
"PreviewDelayTooltip" = "Utsett i millisekunder til en forhåndsvisningspopup vises.\nStandard: 1500.";
"HighlightMatches" = "Fremhev kamper:";
"HighlightMatchColor" = "Farge";
"HighlightMatchBold" = "Fet";
"HighlightMatchItalic" = "Kursiv";
"HighlightMatchUnderline" = "Understreke";
Expand Down
1 change: 1 addition & 0 deletions Maccy/Settings/nl.lproj/AppearanceSettings.strings
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"PreviewDelay" = "Vertraging:";
"PreviewDelayTooltip" = "Vertraging in milliseconden totdat een voorbeeldpop-up wordt weergegeven.\nStandaard: 1500.";
"HighlightMatches" = "Markeer overeenkomsten:";
"HighlightMatchColor" = "Kleur";
"HighlightMatchBold" = "Vetgedrukt";
"HighlightMatchItalic" = "Cursief";
"HighlightMatchUnderline" = "Onderstreep";
Expand Down
1 change: 1 addition & 0 deletions Maccy/Settings/pt-BR.lproj/AppearanceSettings.strings
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"PreviewDelay" = "Atraso de pré-visualização:";
"PreviewDelayTooltip" = "Atraso em milissegundos até que um popup de pré-visualização seja mostrado.\nPadrão: 1500.";
"HighlightMatches" = "Destacar resultados:";
"HighlightMatchColor" = "Cor";
"HighlightMatchBold" = "Negrito";
"HighlightMatchItalic" = "Itálico";
"HighlightMatchUnderline" = "Sublinhado";
Expand Down
1 change: 1 addition & 0 deletions Maccy/Settings/ru.lproj/AppearanceSettings.strings
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"PreviewDelay" = "Задержка предварительного просмотра:";
"PreviewDelayTooltip" = "Задержка в миллисекундах до появления всплывающего окна предварительного просмотра.\nПо умолчанию: 1500.";
"HighlightMatches" = "Выделить совпадения:";
"HighlightMatchColor" = "Цвет";
"HighlightMatchBold" = "Жирный";
"HighlightMatchItalic" = "Курсив";
"HighlightMatchUnderline" = "Подчеркнутый";
Expand Down
1 change: 1 addition & 0 deletions Maccy/Settings/th.lproj/AppearanceSettings.strings
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"PreviewDelay" = "ความล่าช้าในการดูตัวอย่าง:";
"PreviewDelayTooltip" = "หน่วงเวลาเป็นมิลลิวินาทีจนกว่าจะแสดงตัวอย่างป๊อปอัป.\nค่าเริ่มต้น: 1500";
"HighlightMatches" = "ไฮไลท์การแข่งขัน:";
"HighlightMatchColor" = "สี";
"HighlightMatchBold" = "ตัวหนา";
"HighlightMatchItalic" = "ตัวเอียง";
"HighlightMatchUnderline" = "ขีดเส้นใต้";
Expand Down
1 change: 1 addition & 0 deletions Maccy/Settings/tr.lproj/AppearanceSettings.strings
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"PreviewDelay" = "Önizleme gecikmesi:";
"PreviewDelayTooltip" = "Önizleme açılır penceresi gösterilene kadar milisaniye cinsinden gecikme.\nSaptanmış: 1500.";
"HighlightMatches" = "Maçları vurgula:";
"HighlightMatchColor" = "Renk";
"HighlightMatchBold" = "Kalın";
"HighlightMatchItalic" = "Italik";
"HighlightMatchUnderline" = "Altını çizmek";
Expand Down
1 change: 1 addition & 0 deletions Maccy/Settings/uk.lproj/AppearanceSettings.strings
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"PreviewDelay" = "Затримка попереднього перегляду:";
"PreviewDelayTooltip" = "Затримка в мілісекундах до появи спливаючого вікна попереднього перегляду.\nЗа замовчуванням: 1500.";
"HighlightMatches" = "Виділіть збіги:";
"HighlightMatchColor" = "Колір";
"HighlightMatchBold" = "Жирний";
"HighlightMatchItalic" = "Курсив";
"HighlightMatchUnderline" = "Підкреслити";
Expand Down
1 change: 1 addition & 0 deletions Maccy/Settings/zh-Hans.lproj/AppearanceSettings.strings
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"PreviewDelay" = "预览延迟:";
"PreviewDelayTooltip" = "延迟以毫秒为单位,直到显示预览弹出窗口。\n默认:1500。";
"HighlightMatches" = "高亮匹配:";
"HighlightMatchColor" = "颜色";
"HighlightMatchBold" = "粗体";
"HighlightMatchItalic" = "斜体";
"HighlightMatchUnderline" = "强调";
Expand Down
1 change: 1 addition & 0 deletions Maccy/Settings/zh-Hant.lproj/AppearanceSettings.strings
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"PreviewDelay" = "預覽延遲:";
"PreviewDelayTooltip" = "顯示預覽彈出視窗的延遲,單位為毫秒。\n預設:1500。";
"HighlightMatches" = "凸顯相符項目:";
"HighlightMatchColor" = "顏色";
"HighlightMatchBold" = "粗體";
"HighlightMatchItalic" = "斜體";
"HighlightMatchUnderline" = "底線";
Expand Down
4 changes: 0 additions & 4 deletions Maccy/cs.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
"quit" = "Ukončit";
"preferences" = "Předvolby…";
"preferences_advanced" = "Pokročilé";
"preferences_appearance" = "Vzhled";
"preferences_general" = "Obecné";
"preferences_pins" = "Připnuté";
"accessibility_alert_message" = "„Maccy” by ráda ovládala tento počítač přes fuknce Zpřístupnění.";
"accessibility_alert_deny" = "Odmítnout";
Expand All @@ -28,7 +26,5 @@
"quit_tooltip" = "Ukončit aplikaci.";
"accessibility_alert_comment" = "Uděl aplikaci přístup v {pane}, umístěném v {settings}.\n\nKlikni na tlačítko +, vyber Maccy a zapni přepínač vedle názvu.";
"about" = "O aplikaci";
"preferences_ignore" = "Ignorovat";
"preferences_storage" = "Úložistě";
"copy_modifiers_config" = "• Vyber se stisknutím %@ pro zkopírování položky.";
"format_modifiers_config" = "• Vyber se stisknutím %@ pro zkopírování, odstranění formátování a vložení položky.";
4 changes: 0 additions & 4 deletions Maccy/pt-BR.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
"about" = "Sobre";
"preferences" = "Preferências…";
"preferences_advanced" = "Avançado";
"preferences_appearance" = "Aparência";
"preferences_ignore" = "Ignorar";
"preferences_general" = "Geral";
"preferences_storage" = "Armazenamento";
"clear_all" = "Limpar tudo";
"clear_all_tooltip" = "Limpar todos os itens.";
"about_tooltip" = "Ler mais sobre o aplicativo.";
Expand Down

0 comments on commit d227e8a

Please sign in to comment.