From 2fb757791b5a122a8c1b366a5ddfcd7f5ce09aaf Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 30 May 2016 14:49:29 +0200 Subject: [PATCH 1/2] Allow atom-pane to be shrunk independently of its contents' width --- spec/pane-element-spec.coffee | 18 +++++++++++++++++- static/panes.less | 1 + 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/spec/pane-element-spec.coffee b/spec/pane-element-spec.coffee index 0f19cf595..f5a059c49 100644 --- a/spec/pane-element-spec.coffee +++ b/spec/pane-element-spec.coffee @@ -1,12 +1,13 @@ PaneContainer = require '../src/pane-container' describe "PaneElement", -> - [paneElement, container, pane] = [] + [paneElement, container, containerElement, pane] = [] beforeEach -> spyOn(atom.applicationDelegate, "open") container = new PaneContainer(config: atom.config, confirm: atom.confirm.bind(atom)) + containerElement = atom.views.getView(container) pane = container.getActivePane() paneElement = atom.views.getView(pane) @@ -195,3 +196,18 @@ describe "PaneElement", -> event = buildDragEvent("drop", []) paneElement.dispatchEvent(event) expect(atom.applicationDelegate.open).not.toHaveBeenCalled() + + describe "resize", -> + it "shrinks independently of its contents' width", -> + jasmine.attachToDOM(containerElement) + item = document.createElement('div') + item.style.width = "2000px" + item.style.height = "30px" + paneElement.insertBefore(item, paneElement.children[0]) + + paneElement.style.flexGrow = 0.1 + expect(paneElement.getBoundingClientRect().width).toBeGreaterThan(0) + expect(paneElement.getBoundingClientRect().width).toBeLessThan(item.getBoundingClientRect().width) + + paneElement.style.flexGrow = 0 + expect(paneElement.getBoundingClientRect().width).toBe(0) diff --git a/static/panes.less b/static/panes.less index a1a649e54..00ee97c7f 100644 --- a/static/panes.less +++ b/static/panes.less @@ -48,6 +48,7 @@ atom-pane-container { -webkit-flex: 1; -webkit-flex-direction: column; overflow: visible; + min-width: 0; .item-views { -webkit-flex: 1; From c8e742809b65ae75f933fa29c2decbd832676ecd Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 30 May 2016 15:06:36 +0200 Subject: [PATCH 2/2] Don't set an explicit width for LinesComponent --- src/lines-component.coffee | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/lines-component.coffee b/src/lines-component.coffee index 88645589a..bb9634ec2 100644 --- a/src/lines-component.coffee +++ b/src/lines-component.coffee @@ -64,10 +64,6 @@ class LinesComponent extends TiledComponent @domNode.appendChild(@placeholderTextDiv) @oldState.placeholderText = @newState.placeholderText - if @newState.width isnt @oldState.width - @domNode.style.width = @newState.width + 'px' - @oldState.width = @newState.width - @cursorsComponent.updateSync(state) buildComponentForTile: (id) -> new LinesTileComponent({id, @presenter, @domElementPool, @assert, @grammars})