aboutsummaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-03-15 22:01:32 +0100
committerfiaxh <git@mx.ax.lt>2017-03-16 17:56:38 +0100
commitaf49a47cf6c5933a9bcc21f2b7bb20d85be37483 (patch)
tree6f1c993fea5f238a1131d23586d9b8095553dc5b /main/src
parentf277db6cb459c6e7456fb75722b9d57f734c4db6 (diff)
downloaddino-af49a47cf6c5933a9bcc21f2b7bb20d85be37483.tar.gz
dino-af49a47cf6c5933a9bcc21f2b7bb20d85be37483.zip
Fix ChatInput for many lines + small UI changes
Diffstat (limited to 'main/src')
-rw-r--r--main/src/ui/chat_input.vala13
-rw-r--r--main/src/ui/conversation_selector/view.vala2
-rw-r--r--main/src/ui/conversation_summary/message_textview.vala2
3 files changed, 14 insertions, 3 deletions
diff --git a/main/src/ui/chat_input.vala b/main/src/ui/chat_input.vala
index 5030fcea..209869a8 100644
--- a/main/src/ui/chat_input.vala
+++ b/main/src/ui/chat_input.vala
@@ -8,14 +8,16 @@ using Xmpp;
namespace Dino.Ui {
[GtkTemplate (ui = "/org/dino-im/chat_input.ui")]
-public class ChatInput : Grid {
+public class ChatInput : Box {
+ [GtkChild] private ScrolledWindow scrolled;
[GtkChild] private TextView text_input;
private Conversation? conversation;
private StreamInteractor stream_interactor;
private HashMap<Conversation, string> entry_cache = new HashMap<Conversation, string>(Conversation.hash_func, Conversation.equals_func);
private static HashMap<string, string> smiley_translations = new HashMap<string, string>();
+ private int vscrollbar_min_height;
static construct {
smiley_translations[":)"] = "๐Ÿ™‚";
@@ -34,6 +36,8 @@ public class ChatInput : Grid {
public ChatInput(StreamInteractor stream_interactor) {
this.stream_interactor = stream_interactor;
+ scrolled.get_vscrollbar().get_preferred_height(out vscrollbar_min_height, null);
+ scrolled.vadjustment.notify["upper"].connect_after(on_upper_notify);
}
public void initialize_for_conversation(Conversation conversation) {
@@ -93,6 +97,13 @@ public class ChatInput : Grid {
return false;
}
+ private void on_upper_notify() {
+ scrolled.vadjustment.value = scrolled.vadjustment.upper - scrolled.vadjustment.page_size;
+
+ // hack for vscrollbar not requiring space and making textview higher //TODO doesn't resize immediately
+ scrolled.get_vscrollbar().visible = (scrolled.vadjustment.upper > scrolled.max_content_height - 2 * vscrollbar_min_height);
+ }
+
private void check_convert_smiley() {
if (Dino.Settings.instance().convert_utf8_smileys) {
foreach (string smiley in smiley_translations.keys) {
diff --git a/main/src/ui/conversation_selector/view.vala b/main/src/ui/conversation_selector/view.vala
index ae641664..5c1b4dfd 100644
--- a/main/src/ui/conversation_selector/view.vala
+++ b/main/src/ui/conversation_selector/view.vala
@@ -7,7 +7,7 @@ using Dino.Entities;
namespace Dino.Ui.ConversationSelector {
[GtkTemplate (ui = "/org/dino-im/conversation_selector/view.ui")]
-public class View : Grid {
+public class View : Box {
public List conversation_list;
[GtkChild] public SearchEntry search_entry;
diff --git a/main/src/ui/conversation_summary/message_textview.vala b/main/src/ui/conversation_summary/message_textview.vala
index 6474a1a3..28df9a53 100644
--- a/main/src/ui/conversation_summary/message_textview.vala
+++ b/main/src/ui/conversation_summary/message_textview.vala
@@ -35,7 +35,7 @@ public class MessageTextView : TextView {
}
private void format_suffix_urls(string text) {
- int absolute_start = buffer.text.length - text.length;
+ int absolute_start = buffer.text.char_count() - text.char_count();
Regex url_regex = new Regex("""(?i)\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?ยซยปโ€œโ€โ€˜โ€™]))""");
MatchInfo match_info;