#610 {forward,backward}_paragraph() broken with multi blank lines

release
open-accepted
nobody
Program (402)
5
2008-01-16
2008-01-12
Bert Wesarg
No

please try the following:

open a file with this content:

-----cut-----
1

2

3

4

5

6
-----cut-----

now position the cursor at the beginning of line 1 and consecutively press Ctrl+Down till the end of the file.
All looks good.

Now press Ctrl+Up: but the cursor takes a break on the empty line 2.

now change the file to:

-----cut-----
1

2

3

4

5

6
-----cut-----

and place the cursor again at the first line, than do the same thing as above: downward the cursor is placed before the paragraph line and upward at booth lines, the paragraph line itself and the enlty line before the paragraph and in the empty line after the first paragraph.

last test:

-----cut-----
1

2

3

4

5

6
-----cut-----

the cursor takes now the middle of the empty lines as a 'paragraph'. and up two lines in front of each paragraph.

Discussion

  • Thorsten Haude
    Thorsten Haude
    2008-01-13

    • labels: --> Program
    • milestone: --> release
    • status: open --> open-accepted
     
  • Thorsten Haude
    Thorsten Haude
    2008-01-13

    Logged In: YES
    user_id=119143
    Originator: NO

    Confirmed with Grandfather:

    NEdit Version 5.1.1
    March 17, 2000

     
  • Bert Wesarg
    Bert Wesarg
    2008-01-15

     
    Attachments
  • Bert Wesarg
    Bert Wesarg
    2008-01-15

    Logged In: YES
    user_id=122956
    Originator: YES

    first patch:

    the only change that may be not wanted is this: if the cursor is in the first line of a paragraph, but not at the beginning, a backward_paragraph() goes to the prev paragraph, not to the beginning of the current.
    File Added: fix-paragraph.patch

     
  • Bert Wesarg
    Bert Wesarg
    2008-01-16

    Logged In: YES
    user_id=122956
    Originator: YES

    second patch (actually patch series):

    patch 1: extended-paragraph.patch

    this uses a state machine like algorithm, which brings also back the lost behavior (which is imho a bug by itself) from the first patch
    File Added: extended-paragraph.patch

     
  • Bert Wesarg
    Bert Wesarg
    2008-01-16

    • summary: strange ctrl+up/down behavior --> {forward,backward}_paragraph() broken with multi blank lines
     
  • Bert Wesarg
    Bert Wesarg
    2008-01-16

    Logged In: YES
    user_id=122956
    Originator: YES

    patch 2: extended-paragraph-end.patch

    this extends the two functions with the "end" argument. which changes the 'jump-point' to the end of the paragraph, i.e. the first blank line after a paragraph
    File Added: extended-paragraph-end.patch

     
  • Bert Wesarg
    Bert Wesarg
    2008-01-16

    Logged In: YES
    user_id=122956
    Originator: YES

    patch 3: extended-paragraph-any.patch

    this extends the two functions with the "any" argument, which is mutual exclusive with the "end" argument and uses both 'jump-points' of a paragraph, i.e. the first line of a paragraph and the first blank line after a paragraph

    File Added: extended-paragraph-any.patch

     
  • Bert Wesarg
    Bert Wesarg
    2008-01-17

    Logged In: YES
    user_id=122956
    Originator: YES

    upload corrected extended-paragraph-any.patch
    File Added: extended-paragraph-any.patch

     
  • Bert Wesarg
    Bert Wesarg
    2008-01-19

    Logged In: YES
    user_id=122956
    Originator: YES

    found a small bug, if a file has no terminating new line.
    File Added: extended-paragraph.patch

     
  • Bert Wesarg
    Bert Wesarg
    2008-01-19

    Logged In: YES
    user_id=122956
    Originator: YES

    documentation added
    File Added: extended-paragraph-end.patch

     
  • Bert Wesarg
    Bert Wesarg
    2008-01-19

    Logged In: YES
    user_id=122956
    Originator: YES

    documentation added
    File Added: extended-paragraph-any.patch

     
  • Bert Wesarg
    Bert Wesarg
    2008-01-20

    Logged In: YES
    user_id=122956
    Originator: YES

    uploaded old version again, sorry
    File Added: extended-paragraph.patch

     
  • Bert Wesarg
    Bert Wesarg
    2008-01-20