From 813fe933553482a014cbf1b2ff0388c86678febb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20H=C3=BCbschle-Schneider?= Date: Sun, 18 Mar 2018 12:32:57 +0100 Subject: [PATCH 1/2] Don't put hidden angle brackets around actions and other non-messages Fixes #616 --- index.html | 2 +- js/models.js | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index e8063ce..c3caae3 100644 --- a/index.html +++ b/index.html @@ -334,7 +334,7 @@ npm run build-electron-{windows, darwin, linux} - <>
diff --git a/js/models.js b/js/models.js index 5e5a0f9..a8f6432 100644 --- a/js/models.js +++ b/js/models.js @@ -359,6 +359,11 @@ models.service('models', ['$rootScope', '$filter', 'bufferResume', function($roo var highlight = message.highlight; var content = parseRichText(message.message); + // only put invisible angle brackets around nicks in normal messages + // (for copying/pasting) + var showHiddenBrackets = (tags_array.indexOf('irc_privmsg') >= 0 && + tags_array.indexOf('irc_action') === -1); + if (highlight) { prefix.forEach(function(textEl) { textEl.classes.push('highlight'); @@ -386,8 +391,8 @@ models.service('models', ['$rootScope', '$filter', 'bufferResume', function($roo highlight: highlight, displayed: displayed, prefixtext: prefixtext, - text: rtext - + text: rtext, + showHiddenBrackets: showHiddenBrackets }; }; From 0b506e30dc489511b113048657a946c8dd3221f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20H=C3=BCbschle-Schneider?= Date: Sun, 18 Mar 2018 16:36:04 +0100 Subject: [PATCH 2/2] Don't insert mention when clicking non-privmsg This goes in the direction of #860 but actually removing the tag seems to be rather more involved --- index.html | 2 +- js/inputbar.js | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index c3caae3..b345cca 100644 --- a/index.html +++ b/index.html @@ -334,7 +334,7 @@ npm run build-electron-{windows, darwin, linux} - <>
diff --git a/js/inputbar.js b/js/inputbar.js index 726db97..a219cb9 100644 --- a/js/inputbar.js +++ b/js/inputbar.js @@ -208,7 +208,12 @@ weechat.directive('inputBar', function() { }; //XXX THIS DOES NOT BELONG HERE! - $rootScope.addMention = function(prefix) { + $rootScope.addMention = function(bufferline) { + if (!bufferline.showHiddenBrackets) { + // the line is a notice or action or something else that doesn't belong + return; + } + var prefix = bufferline.prefix; // Extract nick from bufferline prefix var nick = prefix[prefix.length - 1].text;