Time Nick Message 16:58 rubenwardy What's the best way to open a secure modal from a formspec? I'm adding a button_url, and want to show a URL modal. One way would be via m_client -> game_ui although there doesn't seem to be anything modal related here other than GUIFormspecMenu. Another option is MainGameEvent, but not sure what that's supposed to be. The design of this is major spaghetti 17:00 rubenwardy I suspect GameCallback as that's how keychange/etc is done 17:03 rubenwardy GameCallback was last touched in 2011 17:03 rubenwardy a game/client/input refactor is long overdue 17:11 Krock what is the final goal? 17:12 Krock perhaps I can then better understand your question 17:13 rubenwardy #12500 17:13 ShadowBot https://github.com/minetest/minetest/issues/12500 -- Allow formspecs to open URLs 17:14 Krock so to show a confirmation dialog including the full URL before opening it? 17:15 Krock > that only works if the player has recently submitted a formspec due to user interaction 17:15 rubenwardy that's correct 17:16 Krock this is not precise enough. it must happen only during the execution of the field submit callback 17:16 rubenwardy ignore that bit, that only applies if we add a server-side core.open_url api 17:17 rubenwardy the idea is to only add a button_url and a hypertext equiv 17:17 Krock there's currently no "stack" of GUIModalMenu from what I can see to properly restore the formspec afterwards 17:19 Krock it only exists for MainMenuManager 17:19 rubenwardy for now, I'm fine with closing the previous formspec 17:20 rubenwardy actually it just works 17:20 rubenwardy you can click cancel and it goes back to the formspec 17:22 rubenwardy https://rwdy.uk/23vQ5.png 17:22 rubenwardy maybe it's worth adding a secure mode to formspecs so that I can build this modal using that instead 17:23 Krock oh that's good progress. What do you mean by "secure mode"? 17:23 rubenwardy It would disable prepends and allow button_url to open a url 17:25 Krock this dialog seems to be fine as-is concept-wise. A textarea might however be a more practical way to display and scroll through the URL. also manual copying would be possible that way 17:26 rubenwardy I think you can still copy from this text field 17:26 rubenwardy also, WIP (need to improve the dialog + clean up parseButtonURL + add hypertext version): https://github.com/rubenwardy/minetest/tree/urlbutton 17:26 rubenwardy ok you can't copy as it's disabled and not readonly 17:27 Krock plus it cannot handle long URLs very user-friendly 17:46 rubenwardy wordwrap doesn't seem to have breakword enabled 17:47 rubenwardy here's what it looks like as a readonly textarea https://rwdy.uk/ThYE5.png 17:48 rubenwardy there's also no horizontal scrollbars 17:49 sfan5 do we have any text wrapping in formspecs yet 17:49 rubenwardy yes, there's like 4 different implementations 17:49 rubenwardy they all suck 17:50 rubenwardy it's the same copy and pasted implementation from irrlicht that has quite a few bugs 17:50 rubenwardy I made a PR to fix this situation but burnt out 17:50 rubenwardy #10853 17:50 ShadowBot https://github.com/minetest/minetest/issues/10853 -- Add WordWrapper util (with unit tests, ellipsis truncation, and fixes) by rubenwardy 17:51 nrz_ rubenwardy, it shoulds cool, but what about long URLs ? maybe having domain name highlighted can be nice 17:51 Krock nrz_: please check the logs 17:51 rubenwardy lol 17:51 rubenwardy we were just talking about long URLs - I posted that image to say that wrapping/horizontal scrollbars wasn't working as expected 17:52 rubenwardy domain name highlighted would be nice - do textareas support colorize? 17:52 Krock adding a few more characters to the allowed line break characters should be feasible 17:52 Krock textarea do support colorizing but afaik they still lose that property when breaking aline 17:52 Krock *a line 17:52 rubenwardy you need breakword as you might not always have an allowed line break char in the right place 17:53 Krock sec. I have a test file for that 17:53 rubenwardy actually I suppose I could insert a unique soft break in between every character 17:53 nrz_ i'm thinking if we can put minetest GL in godot GL or not, but i'm not very good in GL haha 17:53 rubenwardy that would allow breaking at any location 17:53 rubenwardy *unicode 17:53 nrz_ rubenwardy: yeah you should definitevly limit to a fixed length the URL 17:53 rubenwardy although iirc one of the bugs of the Irrlicht word wrap is it doesn't support that character correctly 17:54 rubenwardy I'm not planning to limit the URL length other than required by the URL spec, would rather make it support wrapping etc 17:54 Krock right. every 2nd line is colored correctly. 17:54 Krock https://i.postimg.cc/pLXnTY00/grafik.png 17:54 nrz_ i mean not the URL itself, but the shown url in the confirm dialog 17:55 Krock rubenwardy: https://github.com/SmallJoker/minetest_lab/blob/master/init_10_formspec_any_test.lua#L29 17:55 Krock and selecting the text is kinda weird 17:56 Krock although I do not know how automatic line breaks handle this 17:59 rubenwardy I suppose the domain name will always be on the first line