Things have morphed over time and display_buffer() no longer actually
displays the buffer -- it just displays the title bar, precalculates
the multiline color info, and schedules a refresh of the edit window.
If the length of the haystack is smaller than the length of the needle,
this means that also the length of the tail will be smaller -- because
pointer will be bigger than or equal to haystack -- so the pointer gets
readjusted to be a needle length before the end of the haystack, which
means that it ends up /before/ the haystack: thus the while loop will
never run.
On average, this saves some 200 nanoseconds per line.
This avoids https://savannah.gnu.org/bugs/?49912 while at the same time
avoiding to draw the edit window twice in a row -- the first drawing
would use a wrong margin, which results in a visible and irritating
shift left or right of the content upon the second drawing.
This fixes https://savannah.gnu.org/bugs/?50877.
We should measure the length of each /translated/ shortcut description,
not of the original English one.
This fixes https://savannah.gnu.org/bugs/?50899.
An iterator should not be called "start_col", because it is only the
starting column at the very beginning.
Also, start_col (after the rename) can never be /larger/ than column.
Since the help text is searchable, an <End> would go to the end of the
text but would leave a blank line above the statusbar -- a blank line
that wasn't there before, and that is not reached when simply holding
down <Down> all the way from the top.
When nano has multiple files open, closing a help buffer should
not switch to the next buffer in the ring but to the preceding one,
because it was from there that the help screen was invoked.
However, prefer moving the starting point of the text backwards over
moving it forward, so that of the same paragraph more text is shown
instead of less. But scroll an empty line out of view -- no text is
"lost" then.
Allow the user to search in a help text with ^W and M-W.
Achieve this by not writing the help text directly to the screen
but first writing it to a temporary file and then opening this file
in a new buffer, and treating it specially: the normal file-reading
feedback is suppressed, the titlebar shows the headline of the text,
the cursor is hidden, and the menu is limited to just the up and down
movements and searching.
This fulfills https://savannah.gnu.org/bugs/?28994.
Signed-off-by: Rishabh Dave <rishabhddave@gmail.com>
Call something a buffer when it refers to a linked list of linestructs,
and call something a linestruct when it is a struct that describes a
single line.
File formats, appending and prepending, and backups are not available
when --enable-tiny is used, so prevent all relevant pieces of code from
getting compiled. And correct two misspelled ENABLE_TINY to NANO_TINY.