From 333c4eff41d31c7a4b372b73379d65738437550e Mon Sep 17 00:00:00 2001 From: Dheeraj Nalluri Date: Wed, 22 Nov 2023 12:23:31 -0600 Subject: [PATCH] Fix designate charset logic --- lib/src/core/escape/handler.dart | 2 +- lib/src/core/escape/parser.dart | 8 ++++---- lib/src/terminal.dart | 4 ++-- lib/src/utils/debugger.dart | 4 ++-- test/src/core/escape/parser_test.mocks.dart | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/src/core/escape/handler.dart b/lib/src/core/escape/handler.dart index 6e77351..166fb48 100644 --- a/lib/src/core/escape/handler.dart +++ b/lib/src/core/escape/handler.dart @@ -35,7 +35,7 @@ abstract class EscapeHandler { void reverseIndex(); - void designateCharset(int charset); + void designateCharset(int charset, int name); void unkownEscape(int char); diff --git a/lib/src/core/escape/parser.dart b/lib/src/core/escape/parser.dart index 792843b..0c7e74a 100644 --- a/lib/src/core/escape/parser.dart +++ b/lib/src/core/escape/parser.dart @@ -161,15 +161,15 @@ class EscapeParser { bool _escHandleDesignateCharset0() { if (_queue.isEmpty) return false; - _queue.consume(); - handler.designateCharset(0); + int name = _queue.consume(); + handler.designateCharset(0, name); return true; } bool _escHandleDesignateCharset1() { if (_queue.isEmpty) return false; - _queue.consume(); - handler.designateCharset(1); + int name = _queue.consume(); + handler.designateCharset(1, name); return true; } diff --git a/lib/src/terminal.dart b/lib/src/terminal.dart index cc32165..461e208 100644 --- a/lib/src/terminal.dart +++ b/lib/src/terminal.dart @@ -472,8 +472,8 @@ class Terminal with Observable implements TerminalState, EscapeHandler { } @override - void designateCharset(int charset) { - _buffer.charset.use(charset); + void designateCharset(int charset, int name) { + _buffer.charset.designate(charset, name); } @override diff --git a/lib/src/utils/debugger.dart b/lib/src/utils/debugger.dart index 73fec3f..303bbbb 100644 --- a/lib/src/utils/debugger.dart +++ b/lib/src/utils/debugger.dart @@ -164,8 +164,8 @@ class _TerminalDebuggerHandler implements EscapeHandler { } @override - void designateCharset(int charset) { - onCommand('designateCharset($charset)'); + void designateCharset(int charset, int name) { + onCommand('designateCharset($charset, $name)'); } @override diff --git a/test/src/core/escape/parser_test.mocks.dart b/test/src/core/escape/parser_test.mocks.dart index d0201c8..dad8580 100644 --- a/test/src/core/escape/parser_test.mocks.dart +++ b/test/src/core/escape/parser_test.mocks.dart @@ -143,10 +143,10 @@ class MockEscapeHandler extends _i1.Mock implements _i2.EscapeHandler { returnValueForMissingStub: null, ); @override - void designateCharset(int? charset) => super.noSuchMethod( + void designateCharset(int? charset, int? name) => super.noSuchMethod( Invocation.method( #designateCharset, - [charset], + [charset, name], ), returnValueForMissingStub: null, );