The problem is: according to the URI specification, there is no way to
denote the line number. In fact, the URI
"file:///full/path/to/filename.cpp:linenumber" refers to a file whose
name is literally "filename.cpp:linenumber".

Correspondingly, the entire stack that handles the opening of a URI (the
gtk_show_uri() method and anything that's underneath it) doesn't know
the concept of line number either. Think of all the .desktop and similar
files shipped by text editors and similar software, currently they are
unable to specify how to pass on the line number to them.

Getting it modified to support line numbers would require to modify GTK,
modify the .desktop file specification, and _all_ the software out there
that ship such a .desktop file, that is, practically all the text
viewers/editors out there, to conform to a nonstandard (and backwards
incompatible!) extension of the URI specification. This is clearly not
going to happen.

In order to move forward, first the URI specification would have to be
modified to introduce the concept of line number. In a backwards
compatible way, that is, the ':' character is out of question, it would
need to go to '?query' or '#fragment', probably the latter. Also figure
out what to do if the file is in any other format than plain text (what
would the given field mean for pdf (page number?), png, music/video
(time offset?) etc.) How to distinguish opening an html file as a
rendered page (when '#fragment' jumps to the corresponding 'a name' or
'id') vs. opening an html file as raw text (and then jumping to the
given line number)?

Then the remaining software components would one by one need to be
updated to this spec.

This was also discussed in the user comments in the gist page of the
explicit hyperlink feature for terminals, and was similarly
inconclusive.

Unfortunately, it's practically a WONTFIX.

You can probably use the nonstandard wrapper that you created for Qt
Creator for GNOME Terminal as well. Just have a wrapper script that
opens your file that handles this ':' and translates to the line number
command line parameter of your preferred text viewer/editor.
Unfortunately the world is not ready to standardize this personal hack
into a mainstream solution, and such a change cannot begin at GNOME
Terminal.

-- 
You received this bug notification because you are a member of Ubuntu
Desktop Bugs, which is subscribed to gnome-terminal in Ubuntu.
https://bugs.launchpad.net/bugs/2048569

Title:
  rightclick->open link doesn't work on
  file://full/path/filename.cpp:linenumber links

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gnome-terminal/+bug/2048569/+subscriptions


-- 
desktop-bugs mailing list
desktop-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/desktop-bugs

Reply via email to