Re: [vim/vim] getjumplist() is not as useful as it should (#4145)

2019-03-21 Fir de Conversatie Yegappan Lakshmanan
Hi,

On Thu, Mar 21, 2019 at 1:35 PM Romain Lafourcade
 wrote:
>
> getjumplist() was added in #2609. It purports to allow people to get a
> usable representation of the jumplist but it fails to do so.
>
> First, getjumplist()[0] is inverted compared to :jumps, with jump 0
> being at [-1] and so on. Yes we can reverse() it to get the expected
> representation but that shouldn't be necessary.
>
> Second, the items in getjumplist()[0] don't contain the most important
> information: the jump number. Without that information, "getting the
> jump list", is debatably useful because we don't get any actual "jump"
> in the returned list.
>

The attached patch adds a jump number to each entry in the
list returned by getjumplist().

- Yegappan

> Third, the index of those items can't be used to infer actual jump
> numbers because jump #0 can be anywhere in the list and have relative
> numbers above and below.
>
> Fourth, getjumplist()[1] is the last position reachable with  but
> the newest position reachable with  is not there.
>

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


jumpnr.diff
Description: Binary data


Re: [vim/vim] getjumplist() is not as useful as it should (#4145)

2019-03-21 Fir de Conversatie Yegappan Lakshmanan
Hi,

On Thu, Mar 21, 2019 at 1:35 PM Romain Lafourcade
 wrote:
>
> getjumplist() was added in #2609. It purports to allow people to get a
> usable representation of the jumplist but it fails to do so.
>
> First, getjumplist()[0] is inverted compared to :jumps, with jump 0
> being at [-1] and so on. Yes we can reverse() it to get the expected
> representation but that shouldn't be necessary.
>

The getjumplist() function returns the list of entries in the order in which
the ":jumps" command lists them. So the first entry in the returned list
may be the entry with the highest jump number as displayed by the
":jumps" command. Note that if you use  or  to traverse
the jump list, the jump list number for each entry will change and the
last entry may not be the one with the first jump list number.

>
> Second, the items in getjumplist()[0] don't contain the most important
> information: the jump number. Without that information, "getting the
> jump list", is debatably useful because we don't get any actual "jump"
> in the returned list.
>

The jump number for each entry can be derived from the second number
returned by getjumplist(). The ":jumps" command uses the following to
derive the jump number:

   i > curwin->w_jumplistidx ? i - curwin->w_jumplistidx
: curwin->w_jumplistidx - i,

where i is the index of the jump list entry.

>
> Third, the index of those items can't be used to infer actual jump
> numbers because jump #0 can be anywhere in the list and have relative
> numbers above and below.
>
> Fourth, getjumplist()[1] is the last position reachable with  but
> the newest position reachable with  is not there.
>

To find the position reachable with  you can add 1 to the number
returned by getjumplist() (second item in the list).

- Yegappan

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.