Bug 411165 - Make GoTo line work backward
Summary: Make GoTo line work backward
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords: junior-jobs
Depends on:
Blocks:
 
Reported: 2019-08-22 12:49 UTC by Eric Depagne
Modified: 2020-06-27 07:17 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Depagne 2019-08-22 12:49:33 UTC
SUMMARY
Ctrl+g opens the "goto line dialog".
It would be very convenient if one could use negative indices to go to lines starting from the end of the file
Comment 1 Nazar Kalinowski 2020-06-25 09:43:19 UTC
I might be interested in implementing this, but there is a (design) problem.
The spinbox that is used to handle the input for a line number to go to currently has a limit of [1; lastline]. In order to implement this feature we will have to make it [-lastline; lastline] (e.g. from negative to positive).
The problem with that is that 0 is allowed now, and we will have to decide what to do if 0 is selected. I see two options:
1. Go to 1 line (which is bad because "goto 1" and "goto 0" are now the same things, which is confusing).
2. Display some error (which is also bad, because we allow to choose 0 in the spinbox when it's actually an error condition).
Thoughts on this?
Comment 2 Christoph Cullmann 2020-06-25 09:53:00 UTC
I have no issues with letting 0 behave like 1.
Showing some error message seems more confusing.
Comment 3 Eric Depagne 2020-06-25 10:20:22 UTC
(In reply to Nazar Kalinowski from comment #1)
> I might be interested in implementing this, but there is a (design) problem.
> The spinbox that is used to handle the input for a line number to go to
> currently has a limit of [1; lastline]. In order to implement this feature
> we will have to make it [-lastline; lastline] (e.g. from negative to
> positive).
> The problem with that is that 0 is allowed now, and we will have to decide
> what to do if 0 is selected. I see two options:
> 1. Go to 1 line (which is bad because "goto 1" and "goto 0" are now the same
> things, which is confusing).
> 2. Display some error (which is also bad, because we allow to choose 0 in
> the spinbox when it's actually an error condition).
> Thoughts on this?

Going to line 1 when 0 is selected looks fine to me (as it's probably what is intended).
Displaying an error seems overkill on the other hand.
Comment 4 Bug Janitor Service 2020-06-25 13:29:01 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/4
Comment 5 Nazar Kalinowski 2020-06-26 18:17:45 UTC
Git commit 71b4295ab447f17d3a12f7dd38db4a345c5087d5 by Nazar Kalinowski.
Committed on 25/06/2020 at 13:26.
Pushed by cullmann into branch 'master'.

Make "goto line" work backwards

This patch allows "goto line" feature to work backwards with negative numbers.

M  +13   -5    src/dialogs/katedialogs.cpp

https://invent.kde.org/frameworks/ktexteditor/commit/71b4295ab447f17d3a12f7dd38db4a345c5087d5
Comment 6 Eric Depagne 2020-06-27 07:17:32 UTC
Thank you guys for implementation and commit!