@@ -1146,21 +1146,18 @@ void Courtroom::append_ic_text(QString p_text, QString p_name)
11461146 const QTextCursor old_cursor = ui_ic_chatlog->textCursor ();
11471147 const int old_scrollbar_value = ui_ic_chatlog->verticalScrollBar ()->value ();
11481148
1149- QTextCursor::MoveOperation move_op;
11501149 int scrollbar_limit;
11511150
11521151 if (ao_app->ic_scroll_down_enabled ()) {
11531152 scrollbar_limit = ui_ic_chatlog->verticalScrollBar ()->maximum ();
1154- move_op = QTextCursor::End;
1153+ ui_ic_chatlog-> moveCursor ( QTextCursor::End) ;
11551154 }
11561155 else {
11571156 scrollbar_limit = ui_ic_chatlog->verticalScrollBar ()->minimum ();
1158- move_op = QTextCursor::Start;
1157+ ui_ic_chatlog-> moveCursor ( QTextCursor::Start) ;
11591158 }
11601159
11611160 const bool is_fully_scrolled = old_scrollbar_value == scrollbar_limit;
1162-
1163- ui_ic_chatlog->moveCursor (move_op);
11641161
11651162 ui_ic_chatlog->textCursor ().insertText (p_name, bold);
11661163 ui_ic_chatlog->textCursor ().insertText (p_text + ' \n ' , normal);
@@ -1174,8 +1171,14 @@ void Courtroom::append_ic_text(QString p_text, QString p_name)
11741171 else
11751172 {
11761173 // The user hasn't selected any text and the scrollbar is at the top: scroll to the top.
1177- ui_ic_chatlog->moveCursor (move_op);
1178- ui_ic_chatlog->verticalScrollBar ()->setValue (scrollbar_limit);
1174+ if (ao_app->ic_scroll_down_enabled ()) {
1175+ ui_ic_chatlog->moveCursor (QTextCursor::End);
1176+ ui_ic_chatlog->verticalScrollBar ()->setValue (ui_ic_chatlog->verticalScrollBar ()->maximum ());
1177+ }
1178+ else {
1179+ ui_ic_chatlog->moveCursor (QTextCursor::Start);
1180+ ui_ic_chatlog->verticalScrollBar ()->setValue (ui_ic_chatlog->verticalScrollBar ()->minimum ());
1181+ }
11791182 }
11801183}
11811184
0 commit comments