delete only word now deletes whole line

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
neville
Posts: 49
Joined: Tue Apr 15, 2008 8:37 am

delete only word now deletes whole line

Post by neville » Tue Dec 22, 2015 4:08 am

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.

quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm

Re: delete only word now deletes whole line

Post by quailcreek » Tue Dec 22, 2015 4:44 am

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

neville
Posts: 49
Joined: Tue Apr 15, 2008 8:37 am

Re: delete only word now deletes whole line

Post by neville » Tue Dec 22, 2015 4:49 am

Thanks Tom

workarounds are no problem - e.g. test for number of words before deleting, but it is still a bug breaking existing code

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: delete only word now deletes whole line

Post by Klaus » Tue Dec 22, 2015 12:12 pm

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

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: delete only word now deletes whole line

Post by jacque » Tue Dec 22, 2015 5:30 pm

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

neville
Posts: 49
Joined: Tue Apr 15, 2008 8:37 am

Re: delete only word now deletes whole line

Post by neville » Tue Dec 22, 2015 11:03 pm

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 )

Post Reply