[Chinese-commits] [fqterm] 53/76: Add ANSI sequence "<ESC> c" support

Boyuan Yang hosiet-guest at moszumanska.debian.org
Thu Oct 27 03:17:01 UTC 2016


This is an automated email from the git hooks/post-receive script.

hosiet-guest pushed a commit to branch master
in repository fqterm.

commit ed5c6b000bc032d3584e770a9aff40373af19c2e
Author: Iru Cai <mytbk920423 at gmail.com>
Date:   Fri Jul 4 22:55:29 2014 +0800

    Add ANSI sequence "<ESC> c" support
---
 src/terminal/fqterm_buffer.cpp          | 20 ++++++++++++++++++++
 src/terminal/fqterm_buffer.h            |  3 +++
 src/terminal/internal/fqterm_decode.cpp |  8 ++++++++
 src/terminal/internal/fqterm_decode.h   |  3 ++-
 4 files changed, 33 insertions(+), 1 deletion(-)

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();

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/chinese/fqterm.git



More information about the Chinese-commits mailing list