On Wed, Feb 6, 2013 at 2:58 AM, Ben Fritz <fritzophre...@gmail.com> wrote:
> For example:
>
> :set number
> :set relativenumber
> :set linenumber=number
> :set number? relativenumber? linenumber?
>     number norelativenumber linenumber=number

Yes, this is what the patch does. See the set_line_number_style() in
the patch. This is also how the test is done in test90.in, although I
would like to have another test that actually grabs vim's screen dump
and compare it with a known, correct text so that we can catch screen
drawing errors too ... maybe in another patch.

On Wed, Feb 6, 2013 at 12:22 AM, Lech Lorens <lech.lor...@gmail.com> wrote:
> I can imagine that handling 'nu', 'rnu' and 'linenumber' with their
> priorities in code is a huge PITA and a great possibility of
> introducing bugs like the one you just fixed.

:) That PITA were present back when the useful 'rnu' were added:

$ grep 'w_p_nu.*w_p_rnu' src/*.c
src/edit.c: if (curwin->w_p_nu || curwin->w_p_rnu)
src/move.c:    return (((wp->w_p_nu || wp->w_p_rnu) ? number_width(wp) + 1 : 0)
src/move.c:    if ((wp->w_p_nu || wp->w_p_rnu) && vim_strchr(p_cpo,
CPO_NUMCOL) != NULL)
src/netbeans.c:                           - ((curwin->w_p_nu ||
curwin->w_p_rnu) ? 9 : 1);
src/screen.c:           && curwin->w_nrwidth != ((curwin->w_p_nu ||
curwin->w_p_rnu)
src/screen.c:    i = (wp->w_p_nu || wp->w_p_rnu) ? number_width(wp) : 0;
src/screen.c:    if (wp->w_p_nu || wp->w_p_rnu)
src/screen.c:               if ((wp->w_p_nu || wp->w_p_rnu)

The 'linenumber' patch adds a "hidden" window option (w_p_lnrsty) that
is controlled by the three "visible" window options 'number' (w_p_nu),
'relativenumber' (w_p_rnu) and 'linenumber' (w_p_lnr).

In the patch I've modified the code to use w_p_lnr in places where the
original w_p_nu/w_p_rnu options were directly affecting how the line
numbers are drawn, and ignoring the other places where they are used
in order to keep the patch size small and reduce the "affected area".

Here's the same grep output after the patch is applied:

$ grep  'w_p_nu.*w_p_rnu' src/*.c
src/move.c:    return (((wp->w_p_nu || wp->w_p_rnu) ? number_width(wp) + 1 : 0)
src/move.c:    if ((wp->w_p_nu || wp->w_p_rnu) && vim_strchr(p_cpo,
CPO_NUMCOL) != NULL)
src/netbeans.c:                          - ((curwin->w_p_nu ||
curwin->w_p_rnu) ? 9 : 1);
src/option.c:      if (! curwin->w_p_nu && ! curwin->w_p_rnu)

If bram accepts the proposed patch then changing the rest of the
references to w_p_nu and w_p_rnu to use only w_p_lnrsty is trivial.

What makes me a bit uncomfortable is that there's so much code being
added just for styling how a single line number is shown when 'rnu' is
set, YAO and all :) Since this is something at affect stuff that people
see all day - we're talking programmers here and we know what line numbers
mean to us, some stare at it all day long - so it must be worth it yeah?

Nazri

-- 
-- 
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/groups/opt_out.


Raspunde prin e-mail lui