Viewspace settings on startup improvements
The handling of cursor position at startup is incomplete/inconsistent.
Cursor position passed in command line arguments is only set in the last document when opening multiple documents (as cmd args).
Cursor position passed in command line arguments or as document URL query string is not applied for for remote documents (as cmd arg).
When opening a session with --line/--column on the command line, cursor is first set from session (or query string), then reset from args.
Cursor position info may come from 3 places: session, args or query string. I think it's obvious that when considering which one to use the order should be query string, or if no query string, then args, or if no args, then session.
This patch addresses bug 335608 and the above inconsistencies.
Test case: kate has a session 's2' with 2 local files open 'local2' and 'local3' with cursor on line 2 and line 3 respectively. Kate has no open instance.
After command:
$ kate --start s2 --line 4 local2
the cursor is on line 4 in 'local2' (from args) and on line 3 in 'local3' because it was opened from session (local3 is not in command line).
After command
$ kate --start s2 --line 4 local2 local3
the cursor is on line 4 in both files.
After command
$ kate --start s2 --line 4 file:///local2?line=5
the cursor is on line 5 in 'local2' (query overrode args) and on line 3 in 'local3' (from session). (Query strings only work with full absolute local pathnames.)
After command
$ kate --start s2 --line 4 file:///local2?line=5 local3
the cursor is on line 5 in 'local2' (query) and on line 4 in 'local 3' (args) (session was overridden in both).
(Test case is reset before each command.)
Note that when a local file is passed in w/o the file:// prefix and with query string e.g. ~/file1?line=3
, then the query string is not parsed and becomes part of the document display URL but that's OK since these are valid file file names and query strings with protocol are supported.
UPDATE 4 March
In addition to the above specific test cases the latest version fixes setting the cursor position for remote files in general. The test cases repeated with remote files replacing local files should pass as described above.
Also, any combination of remote and local files as positional arguments, with any combination line and/or column defined as command line argument or query string, with or without session (i.e. when passing positional arguments and not passing --start, kate will force an anonymous session), with or without an already running kate instance should also work.
There is one known glitch to me at the moment: when kate is running and a command line containing line/column both as args and as url query string for a document not yet open in kate is executed, then cursor position in the query string does not override the --line/--column args.
Also fixes restoring session viewspace settings for remote files, for which !292 (merged) was a preparation.