Sun 03 Jul 2016 03:45:40 PM UTC, original submission:
To reproduce, run 'for x in $(seq 66); do cat NEWS >>hundredthousand.c; done'. Then run 'src/nano +99999 hundredthousand.c', and see how between the message "Read 100518 lines" and actually displaying the file there is just a brief moment. Exit from nano and run the same command again, but now hit a key (say "H") shortly after hitting Enter. See how after "Read 100518 lines" there is a pause of five, six seconds before the file is actually displayed.
This probably is because when there is no precalculated data, nano has to laboriously work its way back to find existing data, and this for every screen line, or for every occurrence of a possible end match -- I'm not sure, it's too complicated.
Even worse, in this situation every PageUp or PageDown also takes those maddening five seconds. (Of course, an Enter also takes five seconds, but when not typing anything at startup, at least one could move around with normal quickness.)
I think that we should either limit the number of lines that are reset, or otherwise (when working backwards) simply give after a certaing number of lines instead of going back all the way to the top of the file. That might cause some miscolorings, but that is better than this maddening unresponsiveness.
If a hundred thousand lines take five seconds, then two thousand lines would take a tenth of second. That sounds like an acceptable delay. So: when searching backward has not given a result withing 2000 lines, then give up and assume there is no match. And most likely there isn't, because what would be the point of coloring more than 2000 lines in the same color? Useless. Syntax coloring is good for highlihgting short words, or maybe a few lines, or a block of comments of twenty or fifty lines, but much more than that is an abuse.
Oh, and the above delay is with the default C syntax. When using the snake syntax (-Ysnake, see below), and typing a key right after startup, displaying the file takes nearly two minutes! :|
syntax "snake"
color brightred "#.*"
color green start=""""([^"]|$)" end="(^|[^"])""""
color brightblue "def"
The big slowdown seems to be located in this part: (^|[^"]). Without it, things go much quicker.
|