[RFC] Improve Home button function when renaming files
AbandonedPublic

Authored by msciubidlo on Apr 3 2019, 10:41 PM.

Details

Reviewers
ngraham
Group Reviewers
Dolphin
Summary

BUG: 363179

Home button handling is overtaken from KTextEdit when text is selected.

Diff Detail

Repository
R318 Dolphin
Lint
Lint Skipped
Unit
Unit Tests Skipped
msciubidlo created this revision.Apr 3 2019, 10:41 PM
Restricted Application added a subscriber: kfm-devel. · View Herald TranscriptApr 3 2019, 10:41 PM
msciubidlo requested review of this revision.Apr 3 2019, 10:41 PM
msciubidlo updated this revision to Diff 55397.Apr 4 2019, 8:28 AM

Added support for shift+home text selection.

ngraham retitled this revision from Improve Home button function when renaming files to [RFC] Improve Home button function when renaming files.
ngraham edited the summary of this revision. (Show Details)
ngraham requested changes to this revision.Apr 5 2019, 4:29 AM
ngraham added a subscriber: ngraham.
ngraham added inline comments.
src/kitemviews/private/kitemlistroleeditor.cpp
121

This doesn't seem to implement what's been asked for in the bug report. The request was for the Home key to always go to the beginning of the filename, not the beginning of the line and then up one line if you hit it again. That's not a behavior I'm aware of being used anywhere else, so it would be unfamiliar and strange to users.

This revision now requires changes to proceed.Apr 5 2019, 4:29 AM
msciubidlo added inline comments.Apr 5 2019, 6:07 AM
src/kitemviews/private/kitemlistroleeditor.cpp
121

This part isn't part of the bug fix.

This behavior is used in inline rename when End is pressed. Each press of End+Shift will mark one more line. Pressing Home+Shift won't. I guess that End+Shift isn't intentional but still it grew on me and now i use End, End+Shift when renaming.

If it shouldn't go in i will remove but if it would go in after creating bug report and going through process i would like to keep it.

It's important that keyboard shortcuts for text selection be universally consistent. +Home/End selects from the current cursor position to the beginning/end of the current line; that shouldn't be overridden here.

However now that I dig into it, I notice that Kate does something similar: the first Home/End press goes to the beginning/end of the current line of a multiline string, but then a second press goes all the way to the beginning/end of the whole multiline string. I think that would be reasonable to do here.

It's about trade off between usability and consistency.
Kate does what it does to be able to select whole, very long line.

Here it can be done in many ways like ctrl+a or shift+Page down/Page up. Changes in this patch were about fine grained selection, getting to the middle of long name faster.

I will remove that part from the diff and leave only bug fix.

msciubidlo updated this revision to Diff 55494.Apr 5 2019, 6:40 PM
msciubidlo marked an inline comment as done.
msciubidlo edited the summary of this revision. (Show Details)

I think we may be confusing one another, compounded by the unclear title and summary messages.

https://bugs.kde.org/show_bug.cgi?id=363179 requests that when renaming a file with a long multi-line string, the home/end keys should go to the beginning/end of the whole filename rather than the beginning/end of the line. This should happen whether or not the text is currently selected. That's not the behavior I'm seeing from the patch.

msciubidlo abandoned this revision.Apr 5 2019, 9:08 PM

This should happen whether or not the text is currently selected.

I can't see it in bug report. Anyway it can be done in other ways right now. I just don't see the point for it to work this way.

Thanks for your time.

You're welcome, but I think we can probably get some variant of this landed if we put our heads together. :)

The idea is that the home key should always go to the beginning of the filename, and the end key should always go to the end. That's what the bug reporter requested:

When you are renaming such files, you often want to add something to the beginning of file name. But pressing Home button returns cursor to the beginning of last line, not to the beginning of a whole file name.

Steps to Reproduce:

  1. Create a file with long name, which will be devided to several lines by dolphin.
  2. Select this file and press f2 or choose rename from context menu.
  3. Press Home button.

    [...]

    Expected Results: Cursor should be pointing to start of file name (on first line).

It doesn't matter whether or not the whole filename is currently selected; the keys should always have the same behavior. If you change the patch to do that. I think we can get it into Dolphin.

It doesn't matter whether or not the whole filename is currently selected; the keys should always have the same behavior.

Understood. I don't want to do it because it will brake my usage of End button.

It doesn't matter whether or not the whole filename is currently selected; the keys should always have the same behavior.

Understood. I don't want to do it because it will brake my usage of End button.

Well, if you abandon this patch, and I do it myself, then eventually you get broken anyway, right? How about a compromise: we take Kate's behavior and the first press of Home/End goes to the beginning or end of the current line, and then if the cursor is already there, another press moves it all the way to the beginning or end of the whole string. What do you think?

I feel that we are splitting hairs. Do as you think will be best.