the other problem that it doesn't scrolls to exact current caret position at bottom…
- User
the other problem that it doesn't scrolls to exact current caret position at bottom inside textarea, when it reaches max-height in ".textarea" "max-height:50vh;". mst probably because gradient newline overrides new line and don't allow things to scroll to current caret position, but who knows. you are smart as I see. why hidding gradient or anything if it's intended to be, except solving proper alignment in iteration, for which should be shown or hidden afterwards of what excatly to solve this issue. no, return to original code. try placing this gradient line animation on the current initial line from the beginning and the previous line afterwards.: ```
code.container { display: grid; width: 100%; height: 100%; padding-top: 0px; place-items: center; } .textarea { width: 100%; height: auto; max-height: 50vh; font-family: 'Courier New', monospace; font-size: 18px; font-weight: bold; color: cyan; background: rgba(1, 1, 3, 0.9); border: 2px inset #252555; overflow: auto; white-space: pre-wrap; grid-row-gap: 1px; } .highlight-line { position: relative; display: grid; align-items: center; height: 18px; background: transparent; } .gradient { position: absolute; left: 0; top: 0; width: 100%; height: 100%; background: linear-gradient(to right, rgba(155, 0, 0, 1), rgba(0, 0, 155, 0.2)); transform-origin: left; opacity: 0; transition: opacity 0.2s linear; } .highlighted { background: rgba(155, 0, 0, 0.1); }codefunction setCaretToEnd() { const range = document.createRange(); const selection = window.getSelection(); range.selectNodeContents(textarea); range.collapse(false); selection.removeAllRanges(); selection.addRange(range); }function handleKeyPress(event) { if (event.key === 'Enter' || event.key === 'Return') { event.preventDefault(); const selection = document.getSelection(); const range = selection.getRangeAt(0); const currentNode = range.startContainer; const lineBreak = document.createElement('br'); const highlightedLine = document.createElement('span'); highlightedLine.classList.add('highlight-line'); const gradientContainer = document.createElement('span'); gradientContainer.classList.add('gradient-container'); const gradient = document.createElement('span'); gradient.classList.add('gradient');
- Assistant