0
0
mirror of https://github.com/florisboard/florisboard.git synced 2024-09-19 19:42:20 +02:00

fix pinned items getting unpinned when copying the same content again

This commit is contained in:
lm41 2024-01-13 03:13:13 +01:00
parent f7b65f788f
commit 5b8b73ff16
No known key found for this signature in database
GPG Key ID: AA39CE739E6B9452

View File

@ -224,7 +224,14 @@ class ClipboardManager(
if (prefs.clipboard.historyEnabled.get()) {
val historyElement = history().all.firstOrNull { it.type == ItemType.TEXT && it.text == newItem.text }
if (historyElement != null) {
moveToTheBeginning(historyElement, newItem)
moveToTheBeginning(
oldItem = historyElement,
newItem = if (historyElement.isPinned) {
newItem.copy(isPinned = true)
} else {
newItem
}
)
} else {
insertClip(newItem)
}