Menu

#2699 [.txt delete] still deletes before startindex

obsolete: 8.5.7
open
4
2009-10-26
2009-10-26
No

Consider following code:
pack [text .t]
.t insert end foo\nbar
.t delete 2.0 end

This should only delete the second line ("bar"), and leave "foo\n" in the text. However, it actually deletes the newline too, leaving only "foo". This is wrong, since [.t delete 2.0 end] should *never* delete anything before index 2.0 !

I'm here proposing the same patch as in tracker 1854913. That one was closed with a different solution, fixing only the symptoms in interactive mode (<Delete> key deleting backwards), but not the cause.

Apparently, the proposed patch broke 'text-19.8' of the tk testsuite. In my opininion, that test is wrong. It deletes from index 4.0, and then checks that the selection tag ends at index 3.5. But it should still include the newline at the end of line 3. (Without this patch, that newline did not exist anymore!)

I've attached a file which includes the original solution for 1854913, and a patch for test-19.8.

Discussion

  • Koen Danckaert

    Koen Danckaert - 2009-10-26

    patch fixing tkText.c and text.test

     
  • Donal K. Fellows

    • labels: 319110 --> 18. [text]
    • assigned_to: hobbs --> vincentdarley
     
  • Donal K. Fellows

    • milestone: --> obsolete: 8.5.7
    • priority: 5 --> 4