#991702 kate: Regression in Ruby indentation in Bullseye

Package:
kate
Source:
kate
Description:
powerful text editor
Submitter:
Date:
2021-07-30 12:39:04 UTC
Severity:
normal
#991702#5
Date:
2021-07-30 12:29:16 UTC
From:
To:
Dear Maintainer,

after upgrading from Buster to Bullseye, Kate text editor's behaviour
regarding Ruby indentation changed with significant regression

The bug can be reproduced like this (correct behaviour first):

- open new document, switch its indentation to Ruby
- type

if v =~ /re/i<enter>

- cursor correctly indents one tab to the right. All subsequent lines
are
indented as well until you type "end", which is immediatelly and
automatically
de-indented:

if v =~ /re/i
     statement
end

- same example but with the regexp being case-sensitive, ie. no "i" at
the end

if v =~ /re/<enter>

- cursor indents two tabs to the right, my guess would be the indenter
doesn't
consider that regexp to be complete (expecting at least one more
letter).
Next line is de-indented to a single tab indentation, which is correct,
but indentation in most of the code after such block does not work
correctly.
Final code looks like this:

if v =~ /re/
         statement
     statement
end

The following is more elaborate example of indentation errors caused by
this
regression. All indentation shown is done by the editor, nothing is
adjusted
manually:

statement =~ /re/
         <two tabs, cursor is here, no text, just newline>
         begin
if v =~ /re/
         statement
     statement
end
rescue
     statement
     end
     <cursor stays here>

The following is the correct behaviour observed when the regexp
is case-insensitive (again, no manual indentation adjustment):

statement =~ /re/i

begin
     if v =~ /re/i
         statement
         statement
     end
rescue
     statement
end

I tried to find out the code responsible for this. Kate version in
Buster had
a package kate-data containing indentation scripts, notably

/usr/share/kde4/apps/katepart/script/indentation/ruby.js

But I am unsure if that was actually in use. Trying to put that file
(and its dependencies found by looking at require statements in the
script)
into ~/.local/share/katepart5/script/indentation as documented in

https://docs.kde.org/stable5/en/kate/katepart/dev-scripting.html

broke Ruby indentation altogether (no automated indentation was taking
place)

I haven't been able to figure out where the indentation-related code
is stored now, so I wasn't able to try to fix this myself.

Any help or advice would be appreciated
Thanks