It is currently March 28th, 2024, 9:40 am

Putting a Line Break in InputText's DefaultValue

Share and get help with Plugins and Addons
Post Reply
User avatar
Mordasius
Posts: 1167
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Putting a Line Break in InputText's DefaultValue

Post 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.
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

Re: Putting a Line Break in InputText's DefaultValue

Post 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
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

Re: Putting a Line Break in InputText's DefaultValue

Post 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.
User avatar
Mordasius
Posts: 1167
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: Putting a Line Break in InputText's DefaultValue

Post 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.
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

Re: Putting a Line Break in InputText's DefaultValue

Post 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.
User avatar
Mordasius
Posts: 1167
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: Putting a Line Break in InputText's DefaultValue

Post 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.
Post Reply