Simplify layout and prevent scrollbar flash when toggling file finder.

This commit is contained in:
Corey Johnson & Nathan Sobo
2012-03-15 17:18:26 -06:00
parent 0efee25ded
commit fd5439f357
7 changed files with 19 additions and 25 deletions

View File

@@ -34,9 +34,9 @@ describe "RootView", ->
describe ".addPane(view)", ->
it "adds the given view to the rootView (at the bottom by default)", ->
expect(rootView.vertical.children().length).toBe 1
expect(rootView.children().length).toBe 1
rootView.addPane $('<div id="foo">')
expect(rootView.vertical.children().length).toBe 2
expect(rootView.children().length).toBe 2
describe "the file finder", ->
describe "when the toggle-file-finder event is triggered", ->

View File

@@ -18,11 +18,10 @@ class Editor extends View
@content: ->
@div class: 'editor', tabindex: -1, =>
@div class: 'content', outlet: 'content', =>
@subview 'gutter', new Gutter
@div class: 'horizontal-scroller', outlet: 'horizontalScroller', =>
@div class: 'lines', outlet: 'lines', =>
@input class: 'hidden-input', outlet: 'hiddenInput'
@subview 'gutter', new Gutter
@div class: 'horizontal-scroller', outlet: 'horizontalScroller', =>
@div class: 'lines', outlet: 'lines', =>
@input class: 'hidden-input', outlet: 'hiddenInput'
vScrollMargin: 2
hScrollMargin: 10

View File

@@ -24,6 +24,7 @@ class FileFinder extends View
@on 'move-down', => @moveDown()
@on 'file-finder:select-file', => @select()
@editor.addClass 'single-line'
@editor.buffer.on 'change', => @populateUrlList()
@editor.off 'move-up move-down'

View File

@@ -12,9 +12,8 @@ VimMode = require 'vim-mode'
module.exports =
class RootView extends View
@content: ->
@div id: 'app-horizontal', outlet: 'horizontal', =>
@div id: 'app-vertical', outlet: 'vertical', =>
@subview 'editor', new Editor
@div id: 'root-view', =>
@subview 'editor', new Editor
initialize: ({url}) ->
@editor.keyEventHandler = window.keymap
@@ -40,7 +39,7 @@ class RootView extends View
@editor.setBuffer(@project.open(url)) if fs.isFile(url)
addPane: (view) ->
@vertical.append(view)
@append(view)
toggleFileFinder: ->
return unless @project

View File

@@ -8,15 +8,9 @@ body {
font-size: 12px;
}
#app-horizontal {
min-height: 100%;
display: -webkit-flexbox;
-webkit-flex-flow: row;
#root-view {
height: 100%;
position: relative;
background-image: url(static/images/linen.png);
}
#app-vertical {
min-height: 100%;
width: -webkit-flex(1);
}

View File

@@ -1,4 +1,5 @@
.editor {
display: -webkit-box;
font: 18px Inconsolata, Monaco, Courier !important;
position: relative;
width: 100%;
@@ -6,14 +7,14 @@
background: #333;
color: white;
cursor: default;
overflow-y: scroll;
overflow-y: auto;
overflow-x: auto;
-webkit-user-select: none;
}
.editor .content {
display: -webkit-flexbox;
.editor.single-line {
overflow-y: hidden;
}
.editor .gutter {
@@ -29,7 +30,7 @@
.editor .horizontal-scroller {
overflow-x: auto;
width: -webkit-flex(1);
-webkit-box-flex: 1;
}
.editor.soft-wrap .horizontal-scroller {

View File

@@ -1,4 +1,4 @@
#app-vertical > .file-finder {
.file-finder {
position: absolute;
width: 100%;
bottom: 0;