xP: scroll to bottom and focus the input on switch
This commit is contained in:
parent
ee1750c23c
commit
93b66b6a26
@ -165,8 +165,11 @@ rpc.addEventListener('BufferRemove', event => {
|
|||||||
rpc.addEventListener('BufferActivate', event => {
|
rpc.addEventListener('BufferActivate', event => {
|
||||||
let e = event.detail
|
let e = event.detail
|
||||||
bufferCurrent = e.bufferName
|
bufferCurrent = e.bufferName
|
||||||
// TODO: Somehow scroll to the end of it immediately.
|
setTimeout(() => {
|
||||||
// TODO: Focus the textarea.
|
let el = document.getElementById('input')
|
||||||
|
if (el !== null)
|
||||||
|
el.focus()
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
rpc.addEventListener('BufferLine', event => {
|
rpc.addEventListener('BufferLine', event => {
|
||||||
@ -306,6 +309,19 @@ let Content = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let Buffer = {
|
let Buffer = {
|
||||||
|
oncreate: vnode => {
|
||||||
|
if (vnode.dom === undefined)
|
||||||
|
return
|
||||||
|
|
||||||
|
let el = vnode.dom.children[1]
|
||||||
|
if (el !== null)
|
||||||
|
el.scrollTop = el.scrollHeight
|
||||||
|
},
|
||||||
|
|
||||||
|
onupdate: vnode => {
|
||||||
|
Buffer.oncreate(vnode)
|
||||||
|
},
|
||||||
|
|
||||||
view: vnode => {
|
view: vnode => {
|
||||||
let lines = []
|
let lines = []
|
||||||
let b = buffers.get(bufferCurrent)
|
let b = buffers.get(bufferCurrent)
|
||||||
@ -376,7 +392,7 @@ function onKeyDown(event) {
|
|||||||
// and we'll probably have to intercept /all/ key presses.
|
// and we'll probably have to intercept /all/ key presses.
|
||||||
let Input = {
|
let Input = {
|
||||||
view: vnode => {
|
view: vnode => {
|
||||||
return m('textarea', {
|
return m('textarea#input', {
|
||||||
rows: 1,
|
rows: 1,
|
||||||
onkeydown: onKeyDown,
|
onkeydown: onKeyDown,
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user