Safe tab characters in template nodes?

When I got back from vacation, I noticed my flows had reverted to some older version. I found the latest version in .node-red/flows_golrath...json but the flows file that was being used was .node-red/flows_golrathlocaldomain...json.

NBD. I was curious why that happened. I suspected it had something to do with a new user account I created on my Mac for a house sitter we had.

I copied the old flows code and pasted it over the content of the currently used flows file.

However, my flows weren't working. It turned out that tab characters I'd entered into a template node had been changed to spaces. I'd probably copied the file content from the terminal. It does that. But it got me wondering if there's a safer way to specify a tab character in a template?

what editor are you using? ACE or Monaco?

In monaco, it may be changing your tabs to spaces automatically (friendly if thats what you want :slight_smile: )

You can press f1 and type tabs to ensure it inserts tabs.

vEWeD33LtY

2 Likes

How do I know which editor I'm getting?

I'm currently on a different mac (running Mojave) than when I was dealing with this issue yesterday, but in testing it out on this mac (running Catalina), I am seeing different behavior based on where the cursor is, whether or not there exists a highlight, or whether I'm pasting a tab. I can't seem to 100% predict what will happen, but these are my observations:

  1. If I hit the tab key in the middle of a line of text, I get spaces where I expect the tab to go.
  2. If I hit the tab at the end of a line of text, I get a tab character where I expect the tab to go.
  3. If I highlight text in the middle of a line and hit tab, I get spaces where I expect the tab to go.
  4. If I highlight text at the end of a line (including a hard return), I get a tab character inserted at the beginning of the first line.

But there are instances in my testing above where I DO get a tab character instead of spaces and I cannot figure out what conditions need to be met to figure out what I'm going to get.

I know this all has to do with the chosen editor and not the inner workings of node red. I'm reluctant to change the editor due to having tried that in the past and having issues...

So let me rephrase the question. What I intended to ask is if there is a code for tab characters that node red supports, e.g. something like {{{tab}}} or \t or something, that saves in the json file as that supplied string (i.e. not an actual tab character)? E.g. the value for my template node saved in json would look something like:

{{{payload.list}}}\t{{{payload.title}}}\t{{{payload.duedate}}}

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.