`moor` hangs when opening files with extremely long lines
I tried using moor to open a file containing very long lines (the longest was 248,387,328 characters), and it hung indefinitely. In contrast, less -S opened the file without issues.
I am not sure how less handles such cases so efficiently, but it likely reads only the portion needed to render the current screen and then moves to the next line without fully processing the remainder. At minimum, it must locate the end of each line.
I never tried moor on files with lines that long, I'll see what I can do.
Out of curiosity, what kind of file is that with 250MB long lines?
In this particular case, it was a FASTA file. It's a format that stores DNA or protein sequences. Usually, sequences are broken into multiple lines:
>sequence_1
GTGCAAAAACTGTGTACAAAAGCCCCAAAGTATAATTTGCGCAGTTGAGCACATGTTCTG
TTGTCCAGCATTTATGGTGGTTTGTAGTGGAAAAGATTTTTAGAATATGTGGATTTTTGG
GATATTCCCAGAAGCCCAGATGGCCACACTTTAACTTTGGAGGAATTAATTCTCAGAATA
TTGCACACAATCAATCGCCTTTGGAAGGAGCATATATTCCCAGCAAAAGCTCTGGTTTTT
TGAAGTCTGTGTTGTGTGTTATTTCCAGGAGAATATGCAATGATGACAATGTTATTAACT
GATTCGAATATGAAATGCTGTTATGCCAAACAATGAATCTTTGTGTTACACATTATGCCT
AACTATAAATCTTCGTGTTATACATTTTAATGTCATTGGAGAGTACTCCTGTCTTCTTGG
CATTATTGATAATTCGATTCTAATTGCTAATAAGTCAGAAAAATTAGGAACACCAAATTT
CAGTCGTCTCAAAAGCACTCCTCTTATTAAATTTGGATTTTTACCTTTATCACATCAAAA
GAAATATTGTTAGAAAGGTGTTTAATGTTTTCCAGATGGTTAGATTACTGT
>sequence_2
GAAGGGAGCTGGGAATGAGGGGCCACACAAGCCCGGGACGGAGGCCTGTCGCACATGGGG
TGGCCCCGACTCAGGCCCTGGAGTTGGCCAGGACCCTCTAGCATCCTCAAGGGCTGGGCC
AACCAGGCTGGCATGGGGTGGGGCAGGGGAGGGCTGAGCCAGTGGGCGTCGTCTGTAGGG
GGATGCCCAACTGCGGCCCCGTCTCTCGG
But this is not enforced and it's not uncommon to have the entire sequence in a single line. When your sequence is an entire genome, you end up with an incredibly long line.
So obviously moor should not hang.
What if I put a limit in place so that lines get truncated at 500 characters or so?
How would that work for you?
Not sure what would be the right thing here, just weighing my options.
That could work. Is there a way to determine the number of characters from the terminal width? Just to be sure even more extreme cases are covered.
In v2.9.6, just out, this works less bad.
Not great, but an improvement.
I'll keep this ticket open for now.
Thanks, @walles!