Jump to content

Support Newlines in Default Value for "Text Area" User Configuration


Recommended Posts

Hi,

 

Suppose I have a "Text Area"-type User Configuration field that should have one value on each line of the text area. This might make it easier to edit for the user than one long comma-separated string value.

 

However, Alfred 5's current form item for Text Area fields uses a single-line input for the "Default Value" field, meaning you cannot "enter" down and add a new line with the next enumerated default value. Adding `\n` does not seem to work either, as it renders as a literal "\n" when populating the user-specific values (e.g. on workflow install).

 

Is there a workaround for this? Would you consider making this "Default Value" field a proper text area for the "Text Area" user configuration type? I understand that configuration values are exposed as environment variables, however environment variables still certainly allow newlines (tested in both bash and zsh to be sure).

 

Please see my attached screenshots for reference (apologies if they appear huge—blame the Retina display 😅).

 

field-config.png

 

user-value.png

 

env-var-bash.png

 

env-var-zsh.png

Edited by caleb531
Link to comment
Share on other sites

@caleb531 You can ⌥↩ to insert the newline on the text field. Pasting text with newlines in it also works.

 

@pixelgeek Commas aren’t always suitable for splitting (e.g. you have multiple lines which themselves have commas in them). Split Args can also split on newlines, but that wouldn’t suffice if you need to access the variable and split it yourself in code (e.g. if doing it in a Script Filter which is the entry point to the workflow).

Link to comment
Share on other sites

@vitor ⌥↩ did the trick. Thank you! It's not the most developer-friendly, since it's not clear that the input has multiple lines in it. But the workaround isn't that bad.

 

@vitorThis feature request was mostly inspired by your comment on my workflow submission for the Alfred Gallery, where you suggested that a Text Area would be more user-friendly, and I agree. But to make that work, I would need a straightforward way of supplying a default value (containing multiple lines) to this Text Area field.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...