ansi, vt100,... terminal auto wrap

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
stranger
Posts: 17
Joined: Thu Mar 03, 2011 4:05 am

ansi, vt100,... terminal auto wrap

Post 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.
User avatar
turdus
Member
Member
Posts: 496
Joined: Tue Feb 08, 2011 1:58 pm

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

Post 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.
stranger
Posts: 17
Joined: Thu Mar 03, 2011 4:05 am

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

Post 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?
stranger
Posts: 17
Joined: Thu Mar 03, 2011 4:05 am

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

Post by stranger »

berkus wrote:I wonder what prevents you from trying this out on an already working vt100 emulation (like linux console).
Nothing.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

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

Post 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.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Post Reply