Coder Social home page Coder Social logo

Comments (6)

jolmg avatar jolmg commented on May 28, 2024

Checked a vim version 8.0.197 from 2017 and there the bug wasn't present, so this has apparently not been around forever.

from vim.

jolmg avatar jolmg commented on May 28, 2024

Seems it got introduced here (#7527):

commit 032a2d050b82b146d70d6ff714838ee62c07d8ad
Author: Bram Moolenaar <[email protected]>
Date:   Tue Dec 22 17:59:35 2020 +0100

    patch 8.2.2189: cannot repeat a command that uses the small delete register
    
    Problem:    Cannot repeat a command that uses the small delete register.
    Solution:   Store the register name instead of the contents. (Christian
                Brabandt, closes #7527)

 src/ops.c                      |  2 +-
 src/register.c                 |  9 ++++++++-
 src/testdir/test_registers.vim | 11 +++++++++++
 src/version.c                  |  2 ++
 4 files changed, 22 insertions(+), 2 deletions(-)

from vim.

chrisbra avatar chrisbra commented on May 28, 2024

intersting that it wasn't noticed earlier. It also seems to affect i_Ctrl-R_Ctrl-O and i_Ctrl-R_Ctrl-P

from vim.

chrisbra avatar chrisbra commented on May 28, 2024

Is it okay, if we allow this only for actual insert mode?

diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt
index 8696e912f..31abe7d94 100644
--- a/runtime/doc/insert.txt
+++ b/runtime/doc/insert.txt
@@ -1,4 +1,4 @@
-*insert.txt*    For Vim version 9.0.  Last change: 2022 Sep 30
+*insert.txt*    For Vim version 9.0.  Last change: 2022 Dec 30


                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -131,7 +131,8 @@ CTRL-R {register}                           *i_CTRL-R*
                        '-'     the last small (less than a line) delete
                                register. This is repeatable using |.| since
                                it remembers the register to put instead of
-                               the literal text to insert.
+                               the literal text to insert. (not repeatable
+                               in |Replace-mode|)
                                                        *i_CTRL-R_=*
                        '='     the expression register: you are prompted to
                                enter an expression (see |expression|)
@@ -162,6 +163,7 @@ CTRL-R CTRL-R {register}                    *i_CTRL-R_CTRL-R*
                typed.
                After this command, the '.' register contains the text from
                the register as if it was inserted by typing it.
+               Not supported in |Replace-mode|.

 CTRL-R CTRL-O {register}                       *i_CTRL-R_CTRL-O*
                Insert the contents of a register literally and don't
@@ -173,7 +175,7 @@ CTRL-R CTRL-O {register}                    *i_CTRL-R_CTRL-O*
                typed.
                After this command, the '.' register contains the command
                typed and not the text. I.e., the literals "^R^O" and not the
-               text from the register.
+               text from the register.  Not supported in |Replace-mode|.

 CTRL-R CTRL-P {register}                       *i_CTRL-R_CTRL-P*
                Insert the contents of a register literally and fix the
@@ -183,7 +185,7 @@ CTRL-R CTRL-P {register}                    *i_CTRL-R_CTRL-P*
                typed.
                After this command, the '.' register contains the command
                typed and not the text. I.e., the literals "^R^P" and not the
-               text from the register.
+               text from the register.  Not supported in |Replace-mode|.

                                                *i_CTRL-T*
 CTRL-T         Insert one shiftwidth of indent at the start of the current
diff --git a/src/edit.c b/src/edit.c
index 9435fd6fc..4087aba93 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -3436,7 +3436,8 @@ ins_reg(void)
     else
     {
 #endif
-       if (literally == Ctrl_O || literally == Ctrl_P)
+       if ((literally == Ctrl_O || literally == Ctrl_P)
+               && !(State & REPLACE_FLAG))
        {
            // Append the command to the redo buffer.
            AppendCharToRedobuff(Ctrl_R);
diff --git a/src/register.c b/src/register.c
index 1d0e46bd0..0f92b0084 100644
--- a/src/register.c
+++ b/src/register.c
@@ -826,7 +826,7 @@ insert_reg(
        {
            for (i = 0; i < y_current->y_size; ++i)
            {
-               if (regname == '-')
+               if (regname == '-' && !(State & REPLACE_FLAG))
                {
                    AppendCharToRedobuff(Ctrl_R);
                    AppendCharToRedobuff(regname);

from vim.

errael avatar errael commented on May 28, 2024

Is it okay, if we allow this only for actual insert mode?

You could have always said "... at least for now?" But it's nice to see the honesty;-)

from vim.

chrisbra avatar chrisbra commented on May 28, 2024

yeah 🙈, But seriously it seems tricky to get number of characters right, that need to be deleted, for the small delete register this seems doable, but for i_Ctrl-R_Ctrl-P (which needs to re-indent, this will be harder).

And I don't remember for how long we have i_Ctrl-R_Ctrl-P (it's longer than the mentioned small delete change) and still nobody has noticed and complained about it until now.

from vim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.