emacs-evil / emacs-evil/evil

Weird behaviour of `evil-inner-single-quote` and `evil-inner-double-quote`.

Open
#504 6 comments 0 reactions 0 assignees View on GitHub
bug major
Dominant language
Emacs Lisp
Stars
3.9k
Forks
307
PR merge metrics
No merged PRs in 30d

Description

Originally reported by: **Ken Okada (Bitbucket: [kenoss](https://bitbucket.org/kenoss), GitHub: [kenoss](https://github.com/kenoss))**

----------------------------------------

In some cases, `evil-delete` doesn't behave like Vim. (`d i "` and `d i '`)
I think this is a bug. This (case (A) below) is originally reported by @supermomonga (on Twitter).
Thanks to him.

I dived source code and found `evil-inner-single-quote` and `evil-inner-double-quote` causes the case,
but I guess it is better you to handle it because those functions are very complicated
and there would be similar type bugs.

In the below, I show (1) buffer contents; (2) contents after `d i "` in Vim;
and (3) that in Evil. State is normal and cursor position is designated by [ ]
and buffer does not contain either the character `[` or `]`.
The case `d i '` is similar.

A correct case:

Contents:

```
foo"[h]oge"bar
```

Vim:

```
foo""bar
```

Evil:

```
foo""bar
```

Bad case (A):

Contents:

```
foo'[h]oge'bar
```

Vim: (nothing changed because there're no double quotes)

```
foo'hoge'bar
```

Evil:

```
fr
```

Bad case (B):

Contents:

```
"foo"[h]oge"bar
```

Vim:

```
"foo""bar
```

Evil: (nothing changed and have message "No quoted string found".)

```
"foo"hoge"bar
```

Bad case (C):

Contents:

```
"foo"[h]oge"bar
"fuga
```

Vim:

```
"foo""bar
"fuga
```

Evil:

```
"foo"hoge""fuga
```

Ovbiously we see that
(1) those commands in Evil are not for line wihle they are in Vim;
(2) those in Evil see match quotes.

----------------------------------------
- Bitbucket: https://bitbucket.org/lyro/evil/issue/504

Contributor guide

Open the contributing guide

Research direction

Start by inspecting evil-inner-single-quote and evil-inner-double-quote, then reproduce cases A–C in an Evil buffer using d i " and d i '. Done means the commands match Vim’s behavior: they operate within the line, select the intended quoted text, and leave the surrounding content unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
emacs, emacs-lisp
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.