Re: [code] Adding multiple selection on double click

From: Mitchell <m.att.foicica.com>
Date: Fri, 14 Jul 2017 19:27:37 -0400 (EDT)

Hi Milind,

On Fri, 14 Jul 2017, Milind Gupta wrote:

> Another interesting observation is that if I put the line:
>
> *ui.dialogs.colorselect({title="Hello"})*
>
> just before the line buffer.first_visible_line=fl then it pops up the
> dialog but first_visible_line works now.
>
> Somehow without any ui interaction the buffer.first_visible_line=fl has no
> effect. I don't know if this is a bug.

Thanks for the additional information. Anytime you perform a batch set of operations that involve scrolling or altering the view, the view cannot exactly know what state it is in until there is a redraw. (The `ui.dialogs.colorselect()` call happened to trigger a redraw). What you should do is try to avoid altering the scroll position at all during your selection operation. For example, I noticed in your `findAllAtCursor()` function you call `buffer:set_sel(position, position)`. That will alter the scroll position if `position` is not currently in view. I think you mentioned `buffer:add_selection()` in a previous e-mail. That call does not scroll the view.

I hope this helps somewhat.

Cheers,
Mitchell

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Fri 14 Jul 2017 - 19:27:37 EDT

This archive was generated by hypermail 2.2.0 : Sat 15 Jul 2017 - 06:38:11 EDT