When invoking from command line: kate a b c
Files are open in order c b a (instead of a b c)
BUG: 397913
Details
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
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.
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
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"
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.
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.
I made a mistake it seems i commited it as master... let me try again commiting from correct branch
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