Opened 10 years ago

Last modified 23 months ago

#4094 assigned bug

FilePanel: File Name is Selected Back to Front

Reported by: bonefish Owned by: nobody
Priority: normal Milestone: R1
Component: Applications/Tracker Version: R1/pre-alpha1
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All


The text in the file name text field of file panel is selected back to front when selecting an entry. I.e the anchor is at the end of the text, the caret at the start, so that when so that characters at the end cannot be deselected via Shift-Left, only characters at the beginning can be deselected via Shift-Right. This is inconsistent with other text fields whose text is auto-selected.

Change History (6)

comment:1 Changed 10 years ago by bonefish

Renaming entries in Tracker (in both icon and list mode) works the same, which is equally annoying.

comment:2 Changed 10 years ago by anevilyak

Component: Kits/Storage KitApplications/Tracker

most likely in BPoseView then. Switching component.

comment:3 Changed 2 years ago by pulkomandy

I'm wondering how it works for other text fields.

The course of events is (for renaming a file in PoseView, at least):

1) The text view is created 2) The text is added to it using SetText. This moves the caret to position 0 (start of the text) 3) SelectAll is called. This does not affect the caret position.

There don't seem to be an API to control the caret? I think InsertText instead of SetText will set the caret after the inserted text. But it makes sense for SetText to set it to the beginning, for example, when editing a file in StyledEdit, you normally want to read from the start, not from the end of the file.

Maybe SetText should move the caret to the end and StyledEdit should be the special case? Maybe it depends on wether this is a multi-line text view or not?

comment:4 Changed 2 years ago by axeld

I thought changing the caret position manually is done via SetSelection(index, index)?

Anyway, I think the first thing to do is to find out why (and if this is still the case) Tracker behaves differently from other apps. I never noticed anything being wrong with it BTW :-)

comment:5 Changed 2 years ago by pulkomandy

That would work, if done before the SelectAll() call.

Things behave the same in other apps as far as I can tell: SelectAll never moves the cursor. So if the cursor position is not set to anything special, it will be at position 0. The same happens for example in Web+ address bar.

However, if the text is added with InsertText, rather than SetText, the caret is moved to the end of the inserted text, and in that case, the selection shortcut will work from the end.

It's also possible to select all while the caret is in the middle of the text, for yet different results (then the shift+arrow deselects all char until the closest edge of the selection).

So, it seems to be nothing special to Tracker, just that the text is set with SetText then immediately selected with SelectAll.

comment:6 Changed 23 months ago by axeld

Owner: changed from axeld to nobody
Status: newassigned
Note: See TracTickets for help on using tickets.