evil icon indicating copy to clipboard operation
evil copied to clipboard

Visual selection clipped to 250000 characters in file with long lines

Open bcc32 opened this issue 1 year ago • 0 comments

Issue type

  • Bug report

Environment

Emacs version: GNU Emacs 30.1.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.15.12, Xaw scroll bars) of 2025-02-24 Operating System: Rocky Linux 8.10 (Green Obsidian) Evil version: Evil version 1.15.0 Evil installation type: NonGNU ELPA Graphical/Terminal: Graphical Tested in a make emacs session (see CONTRIBUTING.md): Yes

Reproduction steps

  • Start Emacs (make emacs)

  • Open a file with very long lines. I started with a 15MB or so text file with large tables. Maybe some large CSV would work here.

    I believe it is sufficient to use a file where (long-line-optimizations-p) would return non-nil and whose size is greater than 500000 characters.

  • C-x h y

  • In a new empty buffer, press p

Expected behavior

The whole first file's contents should be pasted into the new buffer.

After C-x h is pressed in the first buffer, (region-end) returns 250,001.

Actual behavior

Only the first 250,000 characters are copied.

After C-x h is pressed in the first buffer, (region-end) should return the number of characters in the file, plus one.

Further notes

Moving the selection around and trying to expand it by hand does not help; the size of the selection stays consistently around 250,000 characters even as the bounds move forward and back through the buffer.

long-line-optimizations-region-size defaults to 500,000. According to its docstring, for buffers where (long-line-optimizations-p) is non-nil, pre-command-hook and post-command-hook are executed on a narrowed buffer, whose narrowed region size is specified by this variable.

However, just setting this variable to avoid the restriction seems to be not recommended, according to its docstring.

bcc32 avatar Feb 25 '25 19:02 bcc32