From 0b96b1cd81d244af74ed8229fae1d64ebc6a205d Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Wed, 29 Oct 2014 05:33:13 -0400
Subject: [PATCH] Fix reply scrolling issue with text mode and start message below the quote (#1490114)

---
 program/js/app.js |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/program/js/app.js b/program/js/app.js
index 0fe485a..31544ab 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -3319,7 +3319,7 @@
     if (!this.gui_objects.messageform)
       return false;
 
-    var i, input_from = $("[name='_from']"),
+    var i, pos, input_from = $("[name='_from']"),
       input_to = $("[name='_to']"),
       input_subject = $("input[name='_subject']"),
       input_message = $("[name='_message']").get(0),
@@ -3353,12 +3353,19 @@
     }
 
     if (!html_mode) {
-      this.set_caret_pos(input_message, this.env.top_posting ? 0 : $(input_message).val().length);
+      pos = this.env.top_posting ? 0 : input_message.value.length;
+      this.set_caret_pos(input_message, pos);
+
       // add signature according to selected identity
       // if we have HTML editor, signature is added in callback
       if (input_from.prop('type') == 'select-one') {
         this.change_identity(input_from[0]);
       }
+
+      // scroll to the bottom of the textarea (#1490114)
+      if (pos) {
+        $(input_message).scrollTop(input_message.scrollHeight);
+      }
     }
 
     // check for locally stored compose data

--
Gitblit v1.9.1