[polari] chatView: Fix selection background in chat log
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] chatView: Fix selection background in chat log
- Date: Fri, 12 Sep 2014 17:19:20 +0000 (UTC)
commit 1c6b40911c8bb194f8c2fd63450fffad56210139
Author: Florian Müllner <fmuellner gnome org>
Date: Fri Sep 12 19:04:28 2014 +0200
chatView: Fix selection background in chat log
Commit 701e9ee7cfe7 fixed a gray border around the chat log, but broke
text selection (.polari-chat-log beats GtkTextView:selected ...)
So make it work without custom CSS, which will hopefully prove more
robust to breakage ...
data/resources/application.css | 8 --------
src/chatView.js | 15 ++++++++-------
2 files changed, 8 insertions(+), 15 deletions(-)
---
diff --git a/data/resources/application.css b/data/resources/application.css
index abcc483..09b5444 100644
--- a/data/resources/application.css
+++ b/data/resources/application.css
@@ -76,14 +76,6 @@
background-color: mix(@theme_unfocused_selected_bg_color, @theme_unfocused_selected_fg_color, 0.1);
}
-.polari-chat-log {
- background-color: @theme_base_color;
-}
-
-.polari-chat-log:backdrop {
- background-color: @theme_unfocused_base_color;
-}
-
.irc-feedback {
color: @theme_fg_color;
background-color: @theme_bg_color;
diff --git a/src/chatView.js b/src/chatView.js
index 7f66fe2..b5b6000 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -25,6 +25,8 @@ const NUM_LOG_EVENTS = 10; // number of log events to fetch when requesting more
const INDICATOR_OFFSET = 5; // TODO: should be based on line spacing
+const MARGIN = 6;
+
// Workaround for GtkTextView growing horizontally over time when
// added to a GtkScrolledWindow with horizontal scrolling disabled
const TextView = new Lang.Class({
@@ -150,7 +152,7 @@ const ChatView = new Lang.Class({
let tagTable = buffer.get_tag_table();
let tags = [
{ name: 'nick',
- left_margin: 0 },
+ left_margin: MARGIN },
{ name: 'gap',
pixels_above_lines: 10 },
{ name: 'message',
@@ -158,16 +160,16 @@ const ChatView = new Lang.Class({
{ name: 'highlight',
weight: Pango.Weight.BOLD },
{ name: 'status',
- left_margin: 0,
+ left_margin: MARGIN,
indent: 0,
justification: Gtk.Justification.RIGHT },
{ name: 'timestamp',
- left_margin: 0,
+ left_margin: MARGIN,
indent: 0,
weight: Pango.Weight.BOLD,
justification: Gtk.Justification.RIGHT },
{ name: 'action',
- left_margin: 0 },
+ left_margin: MARGIN },
{ name: 'url',
underline: Pango.Underline.SINGLE
}
@@ -227,8 +229,7 @@ const ChatView = new Lang.Class({
this._view = new TextView({ editable: false, cursor_visible: false,
visible: true,
wrap_mode: Gtk.WrapMode.WORD_CHAR,
- border_width: 6 });
- this._view.get_style_context().add_class('polari-chat-log');
+ right_margin: MARGIN });
this.widget.add(this._view);
this.widget.show_all();
@@ -321,7 +322,7 @@ const ChatView = new Lang.Class({
tabs.set_tab(0, Pango.TabAlign.LEFT, this._maxNickChars * pixelWidth);
this._view.tabs = tabs;
this._view.indent = -this._maxNickChars * pixelWidth;
- this._view.left_margin = this._maxNickChars * pixelWidth;
+ this._view.left_margin = MARGIN + this._maxNickChars * pixelWidth;
},
_updateActive: function() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]