Bug 334032 - Autocompletion should be disabled when recording a macro or it should be taken into account
Summary: Autocompletion should be disabled when recording a macro or it should be take...
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: Vi Input Mode (show other bugs)
Version: 3.13.0
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-28 15:51 UTC by Giacomo Alzetta
Modified: 2021-01-02 14:11 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 Giacomo Alzetta 2014-04-28 15:51:34 UTC
Currently when recording a macro using Vi mode's q command autocompletion is triggered.
I believe this disrupts the user experience because using code completion will result in incorrect macros.

For example opening a new file in Vi normal mode and typing exactly the following (special keys/events between < and >):

iHello<Enter><Esc>qaiHel<trigger-autocompletion><Enter><Esc>q@a

Results in the output file:

Hello
Hello
Hel

Instead of the expected:

Hello
Hello
Hello


Either autocompletion shouldn't be triggered, which would force the user to actually enter manually exactly what it should do, or it should be recorded as well.

Currently the autocompletion pop ups and if triggered you have to remember to double-type what was inserted by it. If you have to record a long macro the final output can be significantly different from what you intended.

Note: this would also improve Kile since Kile automatically adds closing environment commands without asking for a confirmation. This is troublesome because *even remembering to double type everything* something gets messed up and often the closing braces and some newlines don't get recorded.
Comment 1 Miquel Sabaté 2014-04-28 17:01:40 UTC
Your example works for me both in the KDE/4.13 branch and in the master branch. Could you provide another example, or an example of this issue in Kile ? Thanks !
Comment 2 Giacomo Alzetta 2014-04-28 18:28:49 UTC
What do you mean by "work"? that you obtain the expected Hellox3 file? I'm using Kate 3.13.0 on KDE SC 4.13 that comes with Kubuntu 14.04. Kile v 2.1.3 that comes with Kubuntu.

Anyway, the bug I mentioned about Kile is the following.

Try the following in a blank file in Normal Mode:

qai\begin{figure}<Enter><Backspace>\end{figure}<Enter><Esc>q

This is what I see on the file after finishing recording the macro:

\begin{figure}
\end{figure}

\end{figure}


The final \end{figure} was added automatically by Kile and I has two manually type the first \end{figure}. If I don't type \end{figure} then it is as if it didn't exist.

Now putting the cursor at the end of the file and calling @a to run the macro outputs this:

\begin{figure\end{figure}


Note missing: }<Enter>

It just occurred to me that it seems like the <Backspace> is deleting the newline *and* the preceding character. I cannot reproduce this using only Kate.

(I just realized that I shouldn't actually press <Backspace> because, since the indent was added automatically it isn't really recorded. However this still doesn't explain why the } is deleted.)

For example trying to achieve the same result with Kate's autoindent the backspace behaves properly, only removing the indentation space. (This is odd. Is Kile doing autocompletion in a different way?)

Anyway what is really annoying is the fact that when I write: \begin{figure}<Enter> it gets autocompleted but the autocompletion is useless as far as the macro is interested. It only adds clutter that I then have to keep in mind.

For example: suppose I want to record a macro that inserts \begin{figure}<Enter> and then goes down two lines and does other things, while I'm recording this I'd have an \end{figure} in the mid of the text I'm modifying but it isn't really there! If autocompletion etc. gets triggered automatically several times it's easy to obtain a big mess of text that does not resemble what the macro has really recorded.
Comment 3 Miquel Sabaté 2014-04-28 19:07:26 UTC
Hi there. Yes, the Hellox3 example works as expected for me :) I'm using Kate (master), but it's also working for me in the KDE/4.13 branch (that is, the one that contains the future Kate 3.13.1 version).

Anyways, I can reproduce your example in Kile and yes, this is a bug. However, I'm not sure whether this is a bug from the katepart side or if Kile is doing something wrong here. I'll have to investigate more about this. By now, I'll mark this bug report as "confirmed", since I can reproduce your example for Kile. I'll take a look at this as soon as possible. Thanks for the report!
Comment 4 Matt Scheirer 2019-05-26 14:51:19 UTC
Reaffirming autocompletes still aren't recorded still as of 19.04.
Comment 5 Bug Janitor Service 2020-12-25 12:45:07 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/52
Comment 6 Christoph Cullmann 2021-01-02 14:11:03 UTC
Git commit 1cf7dfe39e778a742b8fb8a18c88e1e15f7b5b07 by Christoph Cullmann, on behalf of Jan Paul Batrina.
Committed on 02/01/2021 at 14:10.
Pushed by cullmann into branch 'master'.

[Vimode] Fix Macro Completion Replay

Ctrl-Space input events are caught by KateViewInternal::eventFilter as a QEvent::ShortcutOverride (and not as a QEvent::KeyPress) so it never reaches InsertVimode::handleKeyPress which is where the completion replay is triggered.

M  +9    -0    src/view/kateviewinternal.cpp

https://invent.kde.org/frameworks/ktexteditor/commit/1cf7dfe39e778a742b8fb8a18c88e1e15f7b5b07