Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

I am assigning the content of a textedit in lua, and am trying to insert newlines into the textedit, with no success.

I find that '\n' is ignored (but visible as a garbage char in the trace output) and '\r' results in a garbage character getting printed.

Here's a couple of sample lines of code.

cLog = wstring.tostring(cLog) .. '\n\r' .. str
ui.vfsWrite(functionOrNode, cLog)

Where functionOrNode is pointing to the VFS node that the textedit is using for its content.

Also, note that I have tried setting the content of cLog to both a string and a wstring, but the results are identical.

The equivalent first line for that is:

cLog = wstring.new(wstring.tostring(cLog) .. '\n\r' .. str)

Please let me know how to get a newline into a textedit.

thanks
eric

I'll look into this and get back to you.

I'll look into this and get back to you.

Hi,
I am unable to reproduce this problem.
Quick question , in the text or textedits you are trying to do this have you set
Quote:
multiline="_true"
Here are some code snippets I quickly wrote that show this working.
<?xml version="1.0" encoding="UTF-8"?>

-- Lua script
testScript = {}
local ws = require("wstring")
local str = ws.new("Line2 Text")
local newline = ws.new("\n")
function testScript.manipulateTextBuffer()
cLog = ws.new("Line1 Text")
cLog = cLog .. newline .. str
ui.vfsWrite("/var/inputBuffer",cLog)
key = ui.event.key
end

Hi,
I am unable to reproduce this problem.
Quick question , in the text or textedits you are trying to do this have you set
Quote:
multiline="_true"
Here are some code snippets I quickly wrote that show this working.
<?xml version="1.0" encoding="UTF-8"?>

-- Lua script
testScript = {}
local ws = require("wstring")
local str = ws.new("Line2 Text")
local newline = ws.new("\n")
function testScript.manipulateTextBuffer()
cLog = ws.new("Line1 Text")
cLog = cLog .. newline .. str
ui.vfsWrite("/var/inputBuffer",cLog)
key = ui.event.key
end