Hi James,

On 11/19/21 17:40, James McCoy wrote:
> On Thu, Nov 18, 2021 at 01:21:53PM +0100, Alejandro Colomar wrote:
>> If you have a small file that fits in a single screen
>> (in my case, it was 38 lines, which is smaller than half a FullHD screen),
>> and
>> you delete the last lines of the file in the following way:
>>
>>      If you're going to remove from line 30 to the end,
>>      - goto line 30          30G
>>      - set visual mode       V
>>      - advance a screen      ^f
>>      - delete                d
>>      - go back a screen      ^b
> 
> I tried reproducing this by creating a 38 line file via “seq 38 > foo.txt”
> and then following your steps by running “vim --clean foo.txt”.  I saw
> no errors.
> 
> What are the dimensions of your terminal when you do this?
> “:set columns? lines?” from Vim will show this.
> 
> Can you reproduce it with the file I mentioned, or is it more specific
> to the contents you had?

I reproduced it again.
I'm not sure, when it happens and when not.

Try the following vi commands in the following file file:

vi test.c;
38G     // this should put you in the line starting with 'auto'.
V
^f
d
^b

That should reproduce the bug.

Cheers,
Alex



$ cat test.c;
// Copyright (c) 2019 by Alejandro Colomar <alx.manpa...@gmail.com>
// SPDX-License-Identifier:  LGPL-2.0-only


#ifndef INCLUDE_ALX_BASE_COMPILER_SIZE_H_
#define INCLUDE_ALX_BASE_COMPILER_SIZE_H_


#include <bsd/sys/cdefs.h>
#include <limits.h>
#include <stddef.h>
#include <sys/types.h>

#include <alx/base/assert/array.h>
#include <alx/base/compiler/cast.h>


#define ssizeof(x)               static_cast(ssize_t, sizeof(x))

#define widthof(x)               (sizeof(x) * CHAR_BIT)
#define swidthof(x)              static_cast(ssize_t, widthof(x))

#if defined(__cplusplus)
#define lengthof(arr)            std::size(arr)
#else
#define lengthof(arr)            (__arraycount((arr)) +
alx_must_be_array(arr))
#endif
#define slengthof(arr)           static_cast(ptrdiff_t, lengthof(arr))

#define ARRAY_BYTES(arr)         (sizeof((arr)[0]) * lengthof(arr))
#define ARRAY_SBYTES(arr)        static_cast(ssize_t, ARRAY_BYTES(arr))
#define ARRAY_BITS(arr)          (ARRAY_BYTES(arr) * CHAR_BIT)

#define memberof(T, f)            (((T *) NULL)->f)

#define containerof(ptr, T, f)   (                                      \
{                                                                       \
        auto  p_  = (ptr);                                              \
        void *vp_ = p_;                                                 \
                                                                        \
        static_assert(alx_is_same_type(*p_, memberof(T, f)) ||          \
                      alx_is_same_type(*p_, void));                     \
                                                                        \
        (T *) (vp_ - offsetof(T, f));                                   \
}                                                                       \
)


#endif  // INCLUDE_ALX_BASE_COMPILER_SIZE_H_



-- 
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/

Reply via email to