Skip to content

Commit 83ba40a

Browse files
committed
fix(terminal): add tab title tooltip and improve new-terminal buttons
Add title attribute to terminal tabs so clipped names show on hover. Make + and dropdown buttons equal size. Hide shell dropdown when only one shell is available.
1 parent 3d4dcf9 commit 83ba40a

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/extensionsIntegrated/Terminal/main.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ define(function (require, exports, module) {
3636
const ExtensionUtils = require("utils/ExtensionUtils");
3737
const NodeConnector = require("NodeConnector");
3838
const Mustache = require("thirdparty/mustache/mustache");
39-
const Strings = require("strings");
4039

4140
const TerminalInstance = require("./TerminalInstance");
4241
const ShellProfiles = require("./ShellProfiles");
@@ -225,7 +224,7 @@ define(function (require, exports, module) {
225224
* Create a tab element for a terminal instance
226225
*/
227226
function _createTab(instance) {
228-
const $tab = $('<div class="terminal-tab" data-terminal-id="' + instance.id + '">' +
227+
const $tab = $('<div class="terminal-tab" data-terminal-id="' + instance.id + '" title="' + _escapeHtml(instance.title) + '">' +
229228
'<i class="fa-solid fa-terminal terminal-tab-icon"></i>' +
230229
'<span class="terminal-tab-name">' + _escapeHtml(instance.title) + '</span>' +
231230
'<span class="terminal-tab-close"><i class="fa-solid fa-xmark"></i></span>' +
@@ -333,6 +332,7 @@ define(function (require, exports, module) {
333332
function _onTerminalTitleChanged(id, title) {
334333
const $tab = $tabsList.find('.terminal-tab[data-terminal-id="' + id + '"]');
335334
$tab.find(".terminal-tab-name").text(title);
335+
$tab.attr("title", title);
336336
}
337337

338338
/**
@@ -443,6 +443,10 @@ define(function (require, exports, module) {
443443

444444
// Detect shells
445445
ShellProfiles.init(nodeConnector).then(function () {
446+
const shells = ShellProfiles.getShells();
447+
if (shells.length <= 1) {
448+
$panel.find(".terminal-tab-dropdown-btn").addClass("forced-hidden");
449+
}
446450
_populateShellDropdown();
447451
});
448452

src/styles/Extn-Terminal.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,10 @@
236236

237237
/* Dropdown chevron button */
238238
.terminal-tab-dropdown-btn {
239+
flex: 1;
239240
display: flex;
240241
align-items: center;
241242
justify-content: center;
242-
width: 24px;
243243
padding: 6px 0;
244244
cursor: pointer;
245245
color: var(--terminal-tab-text);

0 commit comments

Comments
 (0)