Bug 429184

Summary: File links of the form name:number:number don't ignore numbers when opening
Product: [Applications] konsole Reporter: FeepingCreature <default_357-line>
Component: kpartAssignee: Konsole Developer <konsole-devel>
Status: REPORTED ---    
Severity: minor CC: bjourne
Priority: NOR    
Version: 20.08.2   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description FeepingCreature 2020-11-16 11:00:07 UTC
SUMMARY

When a filename appears in the program output, it may be underlined and opened directly by control-clicking.

When the filename is followed by a :number or :number:number annotation, this usually signifies a line number or combination line number/colon number in compiler or text processor output.

However, even though konsole correctly adds the ':' suffix to the filename to be opened - ie. it should in fact pass the suffix to the program responsible for opening the file - it does not ignore the suffix when attempting to open the file at all, leading to a "the file or folder does not exist" error as it tries to open "filename:123" directly.

STEPS TO REPRODUCE
1. open konsole
2. in profile settings -> mouse -> miscellaneous, enable "underline links"
3. touch filename.txt
4. echo filename.txt
5. ctrl-click the filename.txt, observing that the file is opened
6. echo filename.txt:20
7. ctrl-click the filename.txt:20

OBSERVED RESULT

An error appears, indicating konsole is trying to open "filename.txt:20", a nonexistent file.

EXPECTED RESULT

filename.txt should open at line 20. That is, "filename.txt:20" should be passed to the app responsible for handling "filename.txt".

SOFTWARE/OS VERSIONS

Linux/KDE Plasma: Ubuntu 20.10
(available in About System)
KDE Plasma Version: 20.08.2
KDE Frameworks Version: 5.74.0
Qt Version: 5.14.2
Comment 1 FeepingCreature 2020-11-16 11:02:46 UTC
Mind that "filename.txt:" when not followed by a number *should* drop the colon, as that is the output used by e.g. multifile grep. (Also, kwrite cannot handle it.) This leads to an ambiguity where grep finds a line beginning with a number, however that ambiguity is almost certainly harmless - worst case, the grepped file is opened at an unexpected line.
Comment 2 Paul Worrall 2023-07-24 10:29:33 UTC
*** Bug 472533 has been marked as a duplicate of this bug. ***