Bug 375160 - Missing standard kate commands in VI mode
Summary: Missing standard kate commands in VI mode
Status: RESOLVED INTENTIONAL
Alias: None
Product: frameworks-ktexteditor
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-16 21:24 UTC by jaro
Modified: 2024-03-15 19:40 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
possible solution (834 bytes, patch)
2017-01-16 21:24 UTC, jaro
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jaro 2017-01-16 21:24:12 UTC
Created attachment 103446 [details]
possible solution

Standard kate commands (normally available via F7) are not available in VI mode.

It is also impossible to add a new command via plugin which will be visible in VI mode.

I've attached the diff with a possible solution.

Problem is visible in version 5.30.
Comment 1 Dominik Haumann 2017-01-19 20:00:41 UTC
@Simon: Does that make sense, or can that possibly interfere with other vi actions?
Comment 2 Simon St James 2017-01-19 20:07:55 UTC
Will take a look over the weekend.  In the meantime: @jaro - can you give steps to reproduce? I'll need this to form a regressoin test.
Comment 3 jaro 2017-03-29 19:31:24 UTC
Hi,
sorry for so late response.
I've wrote some simple plugin in C++ to add some additional commends.

The new commands are available in normal input mode but not visible in VI mode.

They are added to command set which is not available in VI mode.
Comment 4 Christoph Cullmann 2022-01-08 21:39:49 UTC
Hi, Jan Paul Batrina, would such a change make sense?
Comment 5 Jan Paul Batrina 2022-01-10 14:38:36 UTC
I think it makes sense since we add non-vimode commands already (https://invent.kde.org/frameworks/ktexteditor/-/blob/master/src/vimode/emulatedcommandbar/commandmode.cpp#L46), and excluding some (e.g. the char command) would be an annoying inconsistency since switching to non-vimode will be needed just to access those kate commands.

For conflicting commands, I think it would be safer to prefer the vimode versions if present. That means in the attached patch, I think that the kate commands should be added BEFORE the vimode commands since commands with the same string will overwrite the previous command (https://invent.kde.org/frameworks/ktexteditor/-/blob/master/src/vimode/emulatedcommandbar/commandmode.cpp#L60.

I haven't checked yet if `KateCmd::self()->commands()` has commands that have already been added by the previous cmds.push_back calls.
Comment 6 Christoph Cullmann 2022-09-24 21:55:42 UTC
(In reply to Jan Paul Batrina from comment #5)
> I think it makes sense since we add non-vimode commands already
> (https://invent.kde.org/frameworks/ktexteditor/-/blob/master/src/vimode/
> emulatedcommandbar/commandmode.cpp#L46), and excluding some (e.g. the char
> command) would be an annoying inconsistency since switching to non-vimode
> will be needed just to access those kate commands.
> 
> For conflicting commands, I think it would be safer to prefer the vimode
> versions if present. That means in the attached patch, I think that the kate
> commands should be added BEFORE the vimode commands since commands with the
> same string will overwrite the previous command
> (https://invent.kde.org/frameworks/ktexteditor/-/blob/master/src/vimode/
> emulatedcommandbar/commandmode.cpp#L60.
> 
> I haven't checked yet if `KateCmd::self()->commands()` has commands that
> have already been added by the previous cmds.push_back calls.

Are you interested in working on this?
Comment 7 Christoph Cullmann 2024-03-15 19:40:28 UTC
That is not totally trivial, if we add all commands, we need to ensure we handle the removal of them, too. Otherwise we will later work on invalid pointers.

If someone has time to work an this, patches are welcome.

https://kate-editor.org/join-us/