[Libreoffice-commits] online.git: 3 commits - loleaflet/src loolwsd/LOOLSession.cpp

Mihai Varga mihai.varga at collabora.com
Wed Jul 22 05:26:56 PDT 2015


 loleaflet/src/control/Control.Parts.js |    3 ++-
 loleaflet/src/layer/tile/TileLayer.js  |   12 ++++++++----
 loolwsd/LOOLSession.cpp                |    2 +-
 3 files changed, 11 insertions(+), 6 deletions(-)

New commits:
commit b0834709018a1f04af6802eb153fed7dfc2377c1
Author: Mihai Varga <mihai.varga at collabora.com>
Date:   Wed Jul 22 15:26:19 2015 +0300

    loleaflet: set calc sheet names in tabs

diff --git a/loleaflet/src/control/Control.Parts.js b/loleaflet/src/control/Control.Parts.js
index ca8d5e2..f8646b6 100644
--- a/loleaflet/src/control/Control.Parts.js
+++ b/loleaflet/src/control/Control.Parts.js
@@ -58,6 +58,7 @@ L.Control.Parts = L.Control.extend({
 		var parts = e.parts;
 		var currentPart = e.currentPart;
 		var docType = e.docType;
+		var partNames = e.partNames;
 		if (currentPart === 0) {
 			L.DomUtil.addClass(this._prevPartButton, className);
 		} else {
@@ -106,7 +107,7 @@ L.Control.Parts = L.Control.extend({
 				for (i = 0; i < parts; i++) {
 					id = 'spreadsheet-tab' + i;
 					var tab = L.DomUtil.create('li', '', container);
-					tab.innerHTML = 'Sheet ' + (i + 1);
+					tab.innerHTML = partNames[i];
 					tab.id = id;
 					L.DomEvent
 						.on(tab, 'click', L.DomEvent.stopPropagation)
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 85b5ad4..02ae828 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -328,8 +328,9 @@ L.TileLayer = L.GridLayer.extend({
 				this._parts = command.parts;
 				this._currentPart = command.currentPart;
 				this.sendMessage('setclientpart part=' + this._currentPart);
-				var partNamesStr = bytes === undefined ? textMsg : String.fromCharCode.apply(null, bytes.subarray(index));
-				var partNames = partNamesStr.match(/[^\r\n]+/g);
+				var partNames = textMsg.match(/[^\r\n]+/g);
+				// only get the last matches
+				partNames = partNames.slice(partNames.length - this._parts);
 				this._map.fire('updateparts', {
 					currentPart: this._currentPart,
 					parts: this._parts,
commit e29d7c8468647b997014f461c0110ff3d7a7e82d
Author: Mihai Varga <mihai.varga at collabora.com>
Date:   Wed Jul 22 15:09:14 2015 +0300

    loolwsd: save the whole status not only the fst line

diff --git a/loolwsd/LOOLSession.cpp b/loolwsd/LOOLSession.cpp
index 3294806..3b33f13 100644
--- a/loolwsd/LOOLSession.cpp
+++ b/loolwsd/LOOLSession.cpp
@@ -195,7 +195,7 @@ bool MasterProcessSession::handleInput(const char *buffer, int length)
             }
             else if (tokens[0] == "status:")
             {
-                peer->_tileCache->saveStatus(firstLine);
+                peer->_tileCache->saveStatus(std::string(buffer, length));
             }
             else if (tokens[0] == "invalidatetiles:")
             {
commit 379072c0aa2729d5a5ce59776441a12f739f785f
Author: Mihai Varga <mihai.varga at collabora.com>
Date:   Wed Jul 22 15:08:11 2015 +0300

    loleaflet: parse the whole message if it's not a tile
    
    Some messages might have new line characters

diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 99b4df1..85b5ad4 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -185,6 +185,10 @@ L.TileLayer = L.GridLayer.extend({
 		if (!textMsg.startsWith('tile:')) {
 			// log the tile msg separately as we need the tile coordinates
 			L.Log.log(textMsg, L.INCOMING);
+			if (bytes !== undefined) {
+				// if it's not a tile, parse the whole message
+				textMsg = String.fromCharCode.apply(null, bytes);
+			}
 		}
 
 		if (textMsg.startsWith('cursorvisible:')) {
@@ -438,7 +442,6 @@ L.TileLayer = L.GridLayer.extend({
 			this._onUpdateTextSelection();
 		}
 		else if (textMsg.startsWith('textselectioncontent:')) {
-			textMsg += String.fromCharCode.apply(null, bytes.subarray(index));
 			this._selectionTextContent = textMsg.substr(22);
 		}
 		else if (textMsg.startsWith('setpart:')) {
@@ -476,7 +479,7 @@ L.TileLayer = L.GridLayer.extend({
 	},
 
 	_parseServerCmd: function (msg) {
-		var tokens = msg.split(' ');
+		var tokens = msg.split(/[ \n]+/);
 		var command = {};
 		for (var i = 0; i < tokens.length; i++) {
 			if (tokens[i].substring(0, 9) === 'tileposx=') {


More information about the Libreoffice-commits mailing list