mirror of
https://github.com/slap-editor/slap.git
synced 2024-09-11 12:58:30 +03:00
fix(help): better help and first run experience
This commit is contained in:
parent
b98ffae01c
commit
1a654419ff
@ -86,9 +86,7 @@ module.exports = function (options) {
|
||||
if (!opts._.length) { // if no files are passed
|
||||
new Pane({parent: slap}).setCurrent(); // open a new empty file
|
||||
if (!opts.config) { // first run without a file passed
|
||||
slap.open(path.join(baseDir, 'README.md'), true)
|
||||
.tap(function (pane) { pane.editor.readOnly(true); })
|
||||
.done();
|
||||
slap.help().done();
|
||||
fs.createReadStream(path.join(__dirname, '..', 'default-config.ini')).pipe(fs.createWriteStream(path.join(userDir, 'config')));
|
||||
}
|
||||
}
|
||||
|
@ -85,8 +85,18 @@ Slap.prototype.quit = function () {
|
||||
};
|
||||
Slap.prototype.help = function () {
|
||||
return this
|
||||
.open(path.join(__dirname, '../../slap.ini'), true)
|
||||
.tap(function (pane) { pane.editor.readOnly(true); });
|
||||
.open(path.join(__dirname, '..', '..', 'README.md'), true)
|
||||
.tap(function (pane) {
|
||||
var editor = pane.editor;
|
||||
editor.readOnly(true);
|
||||
editor.textBuf.scan(/^Usage/, function (match) {
|
||||
var start = match.range.start;
|
||||
editor.selection.setRange([start, start]);
|
||||
editor.scroll = start.translate([-editor.buffer.options.cursorPadding.top, 0]);
|
||||
editor._updateContent();
|
||||
match.stop();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
Slap.prototype._stopKeyPropagation = function () {
|
||||
|
Loading…
Reference in New Issue
Block a user