[polari/wip/raresv/nick-popover: 28/33] chatView: Don't mingle separating whitespace with nick



commit 77c28b8dd87ac061c1c5d2e2d38152491c01ef9f
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Jul 28 22:57:02 2015 +0200

    chatView: Don't mingle separating whitespace with nick
    
    We get away with piggy-backing the '\t' character that separates nick
    and message with the former as long as the style we apply to the nick
    doesn't affect whitespace - this is about to change, so insert the
    whitespace separately.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=760853

 src/chatView.js |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/chatView.js b/src/chatView.js
index d634916..4427e0f 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -1168,18 +1168,20 @@ const ChatView = new Lang.Class({
                 let tags = [this._lookupTag('nick')];
                 let nickTagName = this._getNickTagName(message.nick);
                 let nickTag = this._lookupTag(nickTagName);
+                let buffer = this._view.get_buffer();
 
                 if (!nickTag) {
                     nickTag = new Gtk.TextTag({ name: nickTagName });
 
                     this._updateNickTag(nickTag, this._userTracker.getNickStatus(message.nick));
 
-                    this._view.get_buffer().get_tag_table().add(nickTag);
+                    buffer.get_tag_table().add(nickTag);
                 }
                 tags.push(nickTag);
                 if (needsGap)
                     tags.push(this._lookupTag('gap'));
-                this._insertWithTags(iter, message.nick + '\t', tags);
+                this._insertWithTags(iter, message.nick, tags);
+                buffer.insert(iter, '\t', -1);
             }
             state.lastNick = message.nick;
             tags.push(this._lookupTag('message'));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]