Re: VIM: search_refresh limits message count to 2 * window.height

Subject: Re: VIM: search_refresh limits message count to 2 * window.height

Date: Mon, 13 Oct 2014 10:43:24 +0200

To: notmuch@notmuchmail.org

Cc:

From: Franz Fellner


The issue is that VIM::Buffer.render yield's itself BEFORE it clears
itself.
Two quick solutions:

1) Simply manually fixup the mess in StagedRender::initialize after
@b.render {do_next } by adding
@last_render = @b.count

2) First clear the VIM:Buffer before yielding. This exposes one issue in
Vims buffer handling: A newly created buffer has count==0, But after
the first line got added you cannot get count==0 again, so a refresh
currently ends up with an empty line at the beginning.
It is possible to get the empty line at the end by implementing
VIM::Buffer.<<() as append(count()-1, arg)
Of course one has to add one line now directly after creating a new
buffer.

Solution 1) would be a simple oneliner but IMHO looks a little bit hacky
;)
Solution 2) at first looks ugly because of the empty line at the
end/beginning. But it also adds the opportunity to print additional
information, like description of the columns (date, thread participants,
subject, ...) at the beginning, or something like "end of search list",
"end of thread" at the end of the buffers.

Please tell me which one you like most and I can send a patch.


Regards
Franz

On Fri, 10 Oct 2014 17:56:23 +0200, Franz Fellner <alpine.art.de@gmail.com> wrote:
> The reason is that StagedRender.is_ready depends on last_render, which
> get's set to VIM::Buffer.count() in StagedRender::do_next.
> I do not (yet) know what exactly happens, but after the first call to
> search refresh last_render never get's less than 2*2*window.height.
> That means once you do search_refresh StagedRender never will be ready -
> is_ready returns false, so s:show_cursor_moved never will advance the
> StagedRender.
> 
> I am trying to understand the code, but it's a hard time for me ;)

Thread: