Re: Show invisible characters (tab, space, return) in field

2018-12-09 Thread hh via use-livecode
> Kaveh wrote:
> You are right. It's getting complicated :-) So why does 200A allow
> wrapping and 200B does not? 

Perhaps a team member can come in? And corrects this/explains this better:

0x200B is probably not in LC's word-break table (for word wrapping)
because it is usually used to indicate optional hyphenation locations.
And there is no hyphenation in LC's field implementation. So it would
be wrong to add this to the (full-)word-break table.

And the hair space (0x200A) is, of course, of advantage against a space
only if you don't use a fixed-width font.

> > > Kaveh wrote: 
> > > There is a also a zero width character. :-) that is 200B. 
> > > So using a monospace font all chars line up. 
> >
> > This works if and only if your field has dontWrap true, else your 
> > line will not (soft-)break at the new "spaces" between the words. 


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Show invisible characters (tab, space, return) in field

2018-12-09 Thread Kaveh Bazargan via use-livecode
On Sat, 8 Dec 2018 at 21:26, hh via use-livecode <
use-livecode@lists.runrev.com> wrote:

> > Kaveh wrote:
> > There is a also a zero width character. :-) that is 200B.
> > So using a monospace font all chars line up.
>
> This works if and only if your field has dontWrap true, else your
> line will not (soft-)break at the new "spaces" between the words.
>
>
You are right. It's getting complicated :-) So why does 200A allow wrapping
and 200B does not?


> But then (if dontWrap is true) you don't need any additional word-break
> char, you could then simply use the middot numToCodePoint(0x00B7) instead
> of space.
>
> > hh wrote:
> > ... The zero width space is non word-breaking in LC and an opportunity
> of word
> > breaking elsewhere...
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


-- 
Kaveh Bazargan
Director
River Valley Technologies  • Twitter
 • LinkedIn

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Show invisible characters (tab, space, return) in field

2018-12-08 Thread hh via use-livecode
> Kaveh wrote:
> There is a also a zero width character. :-) that is 200B.
> So using a monospace font all chars line up.

This works if and only if your field has dontWrap true, else your
line will not (soft-)break at the new "spaces" between the words.

But then (if dontWrap is true) you don't need any additional word-break
char, you could then simply use the middot numToCodePoint(0x00B7) instead
of space.

> hh wrote:
> ... The zero width space is non word-breaking in LC and an opportunity of word
> breaking elsewhere...


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Show invisible characters (tab, space, return) in field

2018-12-08 Thread Kaveh Bazargan via use-livecode
Hi Hermann

There is a also a zero width character. :-) that is 200B. So using a
monospace font all chars line up.

And even more interesting, when I press the backspace key, it generally
treats the composite pair as one character, so jumps back over both with
one backspace!!

On Sat, 8 Dec 2018 at 16:28, Kaveh Bazargan <
ka...@rivervalleytechnologies.com> wrote:

>
>
> On Sat, 8 Dec 2018 at 16:00, hh via use-livecode <
> use-livecode@lists.runrev.com> wrote:
>
>> You could moreover add the following to the field's script.
>>
>> on rawkeyup k
>>   switch k
>> case 65288 -- backspace
>>   put word 4 of the selectedChunk into cx
>>   if char cx of me is among the items of \
>>
>> (numToCodePoint(0x23CE),numToCodePoint(0x21E5),numToCodePoint(0x00B7))
>>   then delete char cx of me
>>   break
>> case 65535 -- forward delete
>>   put word 2 of the selectedChunk into cx
>>   if char cx of me is among the items of
>> (numToCodePoint(0x200A),cr,tab)
>>   then delete char cx of me
>>   break
>> default
>>   pass rawkeyup
>>   end switch
>> end rawkeyUp
>>
>> There is still more to do, e.g. when typing after a return symbol...
>> Hope you are (as I did) sharing your working edit code when done.
>>
>
> I have a long way to go before I have anything useful as I am still trying
> to grasp the excellent information. But of course I will share if I have
> anything to add to these.
>
> --
> Kaveh Bazargan
> Director
> River Valley Technologies  • Twitter
>  • LinkedIn
> 
>


-- 
Kaveh Bazargan
Director
River Valley Technologies  • Twitter
 • LinkedIn

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Show invisible characters (tab, space, return) in field

2018-12-08 Thread Kaveh Bazargan via use-livecode
On Sat, 8 Dec 2018 at 16:00, hh via use-livecode <
use-livecode@lists.runrev.com> wrote:

> You could moreover add the following to the field's script.
>
> on rawkeyup k
>   switch k
> case 65288 -- backspace
>   put word 4 of the selectedChunk into cx
>   if char cx of me is among the items of \
>
> (numToCodePoint(0x23CE),numToCodePoint(0x21E5),numToCodePoint(0x00B7))
>   then delete char cx of me
>   break
> case 65535 -- forward delete
>   put word 2 of the selectedChunk into cx
>   if char cx of me is among the items of
> (numToCodePoint(0x200A),cr,tab)
>   then delete char cx of me
>   break
> default
>   pass rawkeyup
>   end switch
> end rawkeyUp
>
> There is still more to do, e.g. when typing after a return symbol...
> Hope you are (as I did) sharing your working edit code when done.
>

I have a long way to go before I have anything useful as I am still trying
to grasp the excellent information. But of course I will share if I have
anything to add to these.

-- 
Kaveh Bazargan
Director
River Valley Technologies  • Twitter
 • LinkedIn

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Show invisible characters (tab, space, return) in field

2018-12-08 Thread hh via use-livecode
> Kaveh wrote:
> On the live conversion, you are adding a unicode character before
> a space, say. That means two characters and therefore two character
> widths. Is there a way of making spaces zero width, or the new characters
> overlapping the space etc? Ideally I want the text widths of lines to be
> the same with and without the visible chars.

No. I don't replace a space with a unicode char and a space but with a
unicode char and *the smallest word-breaking space in unicode (hair space)*.

You could try to use an accent to a space but this isn't word breaking any
more.

The zero width space is non word-breaking in LC and an opportunity of word
breaking elsewhere.
What you should have also in mind with these solutions is that it must be
clear for the user what he is selecting, so inserting zero width chars will
make selecting random down to 2 chars.

The only char with a negative space in unicode I know of is the
MONGOLIAN VOWEL SEPARATOR, see http://jkorpela.fi/chars/spaces.html
All these spaces are possible if someone copies text from a UTF-8 web page
and pastes into your field!!

As you don't have access to a word break table you have to write your own
word-breaking algorithm ...



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Show invisible characters (tab, space, return) in field

2018-12-08 Thread hh via use-livecode
You could moreover add the following to the field's script.

on rawkeyup k
  switch k
case 65288 -- backspace
  put word 4 of the selectedChunk into cx
  if char cx of me is among the items of \

(numToCodePoint(0x23CE),numToCodePoint(0x21E5),numToCodePoint(0x00B7))
  then delete char cx of me
  break
case 65535 -- forward delete
  put word 2 of the selectedChunk into cx
  if char cx of me is among the items of (numToCodePoint(0x200A),cr,tab)
  then delete char cx of me
  break
default
  pass rawkeyup
  end switch
end rawkeyUp

There is still more to do, e.g. when typing after a return symbol...
Hope you are (as I did) sharing your working edit code when done.

> > Kaveh wrote:
> > I need the user to edit as normal and with normal functionality but see the 
> > normally
> > invisible characters. So seems I would need a native solution. :-(
> 
> This works for me (TMHO, this demonstrates the beauty of LC).
> Script your field with the following.
> 
> on rawkeyDown k
>   switch k
>case 32 -- space
>   put numToCodePoint(0x00B7)(0x200A) into the selection
>   break
> case 65293 -- return
>   put numToCodePoint(0x23CE) into the selection
>   break
>  case 65289 -- tab
>   -- put tab(0x21E5) into the selection -- alternate
>   put numToCodePoint(0x21E5) into the selection
>   break
> default
>   pass rawkeydown
>   end switch
> end rawkeyDown

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Show invisible characters (tab, space, return) in field

2018-12-08 Thread Kaveh Bazargan via use-livecode
Thank you for spending the time on this. Like all your posts it is an
education! Great idea to convert just a visible part of text! I am going to
study well and work on this.

On the live conversion, you are adding a unicode character before a space,
say. That means two characters and therefore two character widths. Is there
a way of making spaces zero width, or the new characters overlapping the
space etc? Ideally I want the text widths of lines to be the same with and
without the visible chars.

On Sat, 8 Dec 2018 at 15:06, hh via use-livecode <
use-livecode@lists.runrev.com> wrote:

> > Kaveh wrote:
> > I need the user to edit as normal and with normal functionality but see
> the normally
> > invisible characters. So seems I would need a native solution. :-(
>
> This works for me (TMHO, this demonstrates the beauty of LC).
> Script your field with the following.
>
> on rawkeyDown k
>   switch k
>case 32 -- space
>   put numToCodePoint(0x00B7)(0x200A) into the selection
>   break
> case 65293 -- return
>   put numToCodePoint(0x23CE) into the selection
>   break
>  case 65289 -- tab
>   -- put tab(0x21E5) into the selection -- alternate
>   put numToCodePoint(0x21E5) into the selection
>   break
> default
>   pass rawkeydown
>   end switch
> end rawkeyDown
>
> For converting the whole field *or a visible part of it* (you could use a
> check button)
> use the replace-script of my last post. For a few lines (< 500), put into
> a temporary
> field, conversion preserving styles is still fast.
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


-- 
Kaveh Bazargan
Director
River Valley Technologies  • Twitter
 • LinkedIn

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Show invisible characters (tab, space, return) in field

2018-12-08 Thread hh via use-livecode
> Kaveh wrote:
> I need the user to edit as normal and with normal functionality but see the 
> normally
> invisible characters. So seems I would need a native solution. :-(

This works for me (TMHO, this demonstrates the beauty of LC).
Script your field with the following.

on rawkeyDown k
  switch k
   case 32 -- space
  put numToCodePoint(0x00B7)(0x200A) into the selection
  break
case 65293 -- return
  put numToCodePoint(0x23CE) into the selection
  break
 case 65289 -- tab
  -- put tab(0x21E5) into the selection -- alternate
  put numToCodePoint(0x21E5) into the selection
  break
default
  pass rawkeydown
  end switch
end rawkeyDown

For converting the whole field *or a visible part of it* (you could use a check 
button)
use the replace-script of my last post. For a few lines (< 500), put into a 
temporary
field, conversion preserving styles is still fast.
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Show invisible characters (tab, space, return) in field

2018-12-08 Thread hh via use-livecode
> Kaveh wrote:
> What I am looking for is a native replacement of a return, say,
> with a visible characters wherever it appears. 

You have to replace return with  if you wish
to preserve the line breaks.

Similarly
• have you to replace space with  if you wish
to preserve the word breaks,
• have you to replace tab with  if you wish
to preserve the indents.

You could use unicodeChars for such a making of "whitespace" visible.
If you do it in a variable this is very fast, slower but still fast
for making such "whitespace" (space, tab, return) again invisible.

Of course this removes any styling from the variable. If you need to
preserve styles then you could try
"replace in field  styles".
But then it becomes very slow.

Here the fast unicode-symbols-in-variable method. It has moreover the
advantage that you can copy and paste such "visible-whitespace-text".

on mouseUp b
  put the millisecs into m1
  lock screen; lock messages
  put fld 1 into txt
  put numToCodePoint(0x00B7)(0x200A) into s0
  put numToCodePoint(0x23CE) into c0
  put numToCodePoint(0x21E5) into t0
  if b=3 then
replace tab with t0 in txt
replace cr with c0 in txt
replace space with s0 in txt
  else
replace s0 with space in txt
replace c0 with cr in txt
replace t0 with tab in txt
  end if
  put txt into fld 1
  put the millisecs - m1 into fld "timing"
end mouseUp

Note.
The above is *VERY* basic. Your text could also contain other variants
of tabs (right, left ...), spaces (unicode spaces, e.g. non-breaking)
and returns (mixed LF/CR, paragraph signs).




___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Show invisible characters (tab, space, return) in field

2018-12-08 Thread Kaveh Bazargan via use-livecode
Thank you. Did not know about that. It works, but seems for a specific char
or chars.

I have tried:

on mouseup
   lock screen
   repeat with i = 1 to the number of chars of fld "text"
  if char i of fld "text" is return then
 set the imagesource of char i of fld "text" to "myreturn"
  end if
   end repeat
end mouseup

but of course it is slow and would be slower if I want to replace spaces.

Additionally, if I cut and pasted in the field I need to replace the chars
in the pasted text again...

What I am looking for is a native replacement of a return, say, with a
visible characters wherever it appears.

On Sat, 8 Dec 2018 at 01:26, Paul Dupuis via use-livecode <
use-livecode@lists.runrev.com> wrote:

> You can set the imageSource of the non-printing characters. They will
> remain spaces, tabs, and returns, but can have a small image (you will
> have to make or find) displayed in their place. See imageSource in the
> Dictionary.
>
> set the imageSource of character to {imageID |imageName |imageURL |empty}
>
>
> On 12/7/2018 8:12 PM, Kaveh Bazargan via use-livecode wrote:
> > Thanks Bob. I did mean non-printing characters. I think just space, tab
> and
> > return.
> >
> > The problem with replacing with with a character is that of course it is
> > not a space any more, so text would not wrap as normal. I need the user
> to
> > edit as normal and with normal functionality but see the normally
> invisible
> > characters. So seems I would need a native solution. :-(
> >
> > On Sat, 8 Dec 2018 at 00:22, Bob Sneidar via use-livecode <
> > use-livecode@lists.runrev.com> wrote:
> >
> >> Not natively. You would have to replace every non-printing character
> >> (that's what you mean by invisible I suppose) with a square digbat or
> >> something. If you want to filter for only printable characters, I have a
> >> function that dies that, and also there are regex strings for that sort
> of
> >> thing.
> >>
> >> Bob S
> >>
> >>
> >>> On Dec 7, 2018, at 15:44 , Kaveh Bazargan via use-livecode <
> >> use-livecode@lists.runrev.com> wrote:
> >>> Is there any way of seeing invisible characters in a text field,
> similar
> >> to
> >>> the view in text editors and word processors?
> >>>
> >>> --
> >>> Kaveh Bazargan
> >>
> >> ___
> >> use-livecode mailing list
> >> use-livecode@lists.runrev.com
> >> Please visit this url to subscribe, unsubscribe and manage your
> >> subscription preferences:
> >> http://lists.runrev.com/mailman/listinfo/use-livecode
> >>
> >
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


-- 
Kaveh Bazargan
Director
River Valley Technologies  • Twitter
 • LinkedIn

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Show invisible characters (tab, space, return) in field

2018-12-07 Thread Paul Dupuis via use-livecode
You can set the imageSource of the non-printing characters. They will 
remain spaces, tabs, and returns, but can have a small image (you will 
have to make or find) displayed in their place. See imageSource in the 
Dictionary.


set the imageSource of character to {imageID |imageName |imageURL |empty}


On 12/7/2018 8:12 PM, Kaveh Bazargan via use-livecode wrote:

Thanks Bob. I did mean non-printing characters. I think just space, tab and
return.

The problem with replacing with with a character is that of course it is
not a space any more, so text would not wrap as normal. I need the user to
edit as normal and with normal functionality but see the normally invisible
characters. So seems I would need a native solution. :-(

On Sat, 8 Dec 2018 at 00:22, Bob Sneidar via use-livecode <
use-livecode@lists.runrev.com> wrote:


Not natively. You would have to replace every non-printing character
(that's what you mean by invisible I suppose) with a square digbat or
something. If you want to filter for only printable characters, I have a
function that dies that, and also there are regex strings for that sort of
thing.

Bob S



On Dec 7, 2018, at 15:44 , Kaveh Bazargan via use-livecode <

use-livecode@lists.runrev.com> wrote:

Is there any way of seeing invisible characters in a text field, similar

to

the view in text editors and word processors?

--
Kaveh Bazargan


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode






___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Show invisible characters (tab, space, return) in field

2018-12-07 Thread Kaveh Bazargan via use-livecode
Thanks Bob. I did mean non-printing characters. I think just space, tab and
return.

The problem with replacing with with a character is that of course it is
not a space any more, so text would not wrap as normal. I need the user to
edit as normal and with normal functionality but see the normally invisible
characters. So seems I would need a native solution. :-(

On Sat, 8 Dec 2018 at 00:22, Bob Sneidar via use-livecode <
use-livecode@lists.runrev.com> wrote:

> Not natively. You would have to replace every non-printing character
> (that's what you mean by invisible I suppose) with a square digbat or
> something. If you want to filter for only printable characters, I have a
> function that dies that, and also there are regex strings for that sort of
> thing.
>
> Bob S
>
>
> > On Dec 7, 2018, at 15:44 , Kaveh Bazargan via use-livecode <
> use-livecode@lists.runrev.com> wrote:
> >
> > Is there any way of seeing invisible characters in a text field, similar
> to
> > the view in text editors and word processors?
> >
> > --
> > Kaveh Bazargan
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


-- 
Kaveh Bazargan
Director
River Valley Technologies  • Twitter
 • LinkedIn

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Show invisible characters (tab, space, return) in field

2018-12-07 Thread Bob Sneidar via use-livecode
Not natively. You would have to replace every non-printing character (that's 
what you mean by invisible I suppose) with a square digbat or something. If you 
want to filter for only printable characters, I have a function that dies that, 
and also there are regex strings for that sort of thing. 

Bob S


> On Dec 7, 2018, at 15:44 , Kaveh Bazargan via use-livecode 
>  wrote:
> 
> Is there any way of seeing invisible characters in a text field, similar to
> the view in text editors and word processors?
> 
> -- 
> Kaveh Bazargan


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode