xP: make the prompt look more xC-like

This commit is contained in:
Přemysl Eric Janouch 2022-09-19 03:16:34 +02:00
parent ec20fdef7b
commit 00184811ea
Signed by: p
GPG Key ID: A0420B94F92B9493
2 changed files with 37 additions and 17 deletions

View File

@ -186,16 +186,30 @@ button {
column-gap: .6em; column-gap: .6em;
overflow-x: auto; overflow-x: auto;
} }
.input {
flex-shrink: 0;
border: 2px inset #eee;
overflow: hidden;
resize: vertical;
display: flex;
}
.input:focus-within {
border-color: #ff5f00;
}
.prompt {
padding: .05em .3em;
border-right: 1px solid #ccc;
background: #f8f8f8;
font-weight: bold;
}
textarea { textarea {
font: inherit; font: inherit;
padding: .05em .3em; padding: .05em .3em;
margin: 0; margin: 0;
border: 2px inset #eee; border: 0;
flex-shrink: 0; flex-grow: 1;
resize: vertical; resize: none;
} }
textarea:focus { textarea:focus {
outline: none; outline: none;
border-color: #ff5f00;
} }

View File

@ -687,18 +687,24 @@ let Status = {
let status = `${bufferCurrent}` let status = `${bufferCurrent}`
if (b.hideUnimportant) if (b.hideUnimportant)
status += `<H>` status += `<H>`
return m('.status', {}, status)
},
}
let Prompt = {
view: vnode => {
// This should be handled differently, so don't mind the lookup. // This should be handled differently, so don't mind the lookup.
if (b.server !== undefined) { let b = buffers.get(bufferCurrent)
if (b === undefined || b.server === undefined)
return
let state = b.server.state let state = b.server.state
for (const s in Relay.ServerState) for (const s in Relay.ServerState)
if (Relay.ServerState[s] == b.server.state) { if (Relay.ServerState[s] == b.server.state) {
state = s state = s
break break
} }
status += ` (${state})` return m('.prompt', {}, `(${state})`)
}
return m('.status', {}, status)
}, },
} }
@ -934,7 +940,7 @@ let Main = {
m('.title', {}, [`xP`, m(Toolbar)]), m('.title', {}, [`xP`, m(Toolbar)]),
m('.middle', {}, [m(BufferList), m(BufferContainer)]), m('.middle', {}, [m(BufferList), m(BufferContainer)]),
m(Status), m(Status),
m(Input), m('.input', {}, [m(Prompt), m(Input)]),
]) ])
}, },
} }