fix: the message field grows only when the word really wraps (measured without a scrollbar taking its width); the stop button red

This commit is contained in:
redtea committed 2026-10-16 20:04:38 +03:00
1 parent 087eabf3b4
commit 2ab2aa1e38
2 files changed
+13 -1

No files matched your search

+10 -1
View File
@@ -792,6 +792,7 @@
function sendState() {
const on = !!ac || !!input.value.trim() || attachments.length > 0;
send.classList.toggle('show', on);
send.classList.toggle('stop', !!ac);
send.tabIndex = on ? 0 : -1;
}
input.addEventListener('input', sendState);
@@ -807,7 +808,15 @@
grow(); sendState();
}
// The field grows with the text, up to a few lines.
function grow() { input.style.height = '40px'; input.style.height = Math.min(140, input.scrollHeight + 2) + 'px'; }
// Measured with no scrollbar: one showing in the squeezed field would take
// its width and wrap the last word a character too early.
function grow() {
input.style.overflowY = 'hidden';
input.style.height = '40px';
const h = input.scrollHeight + 2;
input.style.height = Math.min(140, h) + 'px';
input.style.overflowY = h > 140 ? 'auto' : 'hidden';
}
input.addEventListener('input', grow);
input.addEventListener('keydown', ev => {
if (ev.key === 'Enter' && !ev.shiftKey && !ev.isComposing) { ev.preventDefault(); q('.ai-form-in').requestSubmit(); }