Skip to content

Commit e21cd59

Browse files
committed
fix: use parameters directly as config options
1 parent e23e2ab commit e21cd59

File tree

2 files changed

+9
-26
lines changed

2 files changed

+9
-26
lines changed

lib/script-view.js

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ export default class ScriptView extends MessagePanelView {
1818
this.scrollTimeout = null;
1919
this.ansiFilter = new AnsiFilter();
2020
this.headerView = headerView;
21-
this.position = this.parsePositionConfig(atom.config.get('script.position'));
21+
// Use 'bottom' as the default position, because that was
22+
// the behaviour before the position became configurable:
23+
this.position = 'bottom';
2224
atom.config.observe('script.position', (newVal) => {
23-
this.position = this.parsePositionConfig(newVal);
25+
this.position = newVal;
2426
});
2527

2628
this.showInTab = this.showInTab.bind(this);
@@ -31,25 +33,6 @@ export default class ScriptView extends MessagePanelView {
3133
linkPaths.listen(this.body);
3234
}
3335

34-
parsePositionConfig(value) {
35-
// Get the configured position of the view as one of the
36-
// valid values of the MessagePanelView.position parameter.
37-
switch (value) {
38-
case 'Top':
39-
return 'top';
40-
case 'Bottom':
41-
return 'bottom';
42-
case 'Left':
43-
return 'left';
44-
case 'Right':
45-
return 'right';
46-
default:
47-
// Use bottom as the default, because that was the behaviour
48-
// before the position became configurable.
49-
return 'bottom';
50-
}
51-
}
52-
5336
addShowInTabIcon() {
5437
const icon = $$(function () {
5538
this.div({

lib/script.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ export const config = {
5454
description: 'Position of the panel with script output. \
5555
(Changes to this value will be applied upon reopening the panel.)',
5656
type: 'string',
57-
default: 'Bottom',
57+
default: 'bottom',
5858
enum: [
59-
'Top',
60-
'Bottom',
61-
'Left',
62-
'Right',
59+
'top',
60+
'bottom',
61+
'left',
62+
'right',
6363
],
6464
},
6565
}

0 commit comments

Comments
 (0)