From: David Kastrup Date: Thu, 13 Dec 2012 10:53:02 +0000 (+0100) Subject: Issue 2172: Get line and column numbers right. X-Git-Tag: release/2.17.10-1~54 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=314587c0714437b058c04173d81ad79db7452e73;p=lilypond.git Issue 2172: Get line and column numbers right. This uses 1-based columns on all error output, as is the standard for GNU programs. It also flags version errors as being for line 1 instead of line 0 since the latter confuses Emacs' compilation mode. The same column convention is used for point-and-click column numbers in textedit:// URIs. In contrast, the byte offsets into a line (also in those URIs) are retained 0-based. For point-and-click, this yields the correct results when using the definitions for emacs and gvim in scm/editor.scm, the editors configured to interpret the column number. It is to be expected that Lilypond-specific shells (like Frescobaldi called via Okular for point-and-click) have specialized on the previous wrong behavior and will now exhibit the kind of one-off behavior that non-LilyPond specific programs did previously when encountering the error messages. I don't see a good migration strategy for those except possibly looking for the version number of LilyPond and deciding whether to do one-off calculations depending on that. --- diff --git a/Documentation/changes.tely b/Documentation/changes.tely index f0d11f45e8..630dad3bcb 100644 --- a/Documentation/changes.tely +++ b/Documentation/changes.tely @@ -61,6 +61,13 @@ which scares away people. @end ignore +@item +Starting with version@tie{}2.17.10, error messages or the +@code{textedit} @acronym{URI} used for point-and-click +functionality specify column numbers starting with@tie{}1 rather +than@tie{}0. The byte offset (also part of @code{textedit} +@acronym{URI}s) still starts at@tie{}0. + @item The @code{\clef} command supports optional octavation: @lilypond[verbatim,quote,relative=1] diff --git a/lily/source-file.cc b/lily/source-file.cc index d847605425..6ecedc9854 100644 --- a/lily/source-file.cc +++ b/lily/source-file.cc @@ -182,7 +182,7 @@ Source_file::file_line_column_string (char const *context_str0) const get_counts (context_str0, &l, &ch, &col, &offset); return name_string () + ":" + to_string (l) - + ":" + to_string (col); + + ":" + to_string (col + 1); } } diff --git a/scm/lily-library.scm b/scm/lily-library.scm index d21e292ccf..da04e6c896 100644 --- a/scm/lily-library.scm +++ b/scm/lily-library.scm @@ -997,11 +997,11 @@ print a warning and set an optional @var{default}." (define-public (version-not-seen-message input-file-name) (ly:warning-located - (ly:format "~a:0" input-file-name) + (ly:format "~a:1" input-file-name) (_ "no \\version statement found, please add~afor future compatibility") (format #f "\n\n\\version ~s\n\n" (lilypond-version)))) (define-public (old-relative-not-used-message input-file-name) (ly:warning-located - (ly:format "~a:0" input-file-name) + (ly:format "~a:1" input-file-name) (_ "old relative compatibility not used"))) diff --git a/scm/output-ps.scm b/scm/output-ps.scm index 497f197aeb..dd92175feb 100644 --- a/scm/output-ps.scm +++ b/scm/output-ps.scm @@ -177,7 +177,7 @@ (cadr location) (caddr location) - (cadddr location)) + (1+ (cadddr location))) "")) "")) ""))