Re: multiple line pastes


Subject: Re: multiple line pastes
From: Matt Kraai (kraai@subdimension.com)
Date: Tue Mar 28 2000 - 12:17:41 CST


On Tue, Mar 28, 2000 at 09:48:22AM -0800, Paul Rohr wrote:
> I'd be willing to bet that the behavior you're seeing is related to the
> latter case. Consider what should happen when any of the following get
> copied to the clipboard:
>
> 1. a few words inside a single paragraph
> 2. the tail end of one paragraph and the beginning of the next
> 3. just like #2, but with an empty paragraph in the middle
> 4. the tail end, plus two full paragraphs
> 5. etc.
>
> The original implementation had one too many paragraph breaks (especially in
> case #1 above). I'm not familiar with the current logic, but there may be
> cases where we wind up with one paragraph too few.
>
> If your fix properly handles screw cases like 1-4 above, then we're all set.

The only case affected is 4. All the other cases have the old behavior
since they do not have trailing newlines. That is, in cases #1, #2,
and #3, a trailing newline is never inserted with either version of the
code.

Given the following sample:

Paragraph 1.
Paragraph 2.
Paragraph 3.
Paragraph 4.

if we copy the hypothetical string "1.\nParagraph 2.\nParagraph 3.",
then pasting this string will not include a trailing newline (as it
was before). If we copy "1.\nParagraph 2.\nParagraph 3.\n", then the
old behavior was to drop the last newline, whereas the new behavior
inserts it.

That is, if we pasted either string using the old code, or the first
string using the new code, at the beginning of Paragraph 2, we would get

Paragraph 1.
1.
Paragraph 2.
Paragraph 3.Paragraph 2.
Paragraph 3.
Paragraph 4.

Using the new code with the second copied string, we would instead get

Paragraph 1.
1.
Paragraph 2.
Paragraph 3.
Paragraph 2.
Paragraph 3.
Paragraph 4.

Yours,
 Matt



This archive was generated by hypermail 2b25 : Tue Mar 28 2000 - 12:25:25 CST