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

new line being passed to textFormatter after the point of word wrap seems to be hard locking mudlet #48

Closed
kalrykh opened this issue Dec 31, 2022 · 2 comments

Comments

@kalrykh
Copy link

kalrykh commented Dec 31, 2022

textStuff = textStuff or {}

local TextFormatter = require("TheTwoTowers.ftext").TextFormatter
myFormatter = TextFormatter:new( {
  width = 72,
  textColor = "<firebrick>",
  alignment = "left",
})

function textStuff.formatIt(string)
  cecho(myFormatter:format(string))
end

with this, if I pass a string to textStuff.formatIt() longer than the 72 column word wrap point that also has a \n in the string after that point, it locks mudlet up and I have to kill the process

@kalrykh kalrykh changed the title new line being passed to textFormatter after the point of word wrap seems to be hard locking mullet new line being passed to textFormatter after the point of word wrap seems to be hard locking mudlet Dec 31, 2022
@kalrykh
Copy link
Author

kalrykh commented Dec 31, 2022

also, workaround, stripping the string of new lines before it gets passed to the function and then adding one back after TextFormatter formats it gets me what I need.

            w = utf8.gsub(w,'%\n','')
            textStuff.formatIt(w)
            cecho("\n")

@demonnic
Copy link
Owner

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