(
engine: Host,
presentation: Args<'command.run'>['presentation'],
)
| 1104 | }) |
| 1105 | |
| 1106 | async function togglePane( |
| 1107 | engine: Host, |
| 1108 | presentation: Args<'command.run'>['presentation'], |
| 1109 | ): Promise<ResultOf['command.run']> { |
| 1110 | if (!isPaneOpen) { |
| 1111 | if (model.unknownReason !== null) { |
| 1112 | unpin() |
| 1113 | model = { ...model, unknownReason: null } |
| 1114 | } |
| 1115 | |
| 1116 | const isAnswered = |
| 1117 | (await pinBackend(engine, true)) || (await pinBackend(engine, true)) |
| 1118 | |
| 1119 | if (!backend) { |
| 1120 | return { |
| 1121 | text: isAnswered |
| 1122 | ? Names.NOT_IN_REPOSITORY_TEXT |
| 1123 | : Names.GIT_UNANSWERED_TEXT, |
| 1124 | } |
| 1125 | } |
| 1126 | } |
| 1127 | |
| 1128 | const { isFullscreen } = presentation |
| 1129 | |
| 1130 | columns = presentation.columns |
| 1131 | model = { ...model, isFullscreen } |
| 1132 | |
| 1133 | const toggle = PaneToggle.paneToggleOf({ |
| 1134 | isOpen: isPaneOpen, |
| 1135 | columns: isFullscreen ? columns : null, |
| 1136 | }) |
| 1137 | |
| 1138 | if (toggle === 'too-narrow') { |
| 1139 | return { text: Names.RESIZE_TERMINAL_TEXT } |
| 1140 | } |
| 1141 | |
| 1142 | const isOpening = toggle === 'open' |
| 1143 | |
| 1144 | if (!isOpening) { |
| 1145 | personCloses += 1 |
| 1146 | hasAutoOpened = true |
| 1147 | } |
| 1148 | |
| 1149 | const outcome = isOpening |
| 1150 | ? await openPane(engine, 'manual') |
| 1151 | : await closePane(engine).then(() => 'placed' as const) |
| 1152 | |
| 1153 | if (outcome === 'withdrawn') { |
| 1154 | return { text: Names.RESIZE_TERMINAL_TEXT } |
| 1155 | } |
| 1156 | |
| 1157 | if (outcome === 'awaited') { |
| 1158 | return { text: Names.AWAITS_SURFACE_TEXT } |
| 1159 | } |
| 1160 | |
| 1161 | if (!isFullscreen) { |
| 1162 | return isOpening ? {} : { text: Names.DIALOG_DISMISSED_TEXT } |
| 1163 | } |
no test coverage detected