|
|
|
@ -343,6 +343,24 @@ module.exports = function start(filename, source) {
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// Expand everything under cursor.
|
|
|
|
|
box.key(['S-right', 'S-l'], function () {
|
|
|
|
|
hideStatusBar()
|
|
|
|
|
const [n, line] = getLine(program.y)
|
|
|
|
|
program.showCursor()
|
|
|
|
|
program.cursorPos(program.y, line.search(/\S/))
|
|
|
|
|
const path = index.get(n)
|
|
|
|
|
const subJson = reduce(json, path)
|
|
|
|
|
for (let p of dfs(subJson, path)) {
|
|
|
|
|
if (expanded.size < 1000) {
|
|
|
|
|
expanded.add(p)
|
|
|
|
|
} else {
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
render()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
box.key(['left', 'h'], function () {
|
|
|
|
|
hideStatusBar()
|
|
|
|
|
const [n, line] = getLine(program.y)
|
|
|
|
@ -380,6 +398,22 @@ module.exports = function start(filename, source) {
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// Collapse all under cursor.
|
|
|
|
|
box.key(['S-left', 'S-h'], function () {
|
|
|
|
|
hideStatusBar()
|
|
|
|
|
const [n, line] = getLine(program.y)
|
|
|
|
|
program.showCursor()
|
|
|
|
|
program.cursorPos(program.y, line.search(/\S/))
|
|
|
|
|
const path = index.get(n)
|
|
|
|
|
const subJson = reduce(json, path)
|
|
|
|
|
for (let p of dfs(subJson, path)) {
|
|
|
|
|
if (expanded.has(p)) {
|
|
|
|
|
expanded.delete(p)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
render()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
box.on('click', function (mouse) {
|
|
|
|
|
hideStatusBar()
|
|
|
|
|
const [n, line] = getLine(mouse.y)
|
|
|
|
|