Bug 451613

Summary: Snippets fail when not used at the beginning of a line
Product: [Applications] kate Reporter: daobrien
Component: plugin-snippetsAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED WORKSFORME    
Severity: normal CC: lassi.vaatamoinen
Priority: NOR    
Version First Reported In: 21.08.3   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description daobrien 2022-03-17 10:11:02 UTC
SUMMARY
When I create a snippet and then try to use it mid-sentence, or not at the beginning of a line, the first few characters of the snippet are removed.


STEPS TO REPRODUCE
1. Create a snippet (in my example: Red{nbsp}Hat Advanced Cluster Management for Kubernetes (RHACM) )
2. Insert the snippet NOT at the beginning of a line, using the shortcut I have set up.
3. 

OBSERVED RESULT
1. If inserted at the beginning of a line:
Red{nbsp}Hat Advanced Cluster Management for Kubernetes (RHACM) 

2. If inserted NOT at the beginning of a line:
aed{nbsp}Hat Advanced Cluster Management for Kubernetes (RHACM) 

I believe the "a" in column one is left over from the domain shortcut (ad), which I use for AsciiDoc files.

3. If inserted mid-sentence:
sp}Hat Advanced Cluster Management for Kubernetes (RHACM)

EXPECTED RESULT

The full snippet should be inserted regardless of cursor position.

SOFTWARE/OS VERSIONS
Some of the following info might not be available because I run Kate and Konsole on Gnome Classic.
qt-4.8.7-61.fc34.x86_64 if that helps.

Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Lassi Väätämöinen 2024-07-11 18:57:08 UTC
Not sure if this is the same issue as what I am seeing, but looks like in source code files, the snippet completion is quite context sensitive. If there's one badly indented line, and the completion is started at the beginning of the line, looks like the completion is prefixed with extra characters from the snippet.

Extra character(s) looking like being from the what you define in the "namespace" field of the snippet repository.
Comment 2 Lassi Väätämöinen 2024-07-11 19:02:35 UTC
And might be related to bug 478303.

Have you checked if the completion is correct when you select it from the completions side pane, instead of using the keyboard completion?
Comment 3 Bug Janitor Service 2024-07-26 03:46:09 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 4 daobrien 2024-07-26 07:58:39 UTC
(In reply to Lassi Väätämöinen from comment #2)
> And might be related to bug 478303.
> 
> Have you checked if the completion is correct when you select it from the
> completions side pane, instead of using the keyboard completion?

I've just tested this again and can't reproduce the issue.

I'm now on Fedora 39, Kate Version 23.08.5. Perhaps sometime between when I raised this in 2022 and now it's been fixed?

Ok to close this from my perspective.