[gtk-doc] fixxref: strip common indent when highlighting with vim



commit 263b2084530d9e79574274273e49a04102214bdb
Author: Dexter Chua <dalcde yahoo com hk>
Date:   Tue May 26 13:29:36 2015 +0100

    fixxref: strip common indent when highlighting with vim
    
    This is implemented for highlighting with highlight or source-highlight
    but not when highlighting with vim. The exact same change is copied to
    the HighlightSourceVim funcion
    
    https://bugzilla.gnome.org/show_bug.cgi?id=749901

 gtkdoc-fixxref.in |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/gtkdoc-fixxref.in b/gtkdoc-fixxref.in
index b033a79..a6256dd 100755
--- a/gtkdoc-fixxref.in
+++ b/gtkdoc-fixxref.in
@@ -450,8 +450,11 @@ sub HighlightSourceVim {
     my ($type, $source) = @_;
 
     # chop of leading and trailing empty lines
-    $source =~ s/^[\s\n]+//gs;
+    $source =~ s/^\s*\n+//gs;
     $source =~ s/[\s\n]+$//gs;
+    # cut common indent
+    $source =~ m/^(\s*)/;
+    $source =~ s/^$1//gms;
     # avoid double entity replacement
     $source =~ s/&lt;/</g;
     $source =~ s/&gt;/>/g;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]