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

hh hh at hyperhh.de
Sat Dec 8 10:59:47 EST 2018


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)&numToCodePoint(0x200A) into the selection
>       break
>     case 65293 -- return
>       put numToCodePoint(0x23CE)&cr into the selection
>       break
>      case 65289 -- tab
>       -- put tab&numToCodePoint(0x21E5) into the selection -- alternate
>       put numToCodePoint(0x21E5)&tab into the selection
>       break
>     default
>       pass rawkeydown
>   end switch
> end rawkeyDown




More information about the use-livecode mailing list