Skip to content

Commit 30528a8

Browse files
committed
chore: redorder terminal tab so that muscle memory dont hit the close button
1 parent 4fd01ef commit 30528a8

2 files changed

Lines changed: 27 additions & 11 deletions

File tree

src/extensionsIntegrated/Terminal/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,12 +418,12 @@ define(function (require, exports, module) {
418418
$item.css("opacity", "0.6");
419419
}
420420

421+
$item.append('<span class="terminal-flyout-close"><i class="fa-solid fa-xmark"></i></span>');
421422
$item.append('<span class="terminal-flyout-icon"><i class="fa-solid fa-terminal"></i></span>');
422423
$item.append($('<span class="terminal-flyout-title"></span>').text(label));
423424
if (cwdName) {
424425
$item.append($('<span class="terminal-flyout-cwd"></span>').text(cwdName));
425426
}
426-
$item.append('<span class="terminal-flyout-close"><i class="fa-solid fa-xmark"></i></span>');
427427

428428
$item.on("click", function (e) {
429429
if (!$(e.target).closest(".terminal-flyout-close").length) {

src/styles/Extn-Terminal.less

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@
145145

146146
/* Flyout item */
147147
.terminal-flyout-item {
148+
position: relative;
148149
display: flex;
149150
align-items: center;
150151
height: 28px;
@@ -166,7 +167,8 @@
166167
box-shadow: inset 2px 0 0 #007acc;
167168
}
168169

169-
/* Icon column: fixed 30px slot, always visible in collapsed mode */
170+
/* Icon column: fixed 30px slot, always visible in collapsed mode.
171+
In expanded mode, CSS order moves it to the right end. */
170172
.terminal-flyout-icon {
171173
width: 30px;
172174
min-width: 30px;
@@ -193,28 +195,42 @@
193195
min-width: 0;
194196
max-width: 50%;
195197
margin-left: 4px;
198+
margin-right: 2px;
196199
opacity: 0.6;
197200
overflow: hidden;
198201
text-overflow: ellipsis;
199202
}
200203

201-
/* Close button: visible only on item hover */
204+
/* Expanded mode: reorder so icon is at the right end,
205+
add left padding for close button area */
206+
.terminal-tab-flyout:hover .terminal-flyout-item {
207+
padding-left: 30px;
208+
}
209+
210+
.terminal-tab-flyout:hover .terminal-flyout-icon {
211+
order: 99;
212+
}
213+
214+
/* Close button: overlays left padding area, visible only when
215+
flyout is expanded AND the specific item is hovered */
202216
.terminal-flyout-close {
203-
display: flex;
217+
position: absolute;
218+
left: 0;
219+
top: 0;
220+
bottom: 0;
221+
width: 30px;
222+
display: none;
204223
align-items: center;
205224
justify-content: center;
206-
width: 16px;
207-
height: 16px;
208225
font-size: 10px;
209226
color: var(--terminal-tab-text);
210-
border-radius: 3px;
227+
background: var(--terminal-tab-bg);
211228
flex-shrink: 0;
212-
margin-right: 4px;
213-
visibility: hidden;
229+
z-index: 1;
214230
}
215231

216-
.terminal-flyout-item:hover .terminal-flyout-close {
217-
visibility: visible;
232+
.terminal-tab-flyout:hover .terminal-flyout-item:hover .terminal-flyout-close {
233+
display: flex;
218234
}
219235

220236
.terminal-flyout-close:hover {

0 commit comments

Comments
 (0)