On 5 September 2015, Tony Mechelynck <[email protected]> wrote:
> Let's say I want to define ,, (two commas) as a digraph for … (U+2026 
> HORIZONTAL ELLIPSIS). At the moment, in [g]vim 7.4.854 (with +multi_byte and 
> 'encoding' set to utf-8),
>         :dig ,, 8230
> does it, but 
>         :dig ,, 0x2026
> doesn't (AFAICT, it fails silently). The only way to use the hex value 
> explicitly is at the moment
>         :exec 'dig ,,' 0x2026
> which is ugly.
> Now the Unicode Consortium lists all codepoints by hex value, so the decimal 
> equivalent is losing currency. Even in HTML, where once upon a time &hellip; 
> or &#8230; would have been the only valid entities for that character, 
> &#x2026; is now a third valid alternative. So why not in Vim digraphs?
> 
> N.B. Of course, if (let's say) patch 875 fixes it, "cautious" scripts will at 
> first either still use the backward-compatible decimal number (or the 
> :execute workaround), or test
>         :if version > 704 || (version == 704 && has('patch875'))
> but it will be usable manually as soon as compiled-in.

    Please try the patch below.  It (hopefully) makes the :digraphs
command accept hex and octal values.

    /lcd


diff --git a/src/digraph.c b/src/digraph.c
--- a/src/digraph.c
+++ b/src/digraph.c
@@ -2196,7 +2196,8 @@
     char_u *str;
 {
     int                char1, char2, n;
-    int                i;
+    int                i, len;
+    long       val;
     digr_T     *dp;
 
     while (*str != NUL)
@@ -2222,7 +2223,9 @@
            EMSG(_(e_number_exp));
            return;
        }
-       n = getdigits(&str);
+       vim_str2nr(str, NULL, &len, TRUE, TRUE, &val, NULL, 0);
+       n = (int)val;
+       str += len;
 
        /* If the digraph already exists, replace the result. */
        dp = (digr_T *)user_digraphs.ga_data;

-- 
-- 
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/d/optout.

Raspunde prin e-mail lui