[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: "dt" doesn't work correctly in vi mode
From: |
Chet Ramey |
Subject: |
Re: "dt" doesn't work correctly in vi mode |
Date: |
Tue, 4 Apr 2023 15:11:31 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 |
On 4/4/23 3:18 AM, Emanuele Torre wrote:
Bash Version: 5.2
Patch Level: 15
Release Status: maint
When the prompt contains abcjefgjjhij123 , and the cursor is before
the third j, and i press dtj, nothing will be deleted.
Thanks for the report. I assume you mean the second j, since the examples
below show that.
(^ cursor)
abcjefg^jjhij123
dtj
abcjefg^jjhij123
dtj
abcjefg^jjhij123
The correct vi behaviour would be to delete the j after the cursor:
I forgot how many special cases you have to account for in vi. In this one,
the motion command (`tj') doesn't move the cursor at all, so it's a no-op
when issued individually, but when issued as a motion command with commands
like `c' or `d', it has to consume at least one character. There was
already a special case in there for c/C, so it looks like d/D will need one
as well, and probably y/Y.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/