Bug 453689

Summary: regression: --line option is ignored unless --column is given too
Product: [Applications] kate Reporter: Jonathan Marten <jjm>
Component: kwriteAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: Git   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Jonathan Marten 2022-05-12 06:44:18 UTC
SUMMARY
It used to be possible to specify only the --line option to go to a specified line in a file, e.g.

  kwrite --line 10 CMakeLists.txt

which would load the file and position the cursor on that line.  However, possibly in the last couple of months, this has changed so that the --line option alone, used as above, does not work - KWrite opens the file either at the position where the cursor was when the file was last opened, or at line 1, column 1.

For the line number to take effect it is necessary to specify a column as well:

  kwrite --line 10 --column 1 CMakeLists.txt

which goes to the specified line regardless of history.

STEPS TO REPRODUCE
1.   Start KWrite with only --line specified
2.   Start KWrite with both --line and --column specified

OBSERVED RESULT
1.  The cursor is not placed on the specified line.
2.  The cursor is placed at the line and column.

EXPECTED RESULT
1.  The cursor is placed at column 1 of that line.

SOFTWARE/OS VERSIONS
KDE Plasma Version: 5.24.80
KDE Frameworks Version: 5.94.0
Qt Version: 5.15.3

ADDITIONAL INFORMATION
This is with Kate master branch from git, v19.12.2-2174-g85b68d76

If this is now intended behaviour then it is not serious (because there is a solution), but it should be documented somewhere in the command line help.
Comment 1 Christoph Cullmann 2022-05-18 13:05:04 UTC
Git commit e2a3fffd7056d179c8cdba262229868a10b9c802 by Christoph Cullmann, on behalf of Eric Armbruster.
Committed on 18/05/2022 at 12:59.
Pushed by cullmann into branch 'master'.

Ensure cursor is valid if only --line is set

We need to make sure the cursor is valid if only the --line or only the --column argument is set.

To achieve this, set the default value for column and line to 0 and explicitly return an invalid cursor when both options are not set.

M  +11   -18   apps/lib/kateapp.cpp

https://invent.kde.org/utilities/kate/commit/e2a3fffd7056d179c8cdba262229868a10b9c802