Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

A wrap tap tabs. 🥒🦎 #563

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/tab-bar-view.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ class TabBarView
@subscriptions.add atom.config.observe 'tabs.tabScrolling', (value) => @updateTabScrolling(value)
@subscriptions.add atom.config.observe 'tabs.tabScrollingThreshold', (value) => @updateTabScrollingThreshold(value)
@subscriptions.add atom.config.observe 'tabs.alwaysShowTabBar', => @updateTabBarVisibility()
@subscriptions.add atom.config.observe 'tabs.wrapTabs', (value) => @element.classList.toggle "wrap-tabs", value

@updateActiveTab()

Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@
"title": "Display MRU Tab Switching List",
"default": true,
"description": "When MRU Tab Switching is enabled, display the most-recently-used tab list."
},
"wrapTabs": {
"type": "boolean",
"default": false,
"description": "Wrap overflowing tabs onto multiple rows."
}
},
"devDependencies": {
Expand Down
11 changes: 11 additions & 0 deletions spec/tabs-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -1321,6 +1321,17 @@ describe "TabBarView", ->
expect(tabBar.element).not.toHaveClass 'hidden'
expect(tabBar2.element).toHaveClass 'hidden'

describe "when wrapTabs is true in package settings", ->
it "adds the `wrap-tabs` class to tabBar element", ->
atom.config.set("tabs.wrapTabs", true)
expect(tabBar.element).toHaveClass 'wrap-tabs'

describe "when wrapTabs is false in package settings", ->
it "removes `wrap-tabs` class from tabBar element", ->
tabBar.element.classList.add 'wrap-tabs'
atom.config.set("tabs.wrapTabs", false)
expect(tabBar.element).not.toHaveClass 'wrap-tabs'

if atom.workspace.buildTextEditor().isPending? or atom.workspace.getActivePane().getActiveItem?
isPending = (item) ->
if item.isPending?
Expand Down
27 changes: 27 additions & 0 deletions styles/wrap-tabs.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@import "ui-variables";

.tab-bar.wrap-tabs {
flex-wrap: wrap;
height: auto;
box-shadow: none;
margin-top: -1px;
background: linear-gradient(180deg, @tab-border-color, transparent 75%);
background-size: 1px @tab-height+1px;

.tab, .tab.active {
min-width: auto;
max-width: 19em;
}

.tab.active {
box-shadow: none !important;
margin-left: 1px;
}

.tab {
border: 1px solid @tab-border-color;
border-bottom: none;
margin: 0 -1px 0 -1px;
&:last-of-type { box-shadow: none; }
}
}