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
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?
I have no issues with letting 0 behave like 1. Showing some error message seems more confusing.
(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.
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/4
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
Thank you guys for implementation and commit!