Skip to content

Commit bbe6662

Browse files
committed
fix too long candidate/comment style for scroll mode
1 parent a5210d4 commit bbe6662

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

page/generic.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@
110110
opacity: 1;
111111
}
112112

113+
.fcitx-comment {
114+
overflow-wrap: anywhere; /* Disallow long comment to introduce horizontal scrollbar. */
115+
}
116+
113117
.fcitx-divider {
114118
flex-grow: 1;
115119
}

page/scroll.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,12 @@ export function recalculateScroll(scrollStart: boolean) {
126126
rowItemCount.push(itemCount)
127127
itemCount = 1
128128
currentY = y
129+
const previousDivider = candidate.previousElementSibling!
130+
if (previousDivider.getBoundingClientRect().y === y) {
131+
// The element in previous row is too long so the divider goes to the next row.
132+
// The fix should not affect how many candidates in a row.
133+
previousDivider.setAttribute('style', 'flex-grow: 0')
134+
}
129135
}
130136
}
131137
rowItemCount.push(itemCount)

0 commit comments

Comments
 (0)