mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 14:38:32 +00:00
vim-patch:8.1.0648: custom operators can't act upon forced motion
Problem: Custom operators can't act upon a forced motion. (Christian
Wellenbrock)
Solution: Add the forced motion to the mode() result. (Christian Brabandt,
closes vim/vim#3490)
5976f8ff00
closes #8667
closes #9476
Christian Wellenbrock:
> For (most) built in text objects it's possible to force operation on
> them to be linewise, for example by using `dVab` (`:h o_V`,
> `motion_force`). When using custom text objects (defined as mappings
> by plugins for example), this doesn't currently work.
>
> Example:
>
> onoremap x viw
>
> Open a file with a few lines each containing some words. With the
> cursor on any word, try:
>
> 1. `dw` (builtin) deletes some characters
> 2. `dVw` (builtin) deletes linewise
> 3. `dx` (from mapping) deletes some characters
> 4. `dVx` (from mapping) deletes some characters, but should delete
> linewise
ref: https://github.com/wellle/targets.vim/issues/214
ref: https://gitter.im/neovim/neovim?at=5b379ff7f1664406610e7483
This commit is contained in:

committed by
Justin M. Keyes

parent
1ca2c8950f
commit
57c7e1d4a0
@@ -113,7 +113,7 @@ int get_real_state(void)
|
||||
/// @returns[allocated] mode string
|
||||
char *get_mode(void)
|
||||
{
|
||||
char *buf = xcalloc(3, sizeof(char));
|
||||
char *buf = xcalloc(4, sizeof(char));
|
||||
|
||||
if (VIsual_active) {
|
||||
if (VIsual_select) {
|
||||
@@ -160,6 +160,8 @@ char *get_mode(void)
|
||||
buf[0] = 'n';
|
||||
if (finish_op) {
|
||||
buf[1] = 'o';
|
||||
// to be able to detect force-linewise/blockwise/characterwise operations
|
||||
buf[2] = (char)motion_force;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user