mkschreder / avr-vt100

AVR ATMega Terminal Emulator
82 stars 20 forks source link

scroll area not respected for out of bound write #3

Open aldolo69 opened 5 years ago

aldolo69 commented 5 years ago

term->scroll_end_row seem a 0 based value so, if I set "19" as bottom line, term->scroll_end_row=18. term->cursor_y seem a 1 based value so, if i place the cursor in line 100, term->cursor_y=100.

            if(term->flags.origin_mode)
            {
                term->cursor_y += term->scroll_start_row;
                if(term->cursor_y >= term->scroll_end_row)
                {
                    term->cursor_y = term->scroll_end_row - 1;
                }
            }

this piece of code place y cursor not at the bottom of the scrolling area but 2 line above (-1)

aldolo69 commented 5 years ago

i was wrong. the mistake is not this one. problems are scattered here and there. cursor_x and cursor_y are 0 based but sometime they are assigned to the full width/height of the display , while they should be width-1 and height-1.

mkschreder commented 5 years ago

Possibly. Scrolling could use a little bit of review..

On Thu, Oct 4, 2018 at 6:29 PM aldolo notifications@github.com wrote:

i was wrong. the mistake is not this one. problems are scattered here and there. cursor_x and cursor_y are 0 based but sometime they are assigned to the full width/height of the display , while they should be width-1 and height-1.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mkschreder/avr-vt100/issues/3#issuecomment-427084192, or mute the thread https://github.com/notifications/unsubscribe-auth/AERqiUfkl5EImz1-0YIhN9xWKFGlvgD3ks5uhjdxgaJpZM4XFhi_ .