Bug 35498 - SQL auto-complete should not prevent use of tab for spacing
Summary: SQL auto-complete should not prevent use of tab for spacing
Status: Pushed to oldstable
Alias: None
Product: Koha
Classification: Unclassified
Component: Reports (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Matt Blenkinsop
QA Contact: Lucas Gass
URL:
Keywords:
Depends on: 32613
Blocks:
  Show dependency treegraph
 
Reported: 2023-12-05 20:11 UTC by Andrew Fuerste-Henry
Modified: 2024-01-04 18:13 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.05.00,23.11.02,23.05.08


Attachments
Bug 35498: Allow tab to indent lines and trigger autocomplete (1.94 KB, patch)
2023-12-06 15:17 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 35498: Allow tab to indent lines and trigger autocomplete (1.50 KB, patch)
2023-12-06 15:36 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 35498: Allow tab to indent lines and trigger autocomplete (1.54 KB, patch)
2023-12-06 16:12 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 35498: Allow tab to indent lines and trigger autocomplete (1.59 KB, patch)
2023-12-06 16:20 UTC, Lucas Gass
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Fuerste-Henry 2023-12-05 20:11:40 UTC
With the new auto-complete feature for SQL, the tab key *always* opens the auto-complete suggestions popup, even when the cursor is at the start of a new line or immediately after a whitespace. This makes tab unusable for spacing/formatting, which is difficult functionality to use.

In a code editor, I expect tab to auto-complete if I've started a word/string, but to insert a whitespace if I'm at the start of a line or otherwise between words.
Comment 1 Katrin Fischer 2023-12-05 20:56:41 UTC
Hm, I don't think the tab ever worked there for adding whitespace/tab, so maybe not a regression and tab for auto-complete seems common?
Comment 2 Andrew Fuerste-Henry 2023-12-05 21:25:28 UTC
I'm deeply accustomed to tab-indenting new lines when writing reports in Koha and am certain this is a change.
Comment 3 Katrin Fischer 2023-12-05 21:28:36 UTC
(In reply to Andrew Fuerste-Henry from comment #2)
> I'm deeply accustomed to tab-indenting new lines when writing reports in
> Koha and am certain this is a change.

Hm OK, I might have never tried, but seem to remember getting annoyed by it not working in the system preferences (*UserJS etc). Maybe some changes happened over time. 

Usually a normal HTML input field doesn't allow it (like here in bugzilla), as the tab is used in form fields to jump to the next field.
Comment 4 David Cook 2023-12-05 22:29:29 UTC
I can confirm Andrew's report, and I agree that it is frustrating.
Comment 5 David Cook 2023-12-05 22:34:57 UTC
I notice that the "tab" is in a list of exclusions in guided_reports_start.tt at https://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=32613&attachment=147715

However, it looks like it is triggering the autocomplete anyway.

I imagine PTFS-Europe as the folk who introduced the change might have an idea on how to fix it.
Comment 6 Matt Blenkinsop 2023-12-06 15:17:44 UTC
Created attachment 159622 [details] [review]
Bug 35498: Allow tab to indent lines and trigger autocomplete

This patch allows the tab key to indent lines as well as trigger autocomplete.

Test plan:
1) Apply patch, navigate to reports and create a new SQL report
2) Click in the text editor and press tab, it should indent and then trigger the autocomplete options
3) Type something to select from the autocomplete box and press tab - it should autocomplete that option
4) Type any word and then press space. Now press tab and it should indent again
Comment 7 Matt Blenkinsop 2023-12-06 15:36:13 UTC
Created attachment 159623 [details] [review]
Bug 35498: Allow tab to indent lines and trigger autocomplete

This patch allows the tab key to indent lines as well as trigger autocomplete.

Test plan:
1) Apply patch, navigate to reports and create a new SQL report
2) Click in the text editor and press tab, it should indent and then trigger the autocomplete options
3) Type something to select from the autocomplete box and press tab - it should autocomplete that option
4) Type any word and then press space. Now press tab and it should indent again
Comment 8 ByWater Sandboxes 2023-12-06 16:12:43 UTC
Created attachment 159625 [details] [review]
Bug 35498: Allow tab to indent lines and trigger autocomplete

This patch allows the tab key to indent lines as well as trigger autocomplete.

Test plan:
1) Apply patch, navigate to reports and create a new SQL report
2) Click in the text editor and press tab, it should indent and then trigger the autocomplete options
3) Type something to select from the autocomplete box and press tab - it should autocomplete that option
4) Type any word and then press space. Now press tab and it should indent again

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Comment 9 Lucas Gass 2023-12-06 16:20:19 UTC
Created attachment 159626 [details] [review]
Bug 35498: Allow tab to indent lines and trigger autocomplete

This patch allows the tab key to indent lines as well as trigger autocomplete.

Test plan:
1) Apply patch, navigate to reports and create a new SQL report
2) Click in the text editor and press tab, it should indent and then trigger the autocomplete options
3) Type something to select from the autocomplete box and press tab - it should autocomplete that option
4) Type any word and then press space. Now press tab and it should indent again

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 10 Lucas Gass 2023-12-06 16:20:53 UTC
Thanks for the quick fix, Matt. Works great, passing QA.
Comment 11 David Cook 2023-12-06 22:52:12 UTC
You're a legend, Matt. Thanks for hopping on this one!
Comment 12 Katrin Fischer 2023-12-13 10:35:28 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 13 Fridolin Somers 2024-01-03 13:16:09 UTC
Pushed to 23.11.x for 23.11.02
Comment 14 Lucas Gass 2024-01-04 18:13:19 UTC
Backported to 23.05.x for upcoming 23.05.08