Page 1 of 1
delete only word now deletes whole line
Posted: Tue Dec 22, 2015 4:08 am
by neville
In LC 7.1.1
delete word 1 of line x of fff
where line x contains only 1 word now deletes the whole line instead of leaving an empty line
put "a" & return & "b" & return & "c" into fff
delete word 1 of line 2 of fff
put fff
returns
a
c
It should return
a
c
Evidently the fix for deleting spaces around words now deletes the return.
Re: delete only word now deletes whole line
Posted: Tue Dec 22, 2015 4:44 am
by quailcreek
Try this.
Code: Select all
on mouseUp
put "a" & return & "b" & return & "c" into fff
set the itemDel to cr
delete item 1 of line 2 of fff
put fff
end mouseUp
Re: delete only word now deletes whole line
Posted: Tue Dec 22, 2015 4:49 am
by neville
Thanks Tom
workarounds are no problem - e.g. test for number of words before deleting, but it is still a bug breaking existing code
Re: delete only word now deletes whole line
Posted: Tue Dec 22, 2015 12:12 pm
by Klaus
Hi Neville,
not sure this is a bug, at least it is consistent beeahviour!
From the dictionary about "word":
...
A word is delimited by one or more spaces, tabs, or returns, or enclosed by double quotes
...
If you delete a word, then the following delimiter will also be deleted!
put "word1 word2" into tWords
delete word 1 of tWords
answer tWords
-> "word2" NO space!
Same if there is TAB following word1 AND thus a following CR!
Best
Klaus
Re: delete only word now deletes whole line
Posted: Tue Dec 22, 2015 5:30 pm
by jacque
I can see both rationales, but if it breaks old code then it's a regression bug at the least. I'd report it and let the team decide.
Re: delete only word now deletes whole line
Posted: Tue Dec 22, 2015 11:03 pm
by neville
It has been confirmed by the LC team as a bug. Note that deleting the last word of a line with two or more words does not delete the return which is correct behavior (and would be inconsistent with the "other" interpretation proposed above )