Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Luacontroller ignores pasted newlines #682

Closed
Bituvo opened this issue Sep 28, 2024 · 4 comments
Closed

Luacontroller ignores pasted newlines #682

Bituvo opened this issue Sep 28, 2024 · 4 comments

Comments

@Bituvo
Copy link

Bituvo commented Sep 28, 2024

If I copy text that contains newlines into a luacontroller, all of the newlines disappear when I try to run it.

image

This problem occurs if I copy text from any source, including another properly-formatted luacontroller.

@SmallJoker
Copy link
Member

@Bituvo Can you reproduce the same issue with other items, such as the Minetest Game book editor?

Copy&paste does not trigger any Lua callback on its own, thus this would be Luanti/Minetest engine issue.
Relevant code:

local function reset_formspec(meta, code, errmsg)
meta:set_string("code", code)
meta:mark_as_private("code")
code = minetest.formspec_escape(code or "")
errmsg = minetest.formspec_escape(tostring(errmsg or ""))
meta:set_string("formspec", "size[12,10]"
.."style_type[label,textarea;font=mono]"
.."background[-0.2,-0.25;12.4,10.75;jeija_luac_background.png]"
.."label[0.1,8.3;"..errmsg.."]"
.."textarea[0.2,0.2;12.2,9.5;code;;"..code.."]"
.."image_button[4.75,8.75;2.5,1;jeija_luac_runbutton.png;program;]"
.."image_button_exit[11.72,-0.25;0.425,0.4;jeija_close_window.png;exit;]"
)
end

@Bituvo
Copy link
Author

Bituvo commented Jan 1, 2025

Yes, it does happen with the book as well. I'm using the stable release of 5.10.0, let me update to the latest commit...

@Bituvo
Copy link
Author

Bituvo commented Jan 1, 2025

I've updated to the latest commit and the issue still occurs; in the Luacontroller, all newlines are removed when I press "Execute" without having to re-open the formspec. With the book editor, the "Save" button saves a copy of the text with all newlines stripped from it.

@SmallJoker
Copy link
Member

Please check for open Luanti/Minetest issues or open a new one if there's none.
Not a mesecons bug.

@SmallJoker SmallJoker closed this as not planned Won't fix, can't repro, duplicate, stale Jan 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants