react-terminal icon indicating copy to clipboard operation
react-terminal copied to clipboard

Feature request: width of terminal in number of characters

Open wrinklykong opened this issue 9 months ago • 0 comments

Summary

To my knowledge there is no way to determine the # of characters the terminal can support at one time. It would be nice to have a simple Terminal.width property which could tell us this information

My current jank fix

Grab the client width of the terminal and divide by 12 (12 seemed to be the sweet spot, not sure if this is specific to my machine or not)

    function get_max_number_of_characters () {
        const width = document.getElementById('terminal_container').clientWidth
        const max_number = Math.floor(width / 12)
        return max_number
    }

Results:

Really cool stuff! image

wrinklykong avatar May 06 '24 04:05 wrinklykong