Re: New patch to set cursor shape in Cygwin

2011-12-27 Fir de Conversatie Ben
On Dec 26, 9:47 pm, Tony Mechelynck 
wrote:
> On 26/12/11 19:22, Ben wrote:
>
> > On Dec 26, 1:16 am, Tony Mechelynck
> > wrote:
> >> On 26/12/11 06:37, Ben wrote:
>
> >>> Hi vim_dev,
>
> >>> I always liked the feature in win32 console vim where the cursor
> >>> changed shape depending on what mode you're in. I recently switched to
> >>> using cygwin console vim on my Windows systems instead of win32
> >>> console for various reasons (primarily because it understands cygwin
> >>> paths), and was disappointed to find the cursor shape-change feature
> >>> was not working, even though my version of cygwin vim was compiled
> >>> with +cursorshape. I had some time on my hands, so I went into the
> >>> source and figured out how to get it to work. Here's the patch:
>
> >>> diff -r a96cb758a8d7 runtime/doc/options.txt
> >>> --- a/runtime/doc/options.txt      Fri Dec 23 14:56:28 2011 +0100
> >>> +++ b/runtime/doc/options.txt      Mon Dec 26 00:11:47 2011 -0500
> >>> @@ -3334,17 +3334,17 @@
> >>>                                     r-cr:hor20-Cursor/lCursor,
> >>>                                     sm:block-Cursor
> >>>                                     -blinkwait175-blinkoff150-blinkon175",
> >>> -                          for MS-DOS and Win32 console:
> >>> +                          for MS-DOS, Win32, and Cygwin console:
> >>>                                     "n-v-c:block,o:hor50,i-ci:hor15,
> >>>                                     r-cr:hor30,sm:block")
> >>>                     global
> >>>                     {not in Vi}
> >>>                     {only available when compiled with GUI enabled, and
> >>> -                  for MS-DOS and Win32 console}
> >>> +                  for MS-DOS, Win32, and Cygwin console}
> >>>     This option tells Vim what the cursor should look like in different
> >>> -  modes.  It fully works in the GUI.  In an MSDOS or Win32 console,
> >>> only
> >>> -  the height of the cursor can be changed.  This can be done by
> >>> -  specifying a block cursor, or a percentage for a vertical or
> >>> +  modes.  It fully works in the GUI.  In an MSDOS, Win32, and Cygwin
> >>> +  console, only the height of the cursor can be changed.  This can be
> >>> +  done by specifying a block cursor, or a percentage for a vertical or
> >>>     horizontal cursor.
> >>>     For a console the 't_SI' and 't_EI' escape sequences are used.
>
> >>> diff -r a96cb758a8d7 src/feature.h
> >>> --- a/src/feature.h        Fri Dec 23 14:56:28 2011 +0100
> >>> +++ b/src/feature.h        Mon Dec 26 00:11:47 2011 -0500
> >>> @@ -1156,8 +1156,8 @@
> >>>     * mouse shape           Adjust the shape of the mouse pointer to the 
> >>> mode.
> >>>     */
> >>>    #ifdef FEAT_NORMAL
> >>> -/* MS-DOS console and Win32 console can change cursor shape */
> >>> -# if defined(MSDOS) || (defined(WIN3264)&&    !defined(FEAT_GUI_W32))
> >>> +/* MS-DOS console, Win32 console, and Cygwin console can change
> >>> cursor shape */
> >>> +# if defined(MSDOS) || (defined(WIN3264)&&    !defined(FEAT_GUI_W32))
> >>> || defined(__CYGWIN__)
> >>>    #  define MCH_CURSOR_SHAPE
> >>>    # endif
> >>>    # if defined(FEAT_GUI_W32) || defined(FEAT_GUI_W16) ||
> >>> defined(FEAT_GUI_MOTIF) \
> >>> diff -r a96cb758a8d7 src/os_unix.c
> >>> --- a/src/os_unix.c        Fri Dec 23 14:56:28 2011 +0100
> >>> +++ b/src/os_unix.c        Mon Dec 26 00:11:47 2011 -0500
> >>> @@ -31,6 +31,11 @@
>
> >>>    #include "vim.h"
>
> >>> +#if defined(__CYGWIN__)
> >>> +#include
> >>> +static HANDLE g_hConOut = INVALID_HANDLE_VALUE;
> >>> +#endif
> >>> +
> >>>    #ifdef FEAT_MZSCHEME
> >>>    # include "if_mzsch.h"
> >>>    #endif
> >>> @@ -1222,6 +1227,10 @@
> >>>    #ifdef MACOS_CONVERT
> >>>        mac_conv_init();
> >>>    #endif
> >>> +
> >>> +#if defined(__CYGWIN__)
> >>> +    g_hConOut = GetStdHandle(STD_OUTPUT_HANDLE);
> >>> +#endif
> >>>    }
>
> >>>        static void
> >>> @@ -7196,3 +7205,41 @@
>
> >>>    #endif
> >>> +
> >>> +#if defined(__CYGWIN__)
> >>> +
> >>> +#if defined(MCH_CURSOR_SHAPE)
> >>> +/*
> >>> + * Set the shape of the cursor.
> >>> + * 'thickness' can be from 1 (thin) to 99 (block)
> >>> + */
> >>> +    static void
> >>> +mch_set_cursor_shape(int thickness)
> >>> +{
> >>> +    CONSOLE_CURSOR_INFO ConsoleCursorInfo;
> >>> +    ConsoleCursorInfo.dwSize = thickness;
> >>> +    ConsoleCursorInfo.bVisible = TRUE;
> >>> +
> >>> +    SetConsoleCursorInfo(g_hConOut,&ConsoleCursorInfo);
> >>> +}
> >>> +
> >>> +    void
> >>> +mch_update_cursor(void)
> >>> +{
> >>> +    int           idx;
> >>> +    int           thickness;
> >>> +
> >>> +    /*
> >>> +     * How the cursor is drawn depends on the current mode.
> >>> +     */
> >>> +    idx = get_shape_idx(FALSE);
> >>> +
> >>> +    if (shape_table[idx].shape == SHAPE_BLOCK)
> >>> +  thickness = 99; /* 100 doesn't work on W95 */
> >>> +    else
> >>> +  thickness = shape_table[idx].percentage;
> >>> +    mch_set_cursor_shape(thickness);
> >>> +}
> >>> +#endif
> >>> +
> >>> +#endif
>
> >>> Some pos

Re: cpo-=l full list

2011-12-27 Fir de Conversatie Charles E Campbell Jr

Thilo Six wrote:

Taylor Hedberg wrote the following on 25.12.2011 05:20

Hello Charles,

   

Charles E Campbell Jr, Sat 2011-12-24 @ 22:11:31-0500:
 

If I may repeat myself, what advantage does
   set cpo-=a cpo-=A
have over
   set cpo-=aA
???
   

 From `:help :set-=`:

When the option is a list of flags, {value} must be
exactly as they appear in the option.  Remove flags
one by one to avoid problems.

Removing the flags individually is guaranteed to work regardless of the
order and position in which the flags appear in the option string. This
is not true if you remove them in combination.
 

Thank you Taylor that i exactly what i thought of.

Charles here is a example:
:set cpo?
cpoptions=aABceFs
:set cpo-=aA
cpoptions=BceFs

so far so good. Now lets have a crazy user shuffling things around:
:set cpo?
cpoptions=ABFaces   " pretty much default, just different order
:set cpo-=aA
:set cpo?
cpoptions=ABFaces
:set cpo-=a
:set cpo-=A
:set cpo?
cpoptions=BFces
   

OK, I'll include the change.

Thank you,
Chip Campbell

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


HTML email (Was: Re: line2byte() returns wrong result at multi-byte characters)

2011-12-27 Fir de Conversatie Christian J. Robinson

On Tue, 27 Dec 2011, Дмитрий Франк wrote:

[HTML email snipped.]

Please do not send HTML email to the Vim lists, it is against list 
policy: http://www.vim.org/maillist.php - "Do not send messages in 
HTML. You will be flamed! Every decent mail program has an option to 
switch off HTML."


- Christian

--
   "Sometimes I lie awake at night, and I ask, 'Where have I gone wrong?'
   Then a voice says to me, 'This is going to take more than one night.'"
-- Charles M. Schulz
Christian J. Robinson   http://christianrobinson.name/

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


Re: line2byte() returns wrong result at multi-byte characters

2011-12-27 Fir de Conversatie Дмитрий Франк
27 декабря 2011 г. 21:16 пользователь Ben Fritz
написал:

>
>
> On Dec 21, 3:09 pm, Дмитрий Франк  wrote:
> > > Why is it that you cannot set Vim's encoding to utf-8? Standard
> > > encoding for Vim on my system is latin1 but setting it in Vim to utf-8
> > > doesn't cause any ill effects.
> >
> > I have some other problems with it before, but i have to use standard
> > Windows &encoding 'cp1251', because of if i set my &encoding to 'utf-8',
> > then all messages from Vim becomes garbage. And all shell messages too,
> of
> > course. Here's an screenshot with example, if i have &encoding ==
> 'utf-8' :
> > http://goo.gl/h6sk2
> >
> > There's same other problems, i can't remember now. But if i found some
> > workaround with garbage in messages with &encoding == 'utf-8', i'll be
> glad.
> >
>
> Yeah, that's not supposed to happen! When do you set your encoding? It
> should be pretty much the first thing in your .vimrc for it to work
> properly.
>
>
This is the first thing in my .vimrc, yes. And, btw, if &encoding == utf-8,
persistent undo does not work. With cp1251 works nice.


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


Re: line2byte() returns wrong result at multi-byte characters

2011-12-27 Fir de Conversatie Ben Fritz


On Dec 21, 3:09 pm, Дмитрий Франк  wrote:
> > Why is it that you cannot set Vim's encoding to utf-8? Standard
> > encoding for Vim on my system is latin1 but setting it in Vim to utf-8
> > doesn't cause any ill effects.
>
> I have some other problems with it before, but i have to use standard
> Windows &encoding 'cp1251', because of if i set my &encoding to 'utf-8',
> then all messages from Vim becomes garbage. And all shell messages too, of
> course. Here's an screenshot with example, if i have &encoding == 'utf-8' :
> http://goo.gl/h6sk2
>
> There's same other problems, i can't remember now. But if i found some
> workaround with garbage in messages with &encoding == 'utf-8', i'll be glad.
>

Yeah, that's not supposed to happen! When do you set your encoding? It
should be pretty much the first thing in your .vimrc for it to work
properly.

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


Re: VIM QT fails to compile on Ubuntu 11.04

2011-12-27 Fir de Conversatie Christian Brabandt
Hi Tony!

On Mo, 26 Dez 2011, Tony Mechelynck wrote:

> On 26/12/11 10:09, Konstantin Zertsekel wrote:
> >Oh, thanks a bunch for the answer.
> >But I rather look for VIM with some GUI.
> >I am looking for the best recipe to browse and learn Linux Kernel.
> >Currently I am using VIM with cscope and trinity, which is _very_
> >efficient combination,
> >but the lack of GUI is certainly a big downside.
> >As for now, I think KDevelop is the best in all aspects except the memory...
> >Still keep testing them.
> >
> >Thanks,
> >--- Kosta
> 
> Well, why not use a GTK2/Gnome2 Vim GUI? I use that on openSUSE
> Linux, and it compiles like a breeze. I'm sure the needed
> development packages exist on your Ubuntu distro just like they
> exist on my openSUSE. I've seen Ubuntu/Debian users post a oneline
> apt-get build-dep command meant to install all packages needed to
> compile gvim with GTK2/Gnome2 on their systems, only I haven't
> remembered it since SuSE uses a different package management system
> (the YaST GUI/cursesUI or the zypper CLI).

http://vimhelp.appspot.com/vim_faq.txt.html#faq-35.10

regards,
Christian
-- 
Schlage nie jemanden mit einer Brille.
Nimm lieber einen Knüppel.

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