Skip to content

Commit

Permalink
Allow any css value for default panel height
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyramin committed Nov 21, 2015
1 parent 7774322 commit 11202c5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
7 changes: 3 additions & 4 deletions lib/terminal-plus.coffee
Expand Up @@ -96,10 +96,9 @@ module.exports =
default: ''
defaultPanelHeight:
title: 'Default Panel Height'
description: 'Default height of a terminal panel.'
type: 'integer'
default: 300
minimum: 0
description: 'Default height of a terminal panel. **You may enter a value in px, em, or %.**'
type: 'string'
default: '300px'
theme:
title: 'Theme'
description: 'Select a theme for the terminal.'
Expand Down
8 changes: 7 additions & 1 deletion lib/view.coffee
Expand Up @@ -54,10 +54,14 @@ class TerminalPlusView extends View
title: 'Insert Text'

@prevHeight = atom.config.get('terminal-plus.style.defaultPanelHeight')
if @prevHeight.indexOf('%') > 0
percent = Math.abs(Math.min(parseFloat(@prevHeight) / 100.0, 1))
bottomHeight = $('atom-panel.bottom').children(".terminal-view").height() or 0
@prevHeight = percent * ($('.item-views').height() + bottomHeight)
@xterm.height 0

@setAnimationSpeed()
atom.config.onDidChange('terminal-plus.style.animationSpeed', @setAnimationSpeed)
@subscriptions.add atom.config.onDidChange 'terminal-plus.style.animationSpeed', @setAnimationSpeed

override = (event) ->
return if event.originalEvent.dataTransfer.getData('terminal-plus') is 'true'
Expand Down Expand Up @@ -207,6 +211,7 @@ class TerminalPlusView extends View
icon.removeClass('icon-screen-full').addClass('icon-screen-normal')
@maximized = true
lastOpenedView.hide()

lastOpenedView = this
@statusBar.setActiveTerminalView this
@statusIcon.activate()
Expand All @@ -215,6 +220,7 @@ class TerminalPlusView extends View
if not @opened
@opened = true
@displayTerminal()
@prevHeight = @xterm.height()
else
@focus()

Expand Down

0 comments on commit 11202c5

Please sign in to comment.