@@ -457,35 +457,12 @@ public void HandleCsi(string identifier, Params parameters)
457457 break ;
458458
459459 case CsiCommand . SetMode :
460- if ( isPrivate )
461- {
462- // DEC Private Mode Set (CSI ? Pm h)
463- for ( int i = 0 ; i < parameters . Length ; i ++ )
464- {
465- var mode = parameters . GetParam ( i , 0 ) ;
466- SetModeInternal ( mode , isPrivate : true ) ;
467- }
468- }
469- else
470- {
471- SetMode ( parameters ) ;
472- }
460+ SetCSIModeParameters ( parameters , isPrivate : isPrivate ) ;
473461 break ;
474462
475463 case CsiCommand . ResetMode :
476- if ( isPrivate )
477- {
478- // DEC Private Mode Reset (CSI ? Pm l)
479- for ( int i = 0 ; i < parameters . Length ; i ++ )
480- {
481- var mode = parameters . GetParam ( i , 0 ) ;
482- ResetModeInternal ( mode , isPrivate : true ) ;
483- }
484- }
485- else
486- {
487- ResetMode ( parameters ) ;
488- }
464+ // DEC Private Mode Reset (CSI ? Pm l)
465+ ResetCSIModeParameters ( parameters , isPrivate : isPrivate ) ;
489466 break ;
490467
491468 case CsiCommand . Unknown :
@@ -1516,24 +1493,24 @@ private void WindowManipulation(Params parameters)
15161493 }
15171494 }
15181495
1519- private void SetMode ( Params parameters )
1496+ private void SetCSIModeParameters ( Params parameters , bool isPrivate )
15201497 {
15211498 for ( int i = 0 ; i < parameters . Length ; i ++ )
15221499 {
15231500 var mode = parameters . GetParam ( i , 0 ) ;
1524- SetModeInternal ( mode , isPrivate : false ) ;
1501+ SetCSIMode ( mode , isPrivate : isPrivate ) ;
15251502 }
15261503 }
15271504
1528- private void SetModeInternal ( int mode , bool isPrivate )
1505+ private void SetCSIMode ( int mode , bool isPrivate )
15291506 {
15301507 if ( isPrivate )
15311508 {
15321509 // DEC Private Modes (DECSET)
15331510 // Convert int to TerminalMode enum
15341511 if ( ! Enum . IsDefined ( typeof ( TerminalMode ) , mode ) )
15351512 {
1536- System . Diagnostics . Debug . WriteLine ( $ "Unknown terminal mode: { mode } ") ;
1513+ System . Diagnostics . Debug . WriteLine ( $ "Unknown CSI private terminal mode: { mode } ") ;
15371514 return ;
15381515 }
15391516
@@ -1675,7 +1652,7 @@ private void SetModeInternal(int mode, bool isPrivate)
16751652 break ;
16761653
16771654 default :
1678- System . Diagnostics . Debug . WriteLine ( $ "Unhandled terminal mode: { terminalMode } ") ;
1655+ System . Diagnostics . Debug . WriteLine ( $ "Unhandled CSI private terminal mode: { terminalMode } ") ;
16791656 break ;
16801657 }
16811658 }
@@ -1684,7 +1661,7 @@ private void SetModeInternal(int mode, bool isPrivate)
16841661 // ANSI Modes (SM)
16851662 if ( ! Enum . IsDefined ( typeof ( TerminalMode ) , mode ) )
16861663 {
1687- System . Diagnostics . Debug . WriteLine ( $ "Unknown terminal mode: { mode } ") ;
1664+ System . Diagnostics . Debug . WriteLine ( $ "Unknown CSI terminal mode: { mode } ") ;
16881665 return ;
16891666 }
16901667
@@ -1701,29 +1678,29 @@ private void SetModeInternal(int mode, bool isPrivate)
17011678 break ;
17021679
17031680 default :
1704- System . Diagnostics . Debug . WriteLine ( $ "Unhandled terminal mode: { terminalMode } ") ;
1681+ System . Diagnostics . Debug . WriteLine ( $ "Unhandled CSI terminal mode: { terminalMode } ") ;
17051682 break ;
17061683 }
17071684 }
17081685 }
17091686
1710- private void ResetMode ( Params parameters )
1687+ private void ResetCSIModeParameters ( Params parameters , bool isPrivate )
17111688 {
17121689 for ( int i = 0 ; i < parameters . Length ; i ++ )
17131690 {
17141691 var mode = parameters . GetParam ( i , 0 ) ;
1715- ResetModeInternal ( mode , isPrivate : false ) ;
1692+ ResetCSIMode ( mode , isPrivate : isPrivate ) ;
17161693 }
17171694 }
17181695
1719- private void ResetModeInternal ( int mode , bool isPrivate )
1696+ private void ResetCSIMode ( int mode , bool isPrivate )
17201697 {
17211698 if ( isPrivate )
17221699 {
17231700 // DEC Private Modes (DECRST)
17241701 if ( ! Enum . IsDefined ( typeof ( TerminalMode ) , mode ) )
17251702 {
1726- System . Diagnostics . Debug . WriteLine ( $ "Unknown terminal mode: { mode } ") ;
1703+ System . Diagnostics . Debug . WriteLine ( $ "Unknown private reset terminal mode: { mode } ") ;
17271704 return ;
17281705 }
17291706
@@ -1845,7 +1822,7 @@ private void ResetModeInternal(int mode, bool isPrivate)
18451822 // ANSI Modes (RM)
18461823 if ( ! Enum . IsDefined ( typeof ( TerminalMode ) , mode ) )
18471824 {
1848- System . Diagnostics . Debug . WriteLine ( $ "Unknown terminal mode: { mode } ") ;
1825+ System . Diagnostics . Debug . WriteLine ( $ "Unknown CSI reset terminal mode: { mode } ") ;
18491826 return ;
18501827 }
18511828
@@ -1862,7 +1839,7 @@ private void ResetModeInternal(int mode, bool isPrivate)
18621839 break ;
18631840
18641841 default :
1865- System . Diagnostics . Debug . WriteLine ( $ "Unhandled terminal mode: { terminalMode } ") ;
1842+ System . Diagnostics . Debug . WriteLine ( $ "Unhandled CSI reset terminal mode: { terminalMode } ") ;
18661843 break ;
18671844 }
18681845 }
0 commit comments