billthefarmer / diary

Android personal diary - forked from http://git.savannah.gnu.org/cgit/diary.git
https://billthefarmer.github.io/diary
GNU General Public License v3.0
276 stars 58 forks source link

Weird behavior while searching in edit mode #173

Closed uli-on closed 3 years ago

uli-on commented 3 years ago

Hi Bill!

I'm having a problem about where and where not the focus of Diary lies.

Steps to reproduce are:

  1. Enter edit mode
  2. Select "Find..." from the menu. (In case it matters: I've a small screen, Find is in the three-dot-menu)
  3. Enter a search term
  4. Tap "Back" in the navigation bar to fold in the virtual keyboard and see more of the text. That seems(!) also to remove focus from the search's text input field.
  5. Try to edit the text, here: Press delete
  6. Result: The search term is removed in one as if it was completely marked and focus had been on the search input field, the page scrolls up.

OK, I thought, graphical glitch, i.e. Android's fault, focus is in fact on the search field, but tzhe cursor just isn't displayed. So after folding in the keyboard in step 4 I additionally clicked into the main text (the actual diary text) to set focus on that very area. Then I scrolled the text to the word I actually wanted to edit, clicked the text again (which should also set focus on the main text area) in order to bring back the keyboard and pushed Delete. Result: Same as above, the search term is removed, the page scrolls up.

I just tested a little further and found that pressing any letter (not only the delete key) deletes the search term and scrolls to top. And enters the letter, additionally.

I hope that's fixable as my entries tend to be longish so searching is often necessary before correcting. Thanks for your struggles!

EDIT Technical corner stones:

billthefarmer commented 3 years ago

The search widget, once you start it, takes over the toolbar and does it's own thing. The only thing the developer can do is find and highlight the text, or in the case of the web view that handles the markdown view, it does it all itself. In the case of a small phone it can be almost useless, because the keyboard UI can take over the whole display, like this…

Screenshot_20210731-122218 1

There's not a lot the developer can do about that. In the case of touching the text view, the first keystroke is acted on in the text view, then the focus immediately returns to the search widget. The developer doesn't get a look in. So there's not a lot I can do about it apart from starting again from scratch. If you dismiss the search widget, the edit cursor stays where you put it.

A better way of dealing with this is to search in the markdown view and then double tap where you want to edit. That will dismiss the search widget, switch view, and put the cursor in about the right place all in one go.

uli-on commented 3 years ago

Great that you amended your reply about the last paragraph. That's a great solution, Bill, I didn't know I could do that. Asking really paid off, thanks!

If you haven't already, adding that paragraph to the help/introductory file would be welcome by many, I think.