Skip to content

Commit

Permalink
fix too long candidate/comment style for scroll mode
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleoflqj committed Sep 30, 2024
1 parent a5210d4 commit bbe6662
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions page/generic.scss
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@
opacity: 1;
}

.fcitx-comment {
overflow-wrap: anywhere; /* Disallow long comment to introduce horizontal scrollbar. */
}

.fcitx-divider {
flex-grow: 1;
}
Expand Down
6 changes: 6 additions & 0 deletions page/scroll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ export function recalculateScroll(scrollStart: boolean) {
rowItemCount.push(itemCount)
itemCount = 1
currentY = y
const previousDivider = candidate.previousElementSibling!
if (previousDivider.getBoundingClientRect().y === y) {
// The element in previous row is too long so the divider goes to the next row.
// The fix should not affect how many candidates in a row.
previousDivider.setAttribute('style', 'flex-grow: 0')
}
}
}
rowItemCount.push(itemCount)
Expand Down

0 comments on commit bbe6662

Please sign in to comment.