Bug 479717 - Pressing <ENTER> on } inserts two lines instead of one
Summary: Pressing <ENTER> on } inserts two lines instead of one
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: kwrite (show other bugs)
Version: 23.08.4
Platform: Other macOS
: NOR minor
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-13 02:14 UTC by khvalin
Modified: 2024-09-29 16:22 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
a sample js demo snippet (90 bytes, application/x-javascript)
2024-01-13 02:14 UTC, khvalin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description khvalin 2024-01-13 02:14:57 UTC
Created attachment 164853 [details]
a sample js demo snippet

SUMMARY
E.g. in the following JS snippet
```
  if (true) {
  |}
```

where the cursor position is marked with |, pressing the ENTER key adds and extra empty line:
```
  if (true) {
  
    
  }
```

STEPS TO REPRODUCE
0. open Kate
1.  Disable enclosing chars
2. Open the attached JS file
3. move your text cursor to the same line as "}" but to the left of the }
4. Press ENTER once

OBSERVED RESULT
that two blank lines were added

EXPECTED RESULT
only one blank like added


SOFTWARE/OS VERSIONS
Windows: 
macOS: ✓
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version:   5.112.0
Qt Version: 5.15.10 (built against 5.15.10)

ADDITIONAL INFORMATION
This could also be a problem with indentation as I only observed this issue on language - specific files.
Comment 1 Bug Janitor Service 2024-09-28 11:30:20 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/735
Comment 2 Christoph Cullmann 2024-09-29 16:22:49 UTC
Git commit 07b303eecb9fd6b1323f1d81ad843db0b9eb0581 by Christoph Cullmann, on behalf of Waqar Ahmed.
Committed on 29/09/2024 at 16:14.
Pushed by cullmann into branch 'master'.

Fix pressing <ENTER> on } inserts two lines instead of one

A  +6    -0    autotests/input/indent/cstyle/clospar5/expected
A  +4    -0    autotests/input/indent/cstyle/clospar5/input.js
A  +4    -0    autotests/input/indent/cstyle/clospar5/origin
M  +13   -5    src/script/data/indentation/cstyle.js

https://invent.kde.org/frameworks/ktexteditor/-/commit/07b303eecb9fd6b1323f1d81ad843db0b9eb0581