lTop = textarea.scrollTop;
            });

            const findIndexOfCurrentWord = () => {
                // Get current value and cursor position
                const currentValue = textarea.value;
                const cursorPos = textarea.selectionStart;

                // Iterate backwards through characters until we find a space or newline character
                let startIndex = cursorPos - 1;
                while (startIndex >= 0 && !/\s/.test(currentValue[startIndex])) {
                  