On 2023-12-26, Edwin Chan wrote:
> Steps to reproduce
> 
>  1. Create a buffer with a single line of arbitrary text
>  2. Place the cursor anywhere on the line and perform any of the following
>     actions:
>     a. Press }: The cursor jumps to the end of the line
>     b. Press {: The cursor unexpectedly jumps to the end of the line
>     c. Press d, y, v, etc., followed by either } or {: The behavior is similar
>     to the two cases above
> 
> Expected behaviour
> 
> If there are multiple non-empty lines (i.e., a single paragraph) in the 
> buffer,
> } jumps to the end of the buffer and { jumps to the beginning. Therefore, {
> should similarly jump to the beginning of the buffer when there is only one
> line.
> 
> See also https://vi.stackexchange.com/q/43730 for related discussion.
> 
> Version of Vim
> 
> 8.2.2121

This bug is also in the oldest version of vim I have already
compiled, 7.2.330.

If I understand the original author's intent, then the following
patch to 9.0.2185 seems to fix it.  I may have missed something, but
I ran "make test" before and after the fix and the same tests failed
both times, so this fix doesn't break anything being tested.

Regards,
Gary


diff --git a/src/textobject.c b/src/textobject.c
index b315d0320..d4380b7cf 100644
--- a/src/textobject.c
+++ b/src/textobject.c
@@ -226,7 +226,7 @@ findpar(
     if (both && *ml_get(curr) == '}')  // include line with '}'
        ++curr;
     curwin->w_cursor.lnum = curr;
-    if (curr == curbuf->b_ml.ml_line_count && what != '}')
+    if (curr == curbuf->b_ml.ml_line_count && what != '}' && dir > 0)
     {
        char_u *line = ml_get(curr);
 

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20231227102510.GF4044%40phoenix.

Raspunde prin e-mail lui