https://bugs.kde.org/show_bug.cgi?id=441603

            Bug ID: 441603
           Summary: Regression in Ruby indentation with regular
                    expressions
           Product: kate
           Version: 20.12.2
          Platform: Debian stable
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: indentation
          Assignee: kwrite-bugs-n...@kde.org
          Reporter: jaros...@thinline.cz
  Target Milestone: ---

After upgrading from Debian Buster to Debian Bullseye Ruby indentation stopped
working properly when there are regular expressions involved in the source


STEPS TO REPRODUCE
1. open new document, switch its indentation to Ruby
2. type

if v =~ /re/<enter>

OBSERVED RESULT
cursor indents two tabs to the right on the next line. After that the
indentation becomes "confused" and doesn't work properly. The indentation works
fine for case-insensitive regexp though. (Additional observations below.)

EXPECTED RESULT
cursor indents one tab to the right (being in the condition block). 


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Debian Bullseye
KDE Plasma Version: not being used (running with Xfce)
KDE Frameworks Version: 5.78.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION

(1) The bug is present in version 21.07.90 as found in Kubuntu live image
(http://cdimage.ubuntu.com/kubuntu/daily-live/current/)

(2) The editor works correctly when the regexp is case-insensitive (or has any
other modifier)

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 as the end of the "if" block:

if v =~ /re/i
    statement
end

However, when the regexp has no modifier, things go like this:

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

(Should have both statements on the same level, that level being one tab, not
two)

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

Any help or advice would be appreciated. I have basic understanding of C/C++
code so should be able to apply patches to Debian's version of Kate.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to