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 Desktop
Packages, 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

Status in gnome-terminal package in Ubuntu:
  New

Bug description:
  TLDR: I want to be able to open links like
  file:///full/path/to/filename.cpp:linenumber with rightclick open link

  video explanation: https://youtu.be/PmQAx7HF7_c

  ProblemType: Bug
  DistroRelease: Ubuntu 22.04
  Package: gnome-terminal 3.44.0-1ubuntu1
  ProcVersionSignature: Ubuntu 6.2.0-39.40~22.04.1-generic 6.2.16
  Uname: Linux 6.2.0-39-generic x86_64
  ApportVersion: 2.20.11-0ubuntu82.5
  Architecture: amd64
  CasperMD5CheckResult: pass
  CurrentDesktop: ubuntu:GNOME
  Date: Mon Jan  8 14:05:15 2024
  InstallationDate: Installed on 2022-05-05 (612 days ago)
  InstallationMedia: Ubuntu 22.04 LTS "Jammy Jellyfish" - Release amd64 
(20220419)
  SourcePackage: gnome-terminal
  UpgradeStatus: No upgrade log present (probably fresh install)

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


-- 
Mailing list: https://launchpad.net/~desktop-packages
Post to     : desktop-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~desktop-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to