Don't reverse order of files opened from the command line
AbandonedPublic

Authored by gmolteni on Nov 23 2018, 3:55 PM.

Details

Reviewers
cfeck
zetazeta
ngraham
Group Reviewers
Kate
Summary

When invoking from command line: kate a b c
Files are open in order c b a (instead of a b c)
BUG: 397913

Diff Detail

Repository
R40 Kate
Branch
bug-397913 (branched from master)
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 5339
Build 5357: arc lint + arc unit
gmolteni created this revision.Nov 23 2018, 3:55 PM
Restricted Application added a project: Kate. · View Herald TranscriptNov 23 2018, 3:55 PM
Restricted Application added a subscriber: kwrite-devel. · View Herald Transcript
gmolteni requested review of this revision.Nov 23 2018, 3:55 PM
cfeck requested changes to this revision.Nov 23 2018, 10:08 PM
cfeck added subscribers: ngraham, cfeck.

Please use the same coding style (spaces, position of braces) as the surrounding code.

Additionally, please follow https://community.kde.org/Infrastructure/Phabricator regarding title and description for the commit message.

This revision now requires changes to proceed.Nov 23 2018, 10:08 PM
gmolteni updated this revision to Diff 46097.Nov 24 2018, 1:25 AM

Fix Kate cli reverses order of files

When opening several files using Kate from cli, they appear in reverse
order (e.g. doing kate a b c opens screen filename tabs as c b a,
after this fix, it will open filename tabs on screen as a b c).
No side effects as result of this modification.

Resolves: #397913

You need to write BUG: 397913 in the summary section, and then remove all mention of it from the title. Please read https://community.kde.org/Infrastructure/Phabricator#Formatting_your_patch

gmolteni retitled this revision from Bug fix 397913: Kate cli reverses order of files to Kate cli reverses order of files.Nov 24 2018, 4:07 AM
gmolteni edited the summary of this revision. (Show Details)
gmolteni edited the summary of this revision. (Show Details)Nov 24 2018, 4:15 AM

Almost there. :) Now rewrite the Title in the form of a statement that describes the problem that this patch is fixing. Something like "Don't reverse order of files opened from the command line"

gmolteni retitled this revision from Kate cli reverses order of files to Don't reverse order of files opened from the command line.Nov 24 2018, 11:00 AM

Almost there. :) Now rewrite the Title in the form of a statement that describes the problem that this patch is fixing. Something like "Don't reverse order of files opened from the command line"

Thank you very much for your support :-)

zetazeta accepted this revision.Nov 24 2018, 2:22 PM
zetazeta added a subscriber: zetazeta.

My bug is getting fixed! What a great community...

ngraham requested changes to this revision.Nov 24 2018, 2:37 PM
ngraham added a reviewer: Kate.

Thanks! I can verify that this fixes the case where you do kate file1 file2 file3 when kate is not already open; now they are opened in the correct order! But when Kate is already open with a few files in tabs, the new files are opened in tabs but in the wrong order. Do you think you could fix that too?

This revision now requires changes to proceed.Nov 24 2018, 2:37 PM
cfeck added a comment.Nov 24 2018, 3:45 PM

(That's the linked bug report)

This comment was removed by gmolteni.

Thanks! I can verify that this fixes the case where you do kate file1 file2 file3 when kate is not already open; now they are opened in the correct order! But when Kate is already open with a few files in tabs, the new files are opened in tabs but in the wrong order. Do you think you could fix that too?

I think that perhaps fixing it is an advanced topic.
The original fix I did was to reverse the order of a foreach loop.
I already located the other foreach loop that is necesary to reverse in order to improve that second case,
but the final result needs a third fix (i will try to but i guess it requires scratching the code much deeper).

With the current fix (foreach at line 178@kateapp.cpp) :

kate f1 f2 f3 --- 1st invocation produces ---> f1 f2 f3
kate f4 f5 f6 --- 2nd invocation produces ---> f6 f5 f4 f1 f2 f3

Fixing a second foreach loop (foreach at line 423@main.cpp) will gave us this:

kate f4 f5 f6 --- 2nd invocation produces ---> f4 f5 f6 f1 f2 f3

However, the main issue here is that i have no idea how to let kate to insert the files
to the right of list instead of the left of the list.

I will invest some time trying to understand kate deeper, but I have no idea where how to find
that part of code.

Thanks for looking into it! Inserting to the left is probably fine, as long as the ordering of the files specified on the command line is preserved.

Thanks for looking into it! Inserting to the left is probably fine, as long as the ordering of the files specified on the command line is preserved.

excelent !! i will do the new commit today !

Thanks for looking into it! Inserting to the left is probably fine, as long as the ordering of the files specified on the command line is preserved.

when I did arc diff again, it reported new diff link is this: https://phabricator.kde.org/D17144

Oops, that means that either you weren't on the bug-397913 branch, or you added the --create argument.

You can Abandon this revision and we can continue from D17144.

Oops, that means that either you weren't on the bug-397913 branch, or you added the --create argument.

You can Abandon this revision and we can continue from D17144.

I made a mistake it seems i commited it as master... let me try again commiting from correct branch

gmolteni updated this revision to Diff 46165.Nov 24 2018, 11:39 PM

Don't reverse order of files opened from the command line

When you do kate file1 file2 file3, it will open tabs
in same order, file1 file2 file3.
In case of having kate opened, invoking it again with
kate file4 file5 file6 final result on tabs shall be
file4 file5 file6 file1 file2 file3
BUG: 397913