Bug 24497

Summary: CodeMirror indentation problems
Product: Koha Reporter: Lucas Gass <lucas>
Component: ToolsAssignee: Lucas Gass <lucas>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: trivial    
Priority: P5 - low CC: 1joynelson, cbrannon, hayleypelham, katrin.fischer, martin.renvoize, nick
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.05.00, 19.11.03, 19.05.08, 18.11.14
Attachments: Bug 24497: Turn off smartIndent for SQL
Bug 24497: Turn off smartIndent for SQL
Bug 24497: Turn off smartIndent for SQL

Description Lucas Gass 2020-01-23 15:29:56 UTC
Some librarians would like the ability to turn CodeMirror off in the sys prefs like OPACUserJS, IntranetUserCSS, etc.

An option to disable it via syspref would be nice.
Comment 1 Owen Leonard 2020-01-23 15:44:46 UTC
I would like to know more about why they want to disable it. Wanting to turn it off may mean it's not working well in a way that we can address.
Comment 2 Katrin Fischer 2020-01-23 22:53:36 UTC
Was going to ask the same - since it doesn't affect your input like the wysiwyg editor does, but only adds some formatting.
Comment 3 Nick Clemens 2020-01-24 16:09:30 UTC
We had a report of indentation woes, it seems CodeMirror doesn't like mismatched combined parentheses. I.e.

Enter below and go to new line:
SELECT CONCAT( CONCAT('a','b') )

No indent

Enter below and go to new line:
SELECT CONCAT( CONCAT('a','b'))
                        
                  Extreme indent
Comment 4 Lucas Gass 2020-01-24 18:19:54 UTC
Created attachment 97893 [details] [review]
Bug 24497: Turn off smartIndent for SQL

This only seems to effect SQL CodeMirror inputs and I belive it to be the smartIndent feature. This patch turns that off for SQL only.
TEST PLAN:
1. Enter 'SELECT CONCAT( CONCAT('a','b'))' into a SQL Report and press Enter
2. Extreme indent
3. Apply patch.
4. Enter 'SELECT CONCAT( CONCAT('a','b'))' into a SQL Report and press Enter
5. No indent.
6. Check that other indenting still works proper.
Comment 5 ByWater Sandboxes 2020-01-24 21:10:21 UTC
Created attachment 97929 [details] [review]
Bug 24497: Turn off smartIndent for SQL

Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
Comment 6 Christopher Brannon 2020-01-24 21:11:18 UTC
Yes!  You are a life saver!  Works much better!
Comment 7 Katrin Fischer 2020-01-25 17:50:17 UTC
Created attachment 97941 [details] [review]
Bug 24497: Turn off smartIndent for SQL

Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 8 Martin Renvoize 2020-01-27 10:17:27 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 9 Joy Nelson 2020-02-10 22:32:26 UTC
Pushed to 19.11.x for 19.11.03
Comment 10 Lucas Gass 2020-02-14 18:16:31 UTC
backported to 19.05.x for 19.05.08
Comment 11 Hayley Pelham 2020-02-17 03:46:48 UTC
Backported to 18.11.x for 18.11.14.