diff options
author | Iru Cai <mytbk920423@gmail.com> | 2014-07-04 22:55:29 +0800 |
---|---|---|
committer | Iru Cai <mytbk920423@gmail.com> | 2014-07-04 22:55:29 +0800 |
commit | ed5c6b000bc032d3584e770a9aff40373af19c2e (patch) | |
tree | 0423c582609181255932015718cdb0d1ce78536e | |
parent | 47731af03865c7c1f251a2e6b44ae905d61d083b (diff) | |
download | fqterm-ed5c6b000bc032d3584e770a9aff40373af19c2e.tar.xz |
Add ANSI sequence "<ESC> c" support
-rw-r--r-- | src/terminal/fqterm_buffer.cpp | 20 | ||||
-rw-r--r-- | src/terminal/fqterm_buffer.h | 3 | ||||
-rw-r--r-- | src/terminal/internal/fqterm_decode.cpp | 8 | ||||
-rw-r--r-- | src/terminal/internal/fqterm_decode.h | 3 |
4 files changed, 33 insertions, 1 deletions
diff --git a/src/terminal/fqterm_buffer.cpp b/src/terminal/fqterm_buffer.cpp index c00e079..8d7deeb 100644 --- a/src/terminal/fqterm_buffer.cpp +++ b/src/terminal/fqterm_buffer.cpp @@ -359,6 +359,26 @@ void FQTermBuffer::setMargins(int top, int bottom) { } } + // termReset(): deal with ANSI sequence <ESC> c + // initialize the terminal property + void FQTermBuffer::termReset() + { + FQ_TRACE("term", 3) << "Resetting terminal (<ESC> c)"; + top_row_ = 0; + bottom_row_ = num_rows_ - 1; + + is_g0_used_ = true; + is_insert_mode_ = false; + is_ansi_mode_ = true; + is_newline_mode_ = false; + is_cursor_mode_ = false; + is_numeric_mode_ = true; + is_origin_mode_ = false; + is_autowrap_mode_ = false; + is_autorepeat_mode_ = true; + is_lightbg_mode_ = false; + } + void FQTermBuffer::moveCaretTo(int column, int row, bool scroll_if_necessary) { if (row != caret_.row_) emit caretChangeRow(); diff --git a/src/terminal/fqterm_buffer.h b/src/terminal/fqterm_buffer.h index 3e0ef6a..d22e2a3 100644 --- a/src/terminal/fqterm_buffer.h +++ b/src/terminal/fqterm_buffer.h @@ -119,6 +119,9 @@ class FQTermBuffer: public QObject { // restrictied in [top_row_, bottom_row_] of terminal.) void setMargins(int top_row, int bottom_row); + // reset terminal + void termReset(); + // the caret's coordinate in term or buffer. int getCaretColumn() const; int getCaretRow() const; diff --git a/src/terminal/internal/fqterm_decode.cpp b/src/terminal/internal/fqterm_decode.cpp index cb7bc9a..49aa364 100644 --- a/src/terminal/internal/fqterm_decode.cpp +++ b/src/terminal/internal/fqterm_decode.cpp @@ -96,6 +96,8 @@ StateOption FQTermDecode::VT100StateMachine::esc_state_[] = { }, { '<', &FQTermDecode::test, normal_state_ }, { + 'c', &FQTermDecode::termReset, normal_state_ + }, { '#', 0, sharp_state_ }, { CHAR_NORMAL, 0, normal_state_ @@ -685,6 +687,12 @@ void FQTermDecode::setMargins() { } } + void FQTermDecode::termReset() + { + FQ_FUNC_TRACE("ansi", 8); + termBuffer_->termReset(); + } + // parameters functions void FQTermDecode::clearParam() { FQ_FUNC_TRACE("ansi", 9); diff --git a/src/terminal/internal/fqterm_decode.h b/src/terminal/internal/fqterm_decode.h index 5f3f46d..86fe942 100644 --- a/src/terminal/internal/fqterm_decode.h +++ b/src/terminal/internal/fqterm_decode.h @@ -73,7 +73,8 @@ class FQTermDecode: public QObject { void setAttr(); void setMargins(); - + void termReset(); + // char screen functions void deleteStr(); void deleteLine(); |