Bug 335608

Summary: Kate does not jump to specified line when opening an sftp url
Product: [Applications] kate Reporter: Nikola Kovacs <nx.devnull>
Component: applicationAssignee: Marcell Fulop <marekful>
Status: RESOLVED FIXED    
Severity: normal CC: cullmann, justin.zobel, l.savernik, marekful, safa1996alfulaij
Priority: NOR    
Version: 3.13.1   
Target Milestone: ---   
Platform: Kubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 21.04.0

Description Nikola Kovacs 2014-05-30 18:24:48 UTC
When starting kate with a command like this:

kate --line 3 "sftp://username@server:22/home/username/test.txt"

if the file is not  already opened in kate, it won't jump to line 3. If the file is already opened, it works.

Local files are fine, only sftp urls are affected.

I use a private key to log in, and it's added with ssh-add, so there's no password prompt, in case that matters.

Reproducible: Always

Steps to Reproduce:
1. Create a file with at least five lines on a remote server where you have ssh/sftp access.
2. Copy your public key to the remote server, and add your private key with ssh-add, so you can log in without any prompts.
3. Set up the remote server in dolphin (go to remote:/, Add network folder, etc.)
4. Open the file through sftp in kate.
5. Write down the url in the title bar, it should look like this: sftp://username@server:22/path/to/file
6. Close kate.
7. Open a terminal, and type: kate --line 5 followed by the url.

Actual Results:  
The file is opened in kate, but the cursor is on the first line.

Expected Results:  
The file is opened in kate, and the cursor is on the fifth line.
Comment 1 Nikola Kovacs 2015-08-17 08:33:55 UTC
This sometimes happens with local files as well on Kate 5.0.0.
Comment 2 Christoph Cullmann 2016-09-08 19:50:21 UTC
*** Bug 116793 has been marked as a duplicate of this bug. ***
Comment 3 Christoph Cullmann 2018-08-17 20:32:19 UTC
*** Bug 386669 has been marked as a duplicate of this bug. ***
Comment 4 Christoph Cullmann 2018-08-17 20:32:37 UTC
Still an issue, patches are welcome.
Comment 5 Justin Zobel 2020-10-25 07:32:25 UTC
kate 20.08.1

I tried several local files and they were fine but sftp files did not highlight the correct line.

Tried fish:// protocol as well, not highlighting there either.
Comment 6 Marcell Fulop 2021-02-20 01:49:10 UTC
I have a patch for this! I'm a complete newb in KDE dev and not sure how to submit it. I'll find out shortly...
Comment 7 Justin Zobel 2021-02-22 03:59:55 UTC
(In reply to Marcell Fulop from comment #6)
> I have a patch for this! I'm a complete newb in KDE dev and not sure how to
> submit it. I'll find out shortly...

See here :) https://community.kde.org/Get_Involved/development#Submit_a_Merge_Request

Thank you for the contribution!
Comment 9 Christoph Cullmann 2021-03-14 12:40:48 UTC
Author: Christoph Cullmann <cullmann@kde.org>  2021-03-14 13:39:27
Committer: Christoph Cullmann <cullmann@kde.org>  2021-03-14 13:39:27
Parent: a05525ee885a7545c5d1677faa66e63578d7e520 (SVN_SILENT made messages (.desktop file) - always resolve ours)
Parent: 85e39621f8ff30eeba3444de45d76a37dd84056f (SVN_SILENT clang-format ignore)
Branches: release/21.04, remotes/origin/release/21.04
Follows: v19.12.2
Precedes: 

    Merge branch 'master' into release/21.04
    
    => merging the https://invent.kde.org/utilities/kate/-/merge_requests/295 stuff
    
    BUG: 335608