11 posts
Location
England
Posted 21 April 2014 - 03:41 PM
If you attempt to use the escape character '\n' on a monitor, instead of starting a new line it will just produce a question mark, this also occurs when trying to print a file with multiple lines.
Edit: I meant \n, I typed this quite fast.
Edited on 21 April 2014 - 03:41 PM
8543 posts
Posted 21 April 2014 - 04:02 PM
Moved to Ask a Pro.
On monitors, you'll either want to redirect the terminal to it and use print() or write(), or manually adjust the cursor position. This isn't a bug. The terminals exhibit the same behavior. If you wrote a newline character to the screen of a computer with term.write, it would also display as a question mark.
171 posts
Location
Eastern USA
Posted 21 April 2014 - 05:00 PM
It's \n, not /n.
EDIT: nevermind, I should read the post first: you obviously used \n because you got a question mark and not just '/n'
Edited on 21 April 2014 - 03:00 PM
11 posts
Location
England
Posted 22 April 2014 - 01:02 PM
I understand what you're saying but the new line escape character is always (at least in the languages I've used before) used for moving to a new line and it makes it easier for automation, for example printing the contents of a file that contains multiple lines.
8543 posts
Posted 22 April 2014 - 03:32 PM
I understand that. I'm telling you that it does exactly what you expect if you use the correct function calls. The write and print functions are the porcelain you're intended to use; redirect the terminal to the monitor and use one and it will automatically word wrap and handle newline characters. The term.write and monitor.write calls can be thought of as you dealing with the hardware directly. Telling it exactly what to write to the screen, starting at your current cursor position. Any characters it can't adequately represent display as "?", but it otherwise does absolutely nothing to modify the data you're instructing it to display. That's why this isn't a bug.
72 posts
Posted 23 April 2014 - 06:38 AM
I ran into this just yesterday. I manually put in the values like lyqyd said above. You can also get the cursor position of the monitor and add 1 to the y and set the position if its not something you want to specify and it would allow for lines to be inserted/removed, but that's a little much when you can do like lyqyd said again, and redirect the terminal.
524 posts
Location
Cambridge, England
Posted 25 April 2014 - 10:52 AM
Design oversight perhaps, but not bug. term.write() or monitor.write() don't interpret newlines specially.