Fossil SCM
chat: when toggling between single/multi-line mode, retain the message area scroll position, insofar as its size allows for (e.g. might not work if the history is too short to scroll).
Commit
423ee8101a28fb2e6ceacbe6969831108d30a62dc1104e33a7dcfa9dbbca6720
Parent
299fd6905f52c9c…
1 file changed
+3
+3
| --- src/chat.js | ||
| +++ src/chat.js | ||
| @@ -149,12 +149,15 @@ | ||
| 149 | 149 | if(this.e.inputCurrent === this.e.inputSingle){ |
| 150 | 150 | this.e.inputCurrent = this.e.inputMulti; |
| 151 | 151 | }else{ |
| 152 | 152 | this.e.inputCurrent = this.e.inputSingle; |
| 153 | 153 | } |
| 154 | + const ht1 = D.effectiveHeight(old); | |
| 154 | 155 | D.addClass(old, 'hidden'); |
| 155 | 156 | D.removeClass(this.e.inputCurrent, 'hidden'); |
| 157 | + const ht2 = D.effectiveHeight(this.e.inputCurrent); | |
| 158 | + this.e.messagesWrapper.scrollBy(0, ht2 - ht1); | |
| 156 | 159 | this.e.inputCurrent.value = old.value; |
| 157 | 160 | old.value = ''; |
| 158 | 161 | return this; |
| 159 | 162 | }, |
| 160 | 163 | /** Enables (if yes is truthy) or disables all elements in |
| 161 | 164 |
| --- src/chat.js | |
| +++ src/chat.js | |
| @@ -149,12 +149,15 @@ | |
| 149 | if(this.e.inputCurrent === this.e.inputSingle){ |
| 150 | this.e.inputCurrent = this.e.inputMulti; |
| 151 | }else{ |
| 152 | this.e.inputCurrent = this.e.inputSingle; |
| 153 | } |
| 154 | D.addClass(old, 'hidden'); |
| 155 | D.removeClass(this.e.inputCurrent, 'hidden'); |
| 156 | this.e.inputCurrent.value = old.value; |
| 157 | old.value = ''; |
| 158 | return this; |
| 159 | }, |
| 160 | /** Enables (if yes is truthy) or disables all elements in |
| 161 |
| --- src/chat.js | |
| +++ src/chat.js | |
| @@ -149,12 +149,15 @@ | |
| 149 | if(this.e.inputCurrent === this.e.inputSingle){ |
| 150 | this.e.inputCurrent = this.e.inputMulti; |
| 151 | }else{ |
| 152 | this.e.inputCurrent = this.e.inputSingle; |
| 153 | } |
| 154 | const ht1 = D.effectiveHeight(old); |
| 155 | D.addClass(old, 'hidden'); |
| 156 | D.removeClass(this.e.inputCurrent, 'hidden'); |
| 157 | const ht2 = D.effectiveHeight(this.e.inputCurrent); |
| 158 | this.e.messagesWrapper.scrollBy(0, ht2 - ht1); |
| 159 | this.e.inputCurrent.value = old.value; |
| 160 | old.value = ''; |
| 161 | return this; |
| 162 | }, |
| 163 | /** Enables (if yes is truthy) or disables all elements in |
| 164 |