summaryrefslogtreecommitdiff
path: root/Applications/Terminal
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-03-14 18:33:21 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-03-14 18:33:21 +0100
commitb7ad35d0403d9853baf9ca7a8ba3a22a06bdaebf (patch)
tree4e77f08272aa9b233599913abc9ad4ad28dc1c8f /Applications/Terminal
parentee0f00c6446514f80e73173767e5f3095b8f932d (diff)
downloadserenity-b7ad35d0403d9853baf9ca7a8ba3a22a06bdaebf.zip
Terminal: Enough compat work for Lynx to actually load web pages.
Diffstat (limited to 'Applications/Terminal')
-rw-r--r--Applications/Terminal/Terminal.cpp17
-rw-r--r--Applications/Terminal/Terminal.h2
2 files changed, 15 insertions, 4 deletions
diff --git a/Applications/Terminal/Terminal.cpp b/Applications/Terminal/Terminal.cpp
index 36afb29b2d..1e3a771570 100644
--- a/Applications/Terminal/Terminal.cpp
+++ b/Applications/Terminal/Terminal.cpp
@@ -316,8 +316,10 @@ void Terminal::escape$K(const Vector<unsigned>& params)
}
break;
case 1:
- // FIXME: Clear from cursor to beginning of screen.
- unimplemented_escape();
+ // Clear from cursor to beginning of line.
+ for (int i = 0; i < m_cursor_column; ++i) {
+ put_character_at(m_cursor_row, i, ' ');
+ }
break;
case 2:
unimplemented_escape();
@@ -504,7 +506,10 @@ void Terminal::on_char(byte ch)
case ExpectBracket:
if (ch == '[')
m_escape_state = ExpectParameter;
- else if (ch == ']')
+ else if (ch == '(') {
+ m_swallow_current = true;
+ m_escape_state = ExpectParameter;
+ } else if (ch == ']')
m_escape_state = ExpectXtermParameter1;
else
m_escape_state = Normal;
@@ -545,10 +550,13 @@ void Terminal::on_char(byte ch)
case ExpectFinal:
if (is_valid_final_character(ch)) {
m_escape_state = Normal;
- execute_escape_sequence(ch);
+ if (!m_swallow_current)
+ execute_escape_sequence(ch);
+ m_swallow_current = false;
return;
}
m_escape_state = Normal;
+ m_swallow_current = false;
return;
case Normal:
break;
@@ -559,6 +567,7 @@ void Terminal::on_char(byte ch)
return;
case '\033':
m_escape_state = ExpectBracket;
+ m_swallow_current = false;
return;
case 8: // Backspace
if (m_cursor_column) {
diff --git a/Applications/Terminal/Terminal.h b/Applications/Terminal/Terminal.h
index 6cac271c77..a79740a37d 100644
--- a/Applications/Terminal/Terminal.h
+++ b/Applications/Terminal/Terminal.h
@@ -145,6 +145,8 @@ private:
int m_ptm_fd { -1 };
+ bool m_swallow_current { false };
+
bool m_in_active_window { false };
bool m_need_full_flush { false };