Improve line wrapping perf
This commit is contained in:
parent
2f1e72876b
commit
d25311d07f
|
@ -36,6 +36,7 @@ var selectedTabStore = Reflux.createStore({
|
|||
part: function(channels, server) {
|
||||
if (server === selectedTab.server &&
|
||||
channels.indexOf(selectedTab.channel) !== -1) {
|
||||
selectedTab.server = null;
|
||||
selectedTab.channel = null;
|
||||
selectedTab.name = null;
|
||||
this.trigger(selectedTab);
|
||||
|
|
|
@ -19,10 +19,16 @@ exports.timestamp = function(date) {
|
|||
exports.wrapMessages = function(messages, width, charWidth, indent = 0) {
|
||||
for (var j = 0, llen = messages.length; j < llen; j++) {
|
||||
var message = messages[j];
|
||||
var lineWidth = (6 + (message.from ? message.from.length + 1 : 0)) * charWidth;
|
||||
|
||||
if (lineWidth + message.message.length * charWidth < width) {
|
||||
message.lines = [message.message];
|
||||
continue;
|
||||
}
|
||||
|
||||
var words = message.message.split(' ');
|
||||
var line = '';
|
||||
var wrapped = [];
|
||||
var lineWidth = (6 + (message.from ? message.from.length + 1 : 0)) * charWidth;
|
||||
var wordCount = 0;
|
||||
var hasWrapped = false;
|
||||
|
||||
|
|
Loading…
Reference in New Issue