File tree 2 files changed +7
-17
lines changed
panel/src/pages/LiveConsole
2 files changed +7
-17
lines changed Original file line number Diff line number Diff line change @@ -262,12 +262,13 @@ export default function LiveConsolePage() {
262
262
}
263
263
264
264
//Markers
265
+ let writeCallback : ( ( ) => void ) | undefined ;
265
266
try {
266
267
const res = getTermLineEventData ( line )
267
268
?? getTermLineInitialData ( line )
268
269
?? getTermLineRtlData ( line ) ; //https://github.com/xtermjs/xterm.js/issues/701
269
270
if ( res && res . markerData ) {
270
- registerTermLineMarker ( term , i , res . markerData ) ;
271
+ writeCallback = ( ) => registerTermLineMarker ( term , res . markerData ) ;
271
272
}
272
273
if ( res && res . newLine ) {
273
274
line = res . newLine ;
@@ -282,14 +283,14 @@ export default function LiveConsolePage() {
282
283
? prefixColor + termPrefixRef . current . prefix
283
284
: '' ;
284
285
if ( i < lines . length - 1 ) {
285
- term . writeln ( prefix + line ) ;
286
+ term . writeln ( prefix + line , writeCallback ) ;
286
287
termPrefixRef . current . lastEol = true ;
287
288
} else {
288
289
if ( wasEolStripped ) {
289
- term . writeln ( prefix + line ) ;
290
+ term . writeln ( prefix + line , writeCallback ) ;
290
291
termPrefixRef . current . lastEol = true ;
291
292
} else {
292
- term . write ( prefix + line ) ;
293
+ term . write ( prefix + line , writeCallback ) ;
293
294
termPrefixRef . current . lastEol = false ;
294
295
}
295
296
}
Original file line number Diff line number Diff line change @@ -118,26 +118,15 @@ export const getTermLineInitialData = (line: string): TerminalMarkerGetterResult
118
118
}
119
119
120
120
121
- /**
122
- * Gets the marker position based on the block index
123
- * The marker position is always relative to cursor, but at the first render,
124
- * the cursor is = until all the writes are done, so we need to calculate the
125
- * marker position based on the block index
126
- */
127
- const getMarkerPos = ( term : Terminal , blockIndex : number ) => {
128
- return term . buffer . active . cursorY === 0 ? blockIndex + 2 : 0 ;
129
- }
130
-
131
-
132
121
/**
133
122
* Registers a line marker & decoration
134
123
*/
135
124
export const registerTermLineMarker = (
136
125
term : Terminal ,
137
- blockIndex : number ,
138
126
markerData : TerminalMarkerData ,
139
127
) => {
140
- const marker = term . registerMarker ( getMarkerPos ( term , blockIndex ) ) ;
128
+ //NOTE: as this is only called from a write callback, we will _always_ be one line ahead
129
+ const marker = term . registerMarker ( - 1 ) ;
141
130
const decoration = term . registerDecoration ( { layer : 'top' , marker } ) ;
142
131
decoration && decoration . onRender ( ( element ) => {
143
132
if ( element . innerHTML ) return ; //terminal re-rendering
You can’t perform that action at this time.
0 commit comments