unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* VIM: search_refresh limits message count to 2 * window.height
@ 2014-10-10 15:56 Franz Fellner
  2014-10-13  8:43 ` Franz Fellner
  0 siblings, 1 reply; 2+ messages in thread
From: Franz Fellner @ 2014-10-10 15:56 UTC (permalink / raw)
  To: notmuch

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 ;)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: VIM: search_refresh limits message count to 2 * window.height
  2014-10-10 15:56 VIM: search_refresh limits message count to 2 * window.height Franz Fellner
@ 2014-10-13  8:43 ` Franz Fellner
  0 siblings, 0 replies; 2+ messages in thread
From: Franz Fellner @ 2014-10-13  8:43 UTC (permalink / raw)
  To: notmuch

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 ;)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-10-13  8:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-10 15:56 VIM: search_refresh limits message count to 2 * window.height Franz Fellner
2014-10-13  8:43 ` Franz Fellner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).