Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit fc13198

Browse files
committed
fix(plugins/plugin-client-common): Whem moving blocks, the moved block is not longer focused after the move
Fixes #5612
1 parent 505a7a0 commit fc13198

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

plugins/plugin-client-common/src/components/Views/Terminal/ScrollableTerminal.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,10 @@ export default class ScrollableTerminal extends React.PureComponent<Props, State
261261
/** move the given block upward */
262262
private willMoveUpward(sbuuid: string, idx: number) {
263263
this.splice(sbuuid, curState => {
264+
// Notes: we want to keep the block we are moving focused, so we
265+
// also update the focusedBlockIdx
264266
return {
267+
focusedBlockIdx: idx - 1,
265268
blocks: curState.blocks
266269
.slice(0, idx - 1)
267270
.concat(curState.blocks[idx])
@@ -274,7 +277,10 @@ export default class ScrollableTerminal extends React.PureComponent<Props, State
274277
/** move the given block downward */
275278
private willMoveDownward(sbuuid: string, idx: number) {
276279
this.splice(sbuuid, curState => {
280+
// Notes: we want to keep the block we are moving focused, so we
281+
// also update the focusedBlockIdx
277282
return {
283+
focusedBlockIdx: idx + 1,
278284
blocks: curState.blocks
279285
.slice(0, idx)
280286
.concat(curState.blocks[idx + 1])

0 commit comments

Comments
 (0)