Page 1 of 1

Putting a Line Break in InputText's DefaultValue

Posted: January 11th, 2013, 4:26 am
by Mordasius
I'm trying to make a notes editor that uses Ctrl-Enter to make a line break when editing text with the InputText plugin. There is no problem working out when Ctrl-Enter has been used and using LUA to format the edited text for display in a string meter. The problem is that when it comes to editing it again using DefaultValue=#EditedText# the edited text won't show the line breaks.

I've tried EditedText="Line One#CRLF#Line Two#CRLF#Line Three" but this just displays as Line OneLine TwoLine Three in the InputText editing window. So what do I need to use so the InputText plugin displays it as though Ctrl-Enter had been used between each line?

Alternatively, does anyone know of a basic text editor written in LUA? I've seen lua-ed on https://github.com/martinwguy/lua-ed but have no idea what to do with those files to make them usable in the Rainmeter context.

Re: Putting a Line Break in InputText's DefaultValue

Posted: January 12th, 2013, 1:30 am
by moshi
i am just guessing as i can't try it right now.
maybe it is because the plugin interprets #CRLF#
how about trying something that it can't interpret like

Code: Select all

<br>
instead

Re: Putting a Line Break in InputText's DefaultValue

Posted: January 12th, 2013, 2:58 am
by moshi
this would mean you'd have

Code: Select all

EditedText="Line One#CRLF#Line Two#CRLF#Line Three"
;this is displayed as the result

PluginText="Line One<br>Line Two<br>Line Three"
;this is displayed while editing
and your lua script would have to format Ctrl-Enter and also <br>, maybe better even #CRLF# as well for both variables.

Re: Putting a Line Break in InputText's DefaultValue

Posted: January 12th, 2013, 3:16 am
by Mordasius
I've already have a LUA script that replaces the Ctrl-Enter used as a line break in the InputText editor with #CRLF# (or anything else) and then saves the edited text as a variable which can be used after a refresh (as the InputText plugin can't use dynamic variables).

The problem is that I don't want to have to edit text that has #CRLF# (or anything else) where I expect to see a line break.

What I need to know is how does the InputText plugin represent Ctrl-Enter so that it knows to use a line break and how can this be incorporated in a variable that is going to be passed to InputText as part of the DefaultValue.

Re: Putting a Line Break in InputText's DefaultValue

Posted: January 12th, 2013, 3:58 am
by moshi
you wont see a line break as the plugin displays all in one line.
so basically what you want would only be possible with a new version of the plugin.

Ctrl-Enter is displayed as one or two characters in that one line
http://en.wikipedia.org/wiki/Newline

as these control characters are "empty" you obviously can't see them.

Re: Putting a Line Break in InputText's DefaultValue

Posted: January 12th, 2013, 4:42 am
by Mordasius
So I guess its time for a change in direction. I don't like the pop-up Notepad versions so maybe I'll try a stack of InputText lines (one for each note) that grows or shrinks as you add or delete lines.