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

hh hh at hyperhh.de
Sat Dec 8 10:06:07 EST 2018


> 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

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.



More information about the Use-livecode mailing list