Closed HoofedEar closed 3 months ago
Very nice! I think it will be a great addition to QX82.
Just one tiny thing: I like to keep 100% backwards compatibility when possible, so in this case I'd prefer if it defaulted to an infinite max width (in other words, no wrapping) if the user omits the maxLength parameter. Maybe you can make it so it defaults to -1, and have -1 mean "no wrapping" in the code?
Thanks!
Maybe you can make it so it defaults to -1, and have -1 mean "no wrapping" in the code?
Done! Good call on backwards compatibility, 28 as default would have been jarring lol
Also fixed a bug in my code related to checking maxLen, so it should be good to go now! :+1:
Great, perfect!
Related to #8
Allows for setting a maximum width of characters for readLine. Which means if the user types beyond the maxWidth, it will move the cursor to the next line. It is currently set to default of 28 so that it aligns well with the "example-hello.html" example, but of course can be set to other values. For example, here is it set to 5 (![image](https://github.com/btco/qx82/assets/1261392/42b13a21-824a-420c-a3a5-6f2fc0a7cfd3)
readLine("", -1, 5);
)When you press "Enter", it will return the entire line as a single string with no newlines, so it will preserve the nature of readLine.
Also, made sure that it respects the value set for maxLen so that works now too 👍
Feel free to adjust or change anything in my code!