lilypond-user
[Top][All Lists]
Advanced

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

Re: Getting point-and-click working


From: Aaron Hill
Subject: Re: Getting point-and-click working
Date: Sun, 10 Feb 2019 05:15:57 -0800
User-agent: Roundcube Webmail/1.3.8

On 2019-02-10 1:14 am, Andrew Bernard wrote:
Didn't this come up in 2015 on the list here:

https://lists.gnu.org/archive/html/lilypond-user/2015-06/msg00168.html

That's an interesting thread. It turns up an alternate script [1] for handling the textedit: URI scheme, however curiously the script incorrectly interprets [2] the parameters of a link. The proper format is "file:line:char:column" not "file:line:start:end".

[1]: https://github.com/markk/textedit-ly
[2]: https://github.com/markk/textedit-ly/blob/master/textedit.py#L29-L32

This scheme stems from ly:input-file-line-char-column (backed by Source_file::get_counts internally) which returns the zero-based character index and the one-based column number. Of note, columns are computed assuming eight-wide tabulation.

It seems the script author was not aware of this scheme and assumed there was an off-by-one error, as they mention their solution "places the cursor at the character number in the url, rather than one character to the left".

Providing you do not use tab characters in your input files, you would see that 'column' will always be one more than 'char'. It could be misinterpreted that this is a character range, rather than two different values. As such, if you try to use 'char' as a column number rather than a character index, you will see a problem with editors that assume a one-based value.

The script in particular applies their fix when using vim, which is an editor that expects a one-based column number. But adding one to 'char' (which is called 'start' in the script) is invalid if there are tab characters on the line, as you will still end up at a column left of where you would expect the cursor to be.

The solution is to ignore the 'char' value completely and only use 'column' to launch vim with a command similar to the following:

    vim --remote '+:norm%(line)sG%(column)s|' %(file)s

(This is using the same Python-style substitution arguments expected in the LYEDITOR variable.)

-- Aaron Hill



reply via email to

[Prev in Thread] Current Thread [Next in Thread]