mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-03 14:37:05 +03:00
webterm: update slog handling for new formats
Secretly, [data.slog] here implies the entire slog text to be a single semantic character. But this kind of detail isn't present in the slog event, and can't be trivially reconstructed, so we're fine with this.
This commit is contained in:
parent
86f048d3b6
commit
32e1235edb
@ -18,6 +18,16 @@ export default class Store {
|
||||
}
|
||||
|
||||
handleEvent(data) {
|
||||
// process slogs
|
||||
//
|
||||
if (data.slog) {
|
||||
this.state.lines.splice(this.state.lines.length-1, 0, {lin: [data.slog]});
|
||||
this.setState({ lines: this.state.lines });
|
||||
return;
|
||||
}
|
||||
|
||||
// process blits
|
||||
//
|
||||
const blit = data.data;
|
||||
switch (Object.keys(blit)[0]) {
|
||||
case 'bel':
|
||||
@ -31,6 +41,7 @@ export default class Store {
|
||||
// since lines are lists of characters that might span multiple
|
||||
// codepoints, we need to calculate the byte-wise cursor position
|
||||
// to avoid incorrect cursor rendering.
|
||||
//
|
||||
let line = this.state.lines[this.state.lines.length - 1];
|
||||
let hops;
|
||||
if (line.lin) {
|
||||
|
@ -27,7 +27,7 @@ export default class Subscription {
|
||||
}
|
||||
|
||||
slog.onmessage = e => {
|
||||
this.handleEvent({ txt: e.data });
|
||||
this.handleEvent({ slog: e.data });
|
||||
}
|
||||
|
||||
slog.onerror = e => {
|
||||
|
Loading…
Reference in New Issue
Block a user