delete only word now deletes whole line
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
delete only word now deletes whole line
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.
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.
-
- Posts: 746
- Joined: Sun Feb 04, 2007 11:01 pm
Re: delete only word now deletes whole line
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
Tom
MacBook Pro OS Mojave 10.14
MacBook Pro OS Mojave 10.14
Re: delete only word now deletes whole line
Thanks Tom
workarounds are no problem - e.g. test for number of words before deleting, but it is still a bug breaking existing code
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
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
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
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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: delete only word now deletes whole line
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 )