Skip to content

Commit 2f9f335

Browse files
committed
Fix preview terminal window title for empty values
1 parent 37e5943 commit 2f9f335

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/components/output/PromptPreview.vue

+6-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
<br />
55
<div class="preview" :class="{ light, dark: !light }">
66
<div class="preview-head">
7+
<span v-if="!elements.windowTitleSet">Terminal</span>
78
<span v-for="element in elements.windowTitle" :key="element.id">
89
{{ element.data.type.preview(element.data.parameters) }}
910
</span>
11+
<span>&nbsp;</span> <!-- Ensure there is at least one character even if the title is empty -->
1012
<span class="preview-window-controls">
1113
<MinusCircleIcon class="icon"></MinusCircleIcon>
1214
<XCircleIcon class="icon"></XCircleIcon>
@@ -141,6 +143,7 @@ export default defineComponent({
141143
};
142144
// whether an operating system command ('Set Window Title') has been encountered and awaits an ending bell
143145
let operatingSystemCommand: boolean = false;
146+
let windowTitleSet: boolean = false;
144147
145148
while (elements.length > 0) {
146149
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -151,6 +154,7 @@ export default defineComponent({
151154
// any previous window title is overwritten by the new one
152155
crPartitions.windowTitle = [[]];
153156
operatingSystemCommand = true;
157+
windowTitleSet = true;
154158
} else if (element.data.type.name === 'Bell' && operatingSystemCommand) {
155159
operatingSystemCommand = false;
156160
} else if (operatingSystemCommand) {
@@ -165,6 +169,7 @@ export default defineComponent({
165169
return {
166170
prompt: crPartitions.prompt.reduce(mergeCrPartitions),
167171
windowTitle: crPartitions.windowTitle.reduce(mergeCrPartitions),
172+
windowTitleSet
168173
};
169174
},
170175
},
@@ -242,8 +247,7 @@ h3
242247
.icon
243248
margin: 0 0.1em
244249
height: 1.2em
245-
vertical-align: middle
246-
250+
vertical-align: text-bottom
247251
248252
.preview-body
249253
padding: 1em

0 commit comments

Comments
 (0)