On Saturday, July 6, 2013 1:35:26 PM UTC+2, Bram Moolenaar wrote:
> Christian Wellenbrock wrote:
> 
> 
> 
> > In order to test the changes I made, I started out with a patch that
> 
> > helped me to find and verify 'statusline' options that show the nine
> 
> > different uses of the 'fillchar'. In `1_replace_fillchars.patch` I
> 
> > replaced them all with the different hardcoded placeholder characters
> 
> > 'a' to 'i'. Here are nine vim invocations for each of them:
> 
> > (I'm using ○ (digraph 0m) as multibyte fillchar in all invocations and
> 
> > 〇 (digraph 0_) als a double-width character)
> 
> > 
> 
> > [a] vim -u NONE -c "set ls=2 fcs=stl:○ stl=S%2.2(X〇%)E"
> 
> > [b] vim -u NONE -c "set ls=2 fcs=stl:○ stl=S%-1(%)E"
> 
> > [c] vim -u NONE -c "set ls=2 fcs=stl:○ stl=S%1(%)E"
> 
> > [d] vim -u NONE -c "set ls=2 fcs=stl:○ stl=S%4PE"
> 
> > [e] vim -u NONE -c "set ls=2 fcs=stl:○ stl=S%{'A\ B'}E"
> 
> > [f] vim -u NONE -c "set ls=2 fcs=stl:○ stl=S%-4PE"
> 
> > [g] vim -u NONE -c "set ls=2 fcs=stl:○ stl=S234567890〇%<1"
> 
> > [h] vim -u NONE -c "set ls=2 fcs=stl:○ stl=S〇123456789E"
> 
> > [i] vim -u NONE -c "set ls=2 fcs=stl:○ stl=S%=E"
> 
> > 
> 
> > The binary resulting from patch 1 shows these statuslines respectively:
> 
> > (in a terminal that is exactly 12 characters wide)
> 
> > 
> 
> > [a] S<aE○○○○○○○○
> 
> > [b] SbE○○○○○○○○○
> 
> > [c] ScE○○○○○○○○○
> 
> > [d] SdAllE○○○○○○
> 
> > [e] SAeBE○○○○○○○
> 
> > [f] SAllfE○○○○○○
> 
> > [g] S234567890>
> 
> > [h] <123456789Eh
> 
> > [i] SiiiiiiiiiiE
> 
> > 
> 
> > Note that (almost) every statusline contains the corresponding
> 
> > hardcoded 'fillchar' placeholder. Except the 'g' is missing for
> 
> > invocation [g]. I believe the reason for that is a bug that I fixed in
> 
> > `2_fix_fillchar_g.patch`. The new binary shows the expected result:
> 
> > 
> 
> > [a] S<aE○○○○○○○○
> 
> > [b] SbE○○○○○○○○○
> 
> > [c] ScE○○○○○○○○○
> 
> > [d] SdAllE○○○○○○
> 
> > [e] SAeBE○○○○○○○
> 
> > [f] SAllfE○○○○○○
> 
> > [g] S234567890g>
> 
> > [h] <123456789Eh
> 
> > [i] SiiiiiiiiiiE
> 
> > 
> 
> > Now in `3_use_multibyte.patch` I finally added support for multibyte
> 
> > support for all these fillchars:
> 
> > 
> 
> > [a] S<○E○○○○○○○○
> 
> > [b] S○E○○○○○○○○○
> 
> > [c] S○E○○○○○○○○○
> 
> > [d] S○AllE○○○○○○
> 
> > [e] SA○BE○○○○○○○
> 
> > [f] SAll○E○○○○○○
> 
> > [g] S234567890○>
> 
> > [h] <123456789E○
> 
> > [i] S○○○○○○○○○○E
> 
> > 
> 
> > Every former fillchar placeholder is now replaced by the real
> 
> > multibyte fillchar.
> 
> > 
> 
> > Bonus: As I recognized a pattern that repeated itself several times, I
> 
> > extracted a macro `MB_CHAR2BYTES` to simplify matters in
> 
> > `4_add_macro.patch`. I'm not sure about this name regarding the
> 
> > advancing side effect, though. This could obviously be renamed.
> 
> > Another possibility would be to remove the side effect and add `b +=
> 
> > MB_CHAR2LEN(fillchar);` on the caller sites.
> 
> > 
> 
> > I'm also not quite sure if the case [h] is fully tested by my
> 
> > invocation. There is some code moving the subsequent items in memory,
> 
> > but I wasn't able to find a 'statusline', where the fillchar was
> 
> > somewhere in the middle of the statusline. So I didn't really
> 
> > understand the intention of that logic and I might broke that part. If
> 
> > someone knows a 'statusline' option where my implementation breaks
> 
> > expected behaviour, I would be happy to fix it.
> 
> > 
> 
> > If there are any other issues, please let me know. Thank you!
> 
> 
> 
> Thanks.  I added the patch to the todo list.
> 
> 
> 
> Note that instead of testing this manually, it should be possible to use
> 
> screenchar() and write an automated test with that.  Would be very
> 
> useful, as most of the statusline stuff is untested.
> 
> 
> 
> 
> 
> -- 
> 
> ARTHUR:  No, hang on!  Just answer the five questions ...
> 
> GALAHAD: Three questions ...
> 
> ARTHUR:  Three questions ...  And we shall watch ... and pray.
> 
>                  "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
> 
> 
> 
>  /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
> 
> ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
> 
> \\\  an exciting new programming language -- http://www.Zimbu.org        ///
> 
>  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

I'v been using this patch for some months now and I'm starting to get merge 
conflicts while migrating it on top of recent upstream patches.

I've written some tests, but I wasn't able to integrate it into the test suite, 
because every time I wanted to split windows the `dotest` function seemed to be 
triggered again. (I need splits to get the correct status line width of 12 
characters.)

The attached test `statusline.in` creates a windows layout and sets each of my 
previously described test values for the 'statusline' option. Each time the 
complete statusline is written to the `statusline.out` file. I invoked the test 
like this:

    vim -u NONE -S statusline.in

For the current Vim version this file looks like this (file `statusline.out`):

    S<-E○○○○○○○○
    S-E○○○○○○○○○
    S-E○○○○○○○○○
    S-BotE○○○○○○
    SABE○○○○○○○○
    SBot-E○○○○○○
    S234567890>○
    <123456789E-
    S----------E

For my local version with the statusline patches it looks like this (file 
`statusline.ok`):

    S<○E○○○○○○○○
    S○E○○○○○○○○○
    S○E○○○○○○○○○
    S○BotE○○○○○○
    SABE○○○○○○○○
    SBot○E○○○○○○
    S234567890○>
    <123456789E○
    S○○○○○○○○○○E

Could this be added to the test suite so we can get the multibyte fillchars 
statusline upstream?

Thank you!

-- 
-- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Attachment: statusline.in
Description: Binary data

Attachment: statusline.ok
Description: Binary data

Attachment: statusline.out
Description: Binary data

Raspunde prin e-mail lui