File tree Expand file tree Collapse file tree 1 file changed +20
-4
lines changed
Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -131,14 +131,30 @@ export default class TerminalComponent {
131131 */
132132 setupOscHandler ( ) {
133133 // Register custom OSC handler for ID 7777
134+ // Format: command;arg1;arg2;... where arg2 (path) may contain semicolons
134135 this . terminal . parser . registerOscHandler ( 7777 , ( data ) => {
135- const parts = data . split ( ";" ) ;
136- const command = parts [ 0 ] ;
136+ const firstSemi = data . indexOf ( ";" ) ;
137+ if ( firstSemi === - 1 ) {
138+ console . warn ( "Invalid OSC 7777 format:" , data ) ;
139+ return true ;
140+ }
141+
142+ const command = data . substring ( 0 , firstSemi ) ;
143+ const rest = data . substring ( firstSemi + 1 ) ;
137144
138145 switch ( command ) {
139- case "open" :
140- this . handleOscOpen ( parts [ 1 ] , parts [ 2 ] ) ;
146+ case "open" : {
147+ // Format: open;type;path (path may contain semicolons)
148+ const secondSemi = rest . indexOf ( ";" ) ;
149+ if ( secondSemi === - 1 ) {
150+ console . warn ( "Invalid OSC 7777 open format:" , data ) ;
151+ return true ;
152+ }
153+ const type = rest . substring ( 0 , secondSemi ) ;
154+ const path = rest . substring ( secondSemi + 1 ) ;
155+ this . handleOscOpen ( type , path ) ;
141156 break ;
157+ }
142158 default :
143159 console . warn ( "Unknown OSC 7777 command:" , command ) ;
144160 }
You can’t perform that action at this time.
0 commit comments