[prev in list] [next in list] [prev in thread] [next in thread] 

List:       vim
Subject:    Re: using utf8 characters in showbreak illegal?
From:       Bram Moolenaar <Bram () moolenaar ! net>
Date:       2002-12-29 20:37:33
[Download RAW message or body]


Richard P. Groenewegen wrote:

> I always had
> 
>     set showbreak=···
> 
> in my .vimrc.  (The character you get from the digraph .M).  I was
> trying out vim with utf-8 and I converted my .vimrc with iconv to
> utf-8.  The comment above displays correctly and the dot has hex value
> 00b7 (output of g8 is c2 b7).
> 
> When I start vim, I get
> 
>     Error detected while processing /home/rpg/.vimrc:
>     line   78:
>     contains unprintable character: showbreak=···
> 
> Is this correct behavior?  Of course, there are worse things in life,
> but I was always very fond of my showbreak characters.

This was correct, although you obviously would like to use multi-byte
characters for 'showbreak'.  That should be possible, try this patch:

*** ../vim61.267/src/charset.c	Sun Oct 13 20:08:13 2002
--- src/charset.c	Sun Dec 29 20:33:57 2002
***************
*** 1079,1085 ****
  	}
  	if (col == 0 || col + size > (colnr_T)W_WIDTH(wp))
  	{
! 	    added = (int)STRLEN(p_sbr);
  	    if (tab_corr)
  		size += (added / wp->w_buffer->b_p_ts) * wp->w_buffer->b_p_ts;
  	    else
--- 1079,1085 ----
  	}
  	if (col == 0 || col + size > (colnr_T)W_WIDTH(wp))
  	{
! 	    added = vim_strsize(p_sbr);
  	    if (tab_corr)
  		size += (added / wp->w_buffer->b_p_ts) * wp->w_buffer->b_p_ts;
  	    else
*** ../vim61.267/src/move.c	Thu Jul  4 20:45:15 2002
--- src/move.c	Sun Dec 29 20:33:33 2002
***************
*** 1007,1013 ****
  	     * mode, the 'showbreak' string isn't shown, backup to first
  	     * column */
  	    if (*p_sbr && *ml_get_cursor() == NUL
! 		    && curwin->w_wcol == (int)STRLEN(p_sbr))
  		curwin->w_wcol = 0;
  #endif
  	}
--- 1007,1013 ----
  	     * mode, the 'showbreak' string isn't shown, backup to first
  	     * column */
  	    if (*p_sbr && *ml_get_cursor() == NUL
! 		    && curwin->w_wcol == (int)vim_strsize(p_sbr))
  		curwin->w_wcol = 0;
  #endif
  	}
*** ../vim61.267/src/option.c	Sun Nov 10 13:33:34 2002
--- src/option.c	Sun Dec 29 20:29:30 2002
***************
*** 4795,4803 ****
      /* 'showbreak' */
      else if (varp == &p_sbr)
      {
! 	for (s = p_sbr; *s; ++s)
! 	    if (byte2cells(*s) != 1)
  		errmsg = (char_u *)N_("contains unprintable character");
      }
  #endif
  
--- 4797,4813 ----
      /* 'showbreak' */
      else if (varp == &p_sbr)
      {
! 	for (s = p_sbr; *s; )
! 	{
! 	    if (ptr2cells(s) != 1)
  		errmsg = (char_u *)N_("contains unprintable character");
+ # ifdef FEAT_MBYTE
+ 	    if (has_mbyte)
+ 		s += (*mb_ptr2len_check)(s);
+ 	    else
+ # endif
+ 		++s;
+ 	}
      }
  #endif
  

-- 
hundred-and-one symptoms of being an internet addict:
203. You're an active member of more than 20 newsgroups.

 ///  Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net  \\\
///          Creator of Vim - Vi IMproved -- http://www.vim.org          \\\
\\\           Project leader for A-A-P -- http://www.a-a-p.org           ///
 \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic