home
·
contact
·
privacy
projects
/
plomrogue2-experiments
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Distribute long annotation texts onto multiple lines.
[plomrogue2-experiments]
/
new2
/
rogue_chat_nocanvas_monochrome.html
diff --git
a/new2/rogue_chat_nocanvas_monochrome.html
b/new2/rogue_chat_nocanvas_monochrome.html
index 863de8c5b09cbaa9c93774cfa80c43941dccd862..512b8358a34e29f7254712f18182b58d3af4b627 100644
(file)
--- a/
new2/rogue_chat_nocanvas_monochrome.html
+++ b/
new2/rogue_chat_nocanvas_monochrome.html
@@
-186,18
+186,24
@@
let tui = {
terminal.write(terminal.rows - 1, terminal.cols / 2, '> ' + this.input_line);
}
},
terminal.write(terminal.rows - 1, terminal.cols / 2, '> ' + this.input_line);
}
},
- log_msg: function(msg) {
- let line_length = (terminal.cols / 2);
+ msg_into_lines_of_width: function(msg, width) {
let chunk = "";
let chunk = "";
+ let lines = [];
for (let i = 0, x = 0; i < msg.length; i++, x++) {
for (let i = 0, x = 0; i < msg.length; i++, x++) {
- if (x >=
line_leng
th) {
-
this.log
.unshift(chunk);
+ if (x >=
wid
th) {
+
lines
.unshift(chunk);
chunk = "";
x = 0;
};
chunk += msg[i];
}
chunk = "";
x = 0;
};
chunk += msg[i];
}
- this.log.unshift(chunk);
+ lines.unshift(chunk);
+ return lines;
+ },
+ log_msg: function(msg) {
+ let line_length = (terminal.cols / 2);
+ let chunk = "";
+ this.log = this.msg_into_lines_of_width(msg, terminal.cols / 2).concat(this.log);
while (this.log.length > terminal.rows - 2) {
this.log.pop();
};
while (this.log.length > terminal.rows - 2) {
this.log.pop();
};
@@
-232,7
+238,8
@@
let tui = {
},
draw_info: function() {
terminal.drawBox(1, terminal.cols / 2, terminal.rows - 2, terminal.cols / 2);
},
draw_info: function() {
terminal.drawBox(1, terminal.cols / 2, terminal.rows - 2, terminal.cols / 2);
- let lines = explorer.get_info();
+ let lines = this.msg_into_lines_of_width(explorer.get_info(), terminal.cols / 2);
+ lines.reverse();
for (let y = 1, i = 0; y < terminal.rows && i < lines.length; y++, i++) {
terminal.write(y, terminal.cols / 2, lines[i]);
}
for (let y = 1, i = 0; y < terminal.rows && i < lines.length; y++, i++) {
terminal.write(y, terminal.cols / 2, lines[i]);
}
@@
-355,9
+362,9
@@
let explorer = {
},
get_info: function() {
if (this.position in this.info_db) {
},
get_info: function() {
if (this.position in this.info_db) {
- return
[this.info_db[this.position]
];
+ return
this.info_db[this.position
];
} else {
} else {
- return
['waiting …']
;
+ return
'waiting …'
;
}
},
annotate: function(msg) {
}
},
annotate: function(msg) {