IND/RI/NEL control sequence implementations

This is the first in what will be a series of control sequence implementations, starting off with [INDEX](http://vt100.net/docs/vt100-ug/chapter3.html#IND), [REVERSE_INDEX](http://vt100.net/docs/vt100-ug/chapter3.html#RI), and [NEXT_LINE](http://vt100.net/docs/vt100-ug/chapter3.html#NEL). Currently, the steps used for each are:

1. inc/dec the scroll_offset
2. move cursor down/up
3. allocate/deallocate line views

In addition, the VERTICAL_TAB case was modified to allocate new line views and then scroll to the bottom of the terminal view

My main use case for this feature was `man`, so once I could successfully scroll up and down, I knew that progress had been made.

Some potential future control sequences have been added to the `enum` along with markings specifying which sequences have been implemented or not.

Bugs Introduced:
While running the `vttest` display test (option 1) the scroll_offset seems to become negative to around -37 or so, and I'm interested in the function `erase_range_screen` which seems to be accessing terminal space with an "absolute position"

```
private void erase_range_screen(CursorPosition start_position = {1, 1},
	CursorPosition end_position = {terminal.lines, terminal.columns + 1}) {
	var absolute_start_position = get_absolute_position(start_position);
	var absolute_end_position = get_absolute_position(end_position);
	
	// Constrain positions to permissible range
	absolute_start_position.line = int.min(absolute_start_position.line, size - 1);

	absolute_start_position.column = int.min(absolute_start_position.column, //<- Fails here
		get(absolute_start_position.line).get_length()); //<-------- due to negative index

	absolute_end_position.line = int.min(absolute_end_position.line, size - 1);
	absolute_end_position.column = int.min(absolute_end_position.column,
		get(absolute_end_position.line).get_length());
	
	erase_range(absolute_start_position, absolute_end_position);
	}
```
I'll take a look at the code you mentioned, I definitely would like to get more familiar with the code and the mvc pattern you've implemented

-------- Original message --------
From: Philipp Emanuel Weidmann <notifications@github.com> 
Date: 09/06/2014  11:30 AM  (GMT-05:00) 
To: p-e-w/finalterm <finalterm@noreply.github.com> 
Cc: cepko33 <cepko33@yahoo.com> 
Subject: Re: [finalterm] IND/RI/NEL control sequence implementations (#350) 
 
In src/TerminalOutput.vala:

> @@ -223,6 +225,24 @@ public class TerminalOutput : Gee.ArrayList<OutputLine> {
>  				break;
>  
>  			case TerminalStream.StreamElement.ControlSequenceType.CURSOR_FORWARD:
> +			case TerminalStream.StreamElement.ControlSequenceType.REVERSE_INDEX:
> +				screen_offset -= 1;
> +				move_cursor(cursor_position.line - stream_element.get_numeric_parameter(0,1), cursor_position.column);
> +				terminal.terminal_view.terminal_output_view.add_line_views();
While I cannot reproduce that problem, I occasionally see similar issues, which seem to be caused by https://github.com/p-e-w/finalterm/blob/master/src/Terminal.vala#L109, a piece of code that sometimes does not work the way it should according to the GLib API docs.

In any case, I'm afraid that calling add_line_views, or any other TerminalView method here is not what we want at all because it breaks the otherwise fairly clean MVC separation. We should fix the scrolling problem separately but this is not a viable workaround.

I'll try to dig a bit deeper and maybe fix it entirely so I can merge a clean version of this PR.

—
Reply to this email directly or view it on GitHub.