digraphs: ignore ansi commands in vim version output
authorMischa POSLAWSKY <perl@shiar.org>
Wed, 22 Mar 2017 23:18:48 +0000 (00:18 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Thu, 23 Mar 2017 02:25:58 +0000 (03:25 +0100)
Recent versions of Vim v7.4 prepend the expected version number by various
escapes (probably terminal-dependent), causing an unreadable result of:

\e[?1049h\e[?1h\e=\e[1;63r\e[?25h\e[?25h\e[?25l\e[63;1H704

Assume nothing is put after the wanted number, so capture only that.

tools/mkdigraphs-vim

index b9ab42668896fa77eea51b844da490e904282025..c1dcbe44e45ae09620f9a11262d587a700a33c6c 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
 #!/bin/sh
 
-VERSION=1.01
+VERSION=1.02
 
 if [ "$#" -ne 0 ]
 then
 
 if [ "$#" -ne 0 ]
 then
@@ -11,7 +11,7 @@ fi
 
 vim -e -c'echo version' -cdigraphs -cq | perl -CSD -nE '
        if ($. == 1) { # head
 
 vim -e -c'echo version' -cdigraphs -cq | perl -CSD -nE '
        if ($. == 1) { # head
-               say "# digraphs list from vim version ", s/\s*\z//r;
+               say "# digraphs list from vim version ", m/(\d+)\s*\z/;
                say "+{";
        } else { # body
                while (/\G(\S\S) (.[^ ]*) +([0-9]+)\s+/g) {
                say "+{";
        } else { # body
                while (/\G(\S\S) (.[^ ]*) +([0-9]+)\s+/g) {