From 7d8258c262ac2654a1027a46822530681cb213aa Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Wed, 13 Jan 2021 02:15:09 +0000 Subject: [PATCH] Add args to unsupported message response based on some warnings I saw. Indicate which files are unsaved in the editor. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3638 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- core/client.js | 10 ++++++++++ core/style.css | 4 ++++ src/ssb.c | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/core/client.js b/core/client.js index baf0e297..2146a9ef 100644 --- a/core/client.js +++ b/core/client.js @@ -143,6 +143,9 @@ function load() { 'indentWithTabs': true, 'showTrailingSpace': true, }); + gEditor.on('changes', function() { + updateFiles(); + }); } gFiles = {}; var text; @@ -208,6 +211,10 @@ function save() { var appFinished = function(success) { document.getElementById("save").disabled = false; + Object.values(gFiles).forEach(function(file) { + file.doc.markClean(); + }); + updateFiles(); } var always = function() { @@ -584,6 +591,9 @@ function updateFiles() { if (file == gCurrentFile) { li.classList.add("current"); } + if (!gFiles[file].doc.isClean()) { + li.classList.add("dirty"); + } node.appendChild(li); } diff --git a/core/style.css b/core/style.css index 2516b9d9..c88b00dd 100644 --- a/core/style.css +++ b/core/style.css @@ -176,3 +176,7 @@ a:active { font-weight: bold; background-color: #2aa198; } + +#files > li.dirty::after { + content: '*'; +} diff --git a/src/ssb.c b/src/ssb.c index 208a853a..72b2d4b6 100644 --- a/src/ssb.c +++ b/src/ssb.c @@ -1021,7 +1021,7 @@ static void _tf_ssb_connection_rpc_recv(tf_ssb_connection_t* connection, uint8_t callback(connection, flags, request_number, val, NULL, 0, user_data); } } else { - const char* k_unsupported = "{\"message\": \"unsupported message\", \"name\": \"Error\", \"stack\": \"none\"}"; + const char* k_unsupported = "{\"message\": \"unsupported message\", \"name\": \"Error\", \"stack\": \"none\", \"args\": []}"; tf_ssb_connection_rpc_send(connection, k_ssb_rpc_flag_json | k_ssb_rpc_flag_end_error, -request_number, (const uint8_t*)k_unsupported, strlen(k_unsupported), NULL, NULL); }