File tree 2 files changed +13
-2
lines changed
2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -657,7 +657,7 @@ export class AutoTiler {
657
657
return Err ( 'ignoring focus' ) ;
658
658
}
659
659
660
- const prev = ext . prev_focused [ 0 ]
660
+ const prev = ext . previously_focused ( win )
661
661
662
662
if ( ! prev ) {
663
663
return Err ( 'no window has been previously focused' ) ;
Original file line number Diff line number Diff line change @@ -152,7 +152,7 @@ export class Ext extends Ecs.System<ExtEvent> {
152
152
injections : Array < Injection > = new Array ( ) ;
153
153
154
154
/** The window that was focused before the last window */
155
- prev_focused : [ null | Entity , null | Entity ] = [ null , null ] ;
155
+ private prev_focused : [ null | Entity , null | Entity ] = [ null , null ] ;
156
156
157
157
tween_signals : Map < string , [ SignalID , any ] > = new Map ( ) ;
158
158
@@ -1070,6 +1070,17 @@ export class Ext extends Ecs.System<ExtEvent> {
1070
1070
}
1071
1071
}
1072
1072
1073
+ previously_focused ( active : Window . ShellWindow ) : null | Ecs . Entity {
1074
+ for ( const id of [ 1 , 0 ] ) {
1075
+ const prev = this . prev_focused [ id ]
1076
+ if ( prev && ! Ecs . entity_eq ( active . entity , prev ) ) {
1077
+ return prev ;
1078
+ }
1079
+ }
1080
+
1081
+ return null
1082
+ }
1083
+
1073
1084
movement_is_valid ( win : Window . ShellWindow , movement : movement . Movement ) {
1074
1085
if ( ( movement & Movement . SHRINK ) !== 0 ) {
1075
1086
if ( ( movement & Movement . DOWN ) !== 0 ) {
You can’t perform that action at this time.
0 commit comments