From 4741f7f8a13c778a1033908d152edf95b1499a85 Mon Sep 17 00:00:00 2001 From: Stefan Cepko Date: Sun, 24 Aug 2014 18:31:27 -0400 Subject: [PATCH 1/6] defined new sequences, marked implemented sequences, implemented REVERSE_INDEX --- cmake/ValaPrecompile.cmake | 1 + src/TerminalOutput.vala | 8 +++- src/TerminalStream.vala | 84 ++++++++++++++++++++------------------ 3 files changed, 53 insertions(+), 40 deletions(-) diff --git a/cmake/ValaPrecompile.cmake b/cmake/ValaPrecompile.cmake index be34a67..1816373 100644 --- a/cmake/ValaPrecompile.cmake +++ b/cmake/ValaPrecompile.cmake @@ -187,6 +187,7 @@ macro(vala_precompile output) ${ARGS_OPTIONS} ${in_files} ${custom_vapi_arguments} + "-g" COMMAND ${CMAKE_COMMAND} -E touch "vala.stamp" DEPENDS diff --git a/src/TerminalOutput.vala b/src/TerminalOutput.vala index 4dc31c8..f8e0caa 100644 --- a/src/TerminalOutput.vala +++ b/src/TerminalOutput.vala @@ -91,7 +91,7 @@ public class TerminalOutput : Gee.ArrayList { public void parse_stream_element(TerminalStream.StreamElement stream_element) { switch (stream_element.stream_element_type) { case TerminalStream.StreamElement.StreamElementType.TEXT: - //message(_("Text sequence received: '%s'"), stream_element.text); + message(_("Text sequence received: '%s'"), stream_element.text); // Print only text that has not been printed yet string text_left = stream_element.text.substring( @@ -223,6 +223,12 @@ public class TerminalOutput : Gee.ArrayList { 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(); + break; + case TerminalStream.StreamElement.ControlSequenceType.CHARACTER_POSITION_RELATIVE: // The CUF sequence moves the active position to the right. // The distance moved is determined by the parameter (default: 1) diff --git a/src/TerminalStream.vala b/src/TerminalStream.vala index d8488be..52057ba 100644 --- a/src/TerminalStream.vala +++ b/src/TerminalStream.vala @@ -208,18 +208,18 @@ public class TerminalStream : Object { // Naming convention follows xterm specification found at // http://invisible-island.net/xterm/ctlseqs/ctlseqs.html public enum ControlSequenceType { - UNKNOWN, + UNKNOWN, //implemented - BELL, - BACKSPACE, - CARRIAGE_RETURN, + BELL, //implemented + BACKSPACE, //implemented + CARRIAGE_RETURN, //implemented RETURN_TERMINAL_STATUS, - FORM_FEED, - LINE_FEED, + FORM_FEED, //implemented + LINE_FEED, //implemented SHIFT_IN, SHIFT_OUT, - HORIZONTAL_TAB, - VERTICAL_TAB, + HORIZONTAL_TAB, //implemented + VERTICAL_TAB, //implemented SEVEN_BIT_CONTROLS, EIGHT_BIT_CONTROLS, @@ -233,7 +233,7 @@ public class TerminalStream : Object { DEC_SCREEN_ALIGNMENT_TEST, SELECT_DEFAULT_CHARACTER_SET, SELECT_UTF8_CHARACTER_SET, - DESIGNATE_G0_CHARACTER_SET_VT100, + DESIGNATE_G0_CHARACTER_SET_VT100, //implemented DESIGNATE_G1_CHARACTER_SET_VT100, DESIGNATE_G2_CHARACTER_SET_VT220, DESIGNATE_G3_CHARACTER_SET_VT220, @@ -244,8 +244,8 @@ public class TerminalStream : Object { SAVE_CURSOR, RESTORE_CURSOR, FORWARD_INDEX, - APPLICATION_KEYPAD, - NORMAL_KEYPAD, + APPLICATION_KEYPAD, //implemented + NORMAL_KEYPAD, //implemented CURSOR_TO_LOWER_LEFT_CORNER_OF_SCREEN, FULL_RESET, MEMORY_LOCK, @@ -256,50 +256,55 @@ public class TerminalStream : Object { INVOKE_G2_CHARACTER_SET_AS_GR, INVOKE_G1_CHARACTER_SET_AS_GR, + INDEX, + NEXT_LINE, + TAB_SET, + REVERSE_INDEX, + USER_DEFINED_KEYS, REQUEST_STATUS_STRING, SET_TERMCAP_DATA, REQUEST_TERMCAP_STRING, INSERT_CHARACTERS, - CURSOR_UP, - CURSOR_DOWN, - CURSOR_FORWARD, - CURSOR_BACKWARD, + CURSOR_UP, //implemented + CURSOR_DOWN, //implemented + CURSOR_FORWARD, //implemented + CURSOR_BACKWARD, //implemented CURSOR_NEXT_LINE, CURSOR_PRECEDING_LINE, - CURSOR_CHARACTER_ABSOLUTE, - CURSOR_POSITION, + CURSOR_CHARACTER_ABSOLUTE, //implemented + CURSOR_POSITION, //implemented CURSOR_FORWARD_TABULATION, - ERASE_IN_DISPLAY_ED, + ERASE_IN_DISPLAY_ED, //implemented ERASE_IN_DISPLAY_DECSED, - ERASE_IN_LINE_EL, + ERASE_IN_LINE_EL, //implemented ERASE_IN_LINE_DECSEL, INSERT_LINES, DELETE_LINES, - DELETE_CHARACTERS, + DELETE_CHARACTERS, //implemented SCROLL_UP_LINES, SCROLL_DOWN_LINES, INITIATE_HIGHLIGHT_MOUSE_TRACKING, RESET_TITLE_MODES_FEATURES, - ERASE_CHARACTERS, + ERASE_CHARACTERS, //implemented CURSOR_BACKWARD_TABULATION, - CHARACTER_POSITION_ABSOLUTE, + CHARACTER_POSITION_ABSOLUTE, //implemented CHARACTER_POSITION_RELATIVE, REPEAT_PRECEDING_GRAPHIC_CHARACTER, SEND_DEVICE_ATTRIBUTES_PRIMARY, SEND_DEVICE_ATTRIBUTES_SECONDARY, - LINE_POSITION_ABSOLUTE, - LINE_POSITION_RELATIVE, - HORIZONTAL_AND_VERTICAL_POSITION, + LINE_POSITION_ABSOLUTE, //implemented + LINE_POSITION_RELATIVE, //implemented + HORIZONTAL_AND_VERTICAL_POSITION, //implemented TAB_CLEAR, - SET_MODE, + SET_MODE, //implemented DEC_PRIVATE_MODE_SET, MEDIA_COPY, MEDIA_COPY_DEC, - RESET_MODE, - DEC_PRIVATE_MODE_RESET, - CHARACTER_ATTRIBUTES, + RESET_MODE, //implemented + DEC_PRIVATE_MODE_RESET, //implemented + CHARACTER_ATTRIBUTES, //implemented SET_OR_RESET_RESOURCE_VALUES, DEVICE_STATUS_REPORT, DISABLE_MODIFIERS, @@ -307,7 +312,7 @@ public class TerminalStream : Object { SET_RESOURCE_VALUE_POINTER_MODE, SOFT_TERMINAL_RESET, REQUEST_ANSI_MODE, - REQUEST_DEC_PRIVATE_MODE, + REQUEST_DEC_PRIVATE_MODE, //implemented SET_CONFORMANCE_LEVEL, LOAD_LEDS, SET_CURSOR_STYLE, @@ -338,16 +343,16 @@ public class TerminalStream : Object { INSERT_COLUMNS, DELETE_COLUMNS, - SET_TEXT_PARAMETERS, + SET_TEXT_PARAMETERS, //implemented - FTCS_PROMPT, - FTCS_COMMAND_START, - FTCS_COMMAND_EXECUTED, - FTCS_COMMAND_FINISHED, - FTCS_TEXT_MENU_START, - FTCS_TEXT_MENU_END, - FTCS_PROGRESS, - FTCS_EXECUTE_COMMANDS + FTCS_PROMPT, //implemented + FTCS_COMMAND_START, //implemented + FTCS_COMMAND_EXECUTED, //implemented + FTCS_COMMAND_FINISHED, //implemented + FTCS_TEXT_MENU_START, //implemented + FTCS_TEXT_MENU_END, //implemented + FTCS_PROGRESS, //implemented + FTCS_EXECUTE_COMMANDS //implemented } // TODO: Use accessor methods ("add_parameter()") instead of public(?) @@ -431,6 +436,7 @@ public class TerminalStream : Object { add_esc_sequence_pattern(ControlSequenceType.FULL_RESET, "c"); add_esc_sequence_pattern(ControlSequenceType.MEMORY_LOCK, "l"); add_esc_sequence_pattern(ControlSequenceType.MEMORY_UNLOCK, "m"); + add_esc_sequence_pattern(ControlSequenceType.REVERSE_INDEX, "M"); add_esc_sequence_pattern(ControlSequenceType.INVOKE_G2_CHARACTER_SET_AS_GL, "n"); add_esc_sequence_pattern(ControlSequenceType.INVOKE_G3_CHARACTER_SET_AS_GL, "o"); add_esc_sequence_pattern(ControlSequenceType.INVOKE_G3_CHARACTER_SET_AS_GR, "|"); From 3d74757abf0aba2cbcc8e5d8857ac2ed37291afe Mon Sep 17 00:00:00 2001 From: Stefan Cepko Date: Sun, 31 Aug 2014 03:55:58 -0400 Subject: [PATCH 2/6] added NL and IND control sequences, also failures --- src/TerminalOutput.vala | 12 ++++++++++++ src/TerminalStream.vala | 2 ++ 2 files changed, 14 insertions(+) diff --git a/src/TerminalOutput.vala b/src/TerminalOutput.vala index f8e0caa..23f8b5e 100644 --- a/src/TerminalOutput.vala +++ b/src/TerminalOutput.vala @@ -229,6 +229,18 @@ public class TerminalOutput : Gee.ArrayList { terminal.terminal_view.terminal_output_view.add_line_views(); break; + case TerminalStream.StreamElement.ControlSequenceType.NEXT_LINE: + screen_offset += 1; + move_cursor(cursor_position.line + stream_element.get_numeric_parameter(0,1), 0); + terminal.terminal_view.terminal_output_view.add_line_views(); + break; + + case TerminalStream.StreamElement.ControlSequenceType.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(); + break; + case TerminalStream.StreamElement.ControlSequenceType.CHARACTER_POSITION_RELATIVE: // The CUF sequence moves the active position to the right. // The distance moved is determined by the parameter (default: 1) diff --git a/src/TerminalStream.vala b/src/TerminalStream.vala index 52057ba..5b5504d 100644 --- a/src/TerminalStream.vala +++ b/src/TerminalStream.vala @@ -432,6 +432,8 @@ public class TerminalStream : Object { add_esc_sequence_pattern(ControlSequenceType.FORWARD_INDEX, "9"); add_esc_sequence_pattern(ControlSequenceType.APPLICATION_KEYPAD, "="); add_esc_sequence_pattern(ControlSequenceType.NORMAL_KEYPAD, ">"); + add_esc_sequence_pattern(ControlSequenceType.INDEX, "D"); + add_esc_sequence_pattern(ControlSequenceType.NEXT_LINE, "E"); add_esc_sequence_pattern(ControlSequenceType.CURSOR_TO_LOWER_LEFT_CORNER_OF_SCREEN, "F"); add_esc_sequence_pattern(ControlSequenceType.FULL_RESET, "c"); add_esc_sequence_pattern(ControlSequenceType.MEMORY_LOCK, "l"); From 85fa067a66273829e255298684bcd834ae8ef92c Mon Sep 17 00:00:00 2001 From: Stefan Cepko Date: Sun, 31 Aug 2014 03:58:35 -0400 Subject: [PATCH 3/6] removed debug flag --- cmake/ValaPrecompile.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/cmake/ValaPrecompile.cmake b/cmake/ValaPrecompile.cmake index 1816373..be34a67 100644 --- a/cmake/ValaPrecompile.cmake +++ b/cmake/ValaPrecompile.cmake @@ -187,7 +187,6 @@ macro(vala_precompile output) ${ARGS_OPTIONS} ${in_files} ${custom_vapi_arguments} - "-g" COMMAND ${CMAKE_COMMAND} -E touch "vala.stamp" DEPENDS From ab5a9bdd0cb4fedadd9f28df68c8aecb3cf9b8a6 Mon Sep 17 00:00:00 2001 From: Stefan Cepko Date: Sun, 31 Aug 2014 13:20:16 -0400 Subject: [PATCH 4/6] man scrolls up and down --- src/TerminalOutput.vala | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/TerminalOutput.vala b/src/TerminalOutput.vala index 23f8b5e..4325436 100644 --- a/src/TerminalOutput.vala +++ b/src/TerminalOutput.vala @@ -124,6 +124,8 @@ public class TerminalOutput : Gee.ArrayList { // This code causes a line feed or a new line operation // TODO: Does LF always imply CR? move_cursor(cursor_position.line + 1, 0); + terminal.terminal_view.terminal_output_view.add_line_views(); + terminal.terminal_view.terminal_output_view.scroll_to_position(); break; case TerminalStream.StreamElement.ControlSequenceType.HORIZONTAL_TAB: From 592113908a63d5f572af9bc56c6d386546491715 Mon Sep 17 00:00:00 2001 From: Stefan Cepko Date: Wed, 3 Sep 2014 15:35:59 -0400 Subject: [PATCH 5/6] commented debug message --- src/TerminalOutput.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TerminalOutput.vala b/src/TerminalOutput.vala index 4325436..1036217 100644 --- a/src/TerminalOutput.vala +++ b/src/TerminalOutput.vala @@ -91,7 +91,7 @@ public class TerminalOutput : Gee.ArrayList { public void parse_stream_element(TerminalStream.StreamElement stream_element) { switch (stream_element.stream_element_type) { case TerminalStream.StreamElement.StreamElementType.TEXT: - message(_("Text sequence received: '%s'"), stream_element.text); + //message(_("Text sequence received: '%s'"), stream_element.text); // Print only text that has not been printed yet string text_left = stream_element.text.substring( From 796b054755eeca534713c9c5a890e05024cb3339 Mon Sep 17 00:00:00 2001 From: Stefan Cepko Date: Sat, 6 Sep 2014 23:44:25 -0400 Subject: [PATCH 6/6] removed unnecessary scroll --- src/TerminalOutput.vala | 1 - 1 file changed, 1 deletion(-) diff --git a/src/TerminalOutput.vala b/src/TerminalOutput.vala index 1036217..6a9e238 100644 --- a/src/TerminalOutput.vala +++ b/src/TerminalOutput.vala @@ -228,7 +228,6 @@ public class TerminalOutput : Gee.ArrayList { 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(); break; case TerminalStream.StreamElement.ControlSequenceType.NEXT_LINE: