Page 1 of 1

ansi, vt100,... terminal auto wrap

Posted: Wed Apr 27, 2011 4:18 am
by stranger
Hi, I would like to implement ansi terminal, but have troubles understanding how should some featuers work. Can you please explain this?
Auto Wrap

This mode selects where a received character will appear when the cursor is at the right margin. Select auto wrap by using the following sequences.

NOTE: Regardless of the auto wrap SET-UP feature selection, the tab character never moves the cursor to the next line.

Auto Wrap Mode (DECAWM)

ESC [ ? 7 h
033 133 077 067 150
Set selects auto wrap. Any display characters received when cursor is at right margin appear on next line. The display scrolls up if cursor is at end of scrolling region.

ESC [ ? 7 l
033 133 077 067 154
Reset turns auto wrap off. Display characters received when cursor is at right margin replace previously displayed character.
What is right margin? Screen is 80 characters wide (0 - 79). Why should character appear somewhere else than on cursor location? I'v always thought so cursor should point to location where next character appears and auto wrap should deal with "where to place cursor after received character was displayed". Thanks.

Re: ansi, vt100,... terminal auto wrap

Posted: Wed Apr 27, 2011 5:40 am
by turdus
stranger wrote:Hi, I would like to implement ansi terminal, but have troubles understanding how should some featuers work. Can you please explain this?
...
What is right margin? Screen is 80 characters wide (0 - 79). Why should character appear somewhere else than on cursor location? I'v always thought so cursor should point to location where next character appears and auto wrap should deal with "where to place cursor after received character was displayed". Thanks.
Right margin is when your cursor is at 79. So let's assume
y=1, x=79 and you receive a character to display.
with wrap:
y became 2, x=1, character displayed at (2,0)
without wrap:
y,x remains the same, character displayed at (1,79)

I hope it's clear now.

Re: ansi, vt100,... terminal auto wrap

Posted: Wed Apr 27, 2011 6:15 am
by stranger
Thanks, so with auto wrap enabled terminal is effectively only 79 characters (0 - 78) wide? 79th position can hold only cursor, or character written previously with auto wrap off?

Re: ansi, vt100,... terminal auto wrap

Posted: Thu Apr 28, 2011 2:45 pm
by stranger
berkus wrote:I wonder what prevents you from trying this out on an already working vt100 emulation (like linux console).
Nothing.

Re: ansi, vt100,... terminal auto wrap

Posted: Thu Apr 28, 2011 3:26 pm
by Combuster
If nothing stopped you you would have tried already, no?

I think we can all guess the correct answer. Are you able to experimentally find out something when there is no answer available? At some point in your OS development career you will have to, and you better take the opportunity to practice now when we still have an answer to help you on your way, instead of getting truly stuck later.