Bug 432774 - Kdevelop replaces "." with "->" when writing C compound literals
Summary: Kdevelop replaces "." with "->" when writing C compound literals
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: All editors (show other bugs)
Version: 5.6.2
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
: 449441 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-02-10 22:42 UTC by Brendon Higgins
Modified: 2022-12-04 16:14 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brendon Higgins 2021-02-10 22:42:02 UTC
Hi,

Create a new file.c with the following content:

--%<--
typedef struct myStruct {
int x;
} myStruct;

myStruct fn() {
}
-->%--

Now try to insert the line "return (myStruct) { .x = 0 };" inside fn(). As soon as you type "." Kdevelop immediately turns it into "->". Now try to correct that. The only way I've found that doesn't get immediately replaced again is to paste a "." from the clipboard.

Best,
Brendon
Comment 1 Brendon Higgins 2021-02-24 18:38:09 UTC
I want to add that whatever logic replaces "." with "->" also triggers after CTRL+Z. So in some circumstances the Undo action can be rendered difficult or unusable.
Comment 2 Igor Kushnir 2021-02-25 09:33:49 UTC
I remember being hit with this obstinate replacement in a heavily-templated C++ source file about a year ago. Working this around can be difficult and annoying.
Comment 3 Igor Kushnir 2022-10-24 06:35:35 UTC
*** Bug 449441 has been marked as a duplicate of this bug. ***
Comment 4 Igor Kushnir 2022-10-24 06:36:53 UTC
(In reply to Brendon Higgins from comment #1)
> I want to add that whatever logic replaces "." with "->" also triggers after
> CTRL+Z. So in some circumstances the Undo action can be rendered difficult
> or unusable.
This is Bug 364411.
Comment 5 Igor Kushnir 2022-11-27 21:58:56 UTC
To the reporters of this bug and its duplicate: could you check if this bug is still reproducible and with which KDevelop and Clang versions? This question came up in a review of a fix here: https://invent.kde.org/kdevelop/kdevelop/-/merge_requests/392#note_570228
Comment 6 Brendon Higgins 2022-11-28 02:21:26 UTC
Hello! I just tried it in KDevelop 5.8.220401 with Clang 14.0.6-2 (so says "clang -v"). Happy to report the issue seems to no longer be present.
Comment 7 Igor Kushnir 2022-12-04 16:14:09 UTC
If anyone experiences this bug again, before reopening please test in KDevelop version that includes the fix for a similar issue https://commits.kde.org/kdevelop/560c06ffb01dff577b58e3f2026ece17c49a0ed0. This fix will be released in KDevelop version 5.11.230400.