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).

stephan 2020-12-27 22:01 trunk
Commit 423ee8101a28fb2e6ceacbe6969831108d30a62dc1104e33a7dcfa9dbbca6720
1 file changed +3
--- src/chat.js
+++ src/chat.js
@@ -149,12 +149,15 @@
149149
if(this.e.inputCurrent === this.e.inputSingle){
150150
this.e.inputCurrent = this.e.inputMulti;
151151
}else{
152152
this.e.inputCurrent = this.e.inputSingle;
153153
}
154
+ const ht1 = D.effectiveHeight(old);
154155
D.addClass(old, 'hidden');
155156
D.removeClass(this.e.inputCurrent, 'hidden');
157
+ const ht2 = D.effectiveHeight(this.e.inputCurrent);
158
+ this.e.messagesWrapper.scrollBy(0, ht2 - ht1);
156159
this.e.inputCurrent.value = old.value;
157160
old.value = '';
158161
return this;
159162
},
160163
/** Enables (if yes is truthy) or disables all elements in
161164
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button