On 2009-10-18, David Kastrup wrote:
> 
> GNU LilyPond 2.13.4
> Processing `bad.ly'
> Parsing...
> bad.ly:4:16: error: syntax error, unexpected MUSIC_IDENTIFIER
>      MÃÃÃ A\342\231
>                 \257 Bâ \break
> error: failed files: "bad.ly"
> 
> Apparently, the error column is being tracked by counting characters,
> but is displayed by counting bytes.  The indicator appears too early
> because of that (which caused me to look for the wrong bug in an input
> file of mine).

This patch seems to correct the issue, but I don't know if it's the
correct fix (or if there are any side effects I'm unaware of).

I get this output:

  GNU LilyPond 2.13.6
  Processing `bad.ly'
  Parsing...
  bad.ly:4:16: error: syntax error, unexpected MUSIC_IDENTIFIER
       Määä A♯ B♭ 
                  \break
  error: failed files: "bad.ly"


If the patch looks okay, I'll add a commit summary for completeness.

Thanks,
Patrick
>From 3a0a66f7d6bc2f4791da6c3f6efeb499eed49465 Mon Sep 17 00:00:00 2001
From: Patrick McCarty <[email protected]>
Date: Thu, 22 Oct 2009 03:01:09 -0700
Subject: [PATCH] Fix error message output alignment for wide chars

---
 lily/source-file.cc |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/lily/source-file.cc b/lily/source-file.cc
index fc5b034..96264fb 100644
--- a/lily/source-file.cc
+++ b/lily/source-file.cc
@@ -308,7 +308,12 @@ Source_file::get_counts (char const *pos_str0,
       else
        (*column)++;
 
-      (*line_char)++;
+      /*
+       For accurate error output, consider multibyte
+       characters as a series of characters.
+      */
+      (*line_char) += thislen;
+
       /* Advance past this character. */
       line_chars += thislen;
       left -= thislen;
-- 
1.6.5.1

_______________________________________________
bug-lilypond mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-lilypond

Reply via email to