cui/source/dialogs/SpellDialog.cxx |   11 ++++++++++-
 cui/source/inc/SpellDialog.hxx     |    1 +
 cui/uiconfig/ui/spellingdialog.ui  |    3 +++
 3 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit c23731b40ee1ddef1b54e7c5c1876d38169cb6c9
Author:     Caolán McNamara <[email protected]>
AuthorDate: Wed Feb 4 13:54:11 2026 +0000
Commit:     Caolán McNamara <[email protected]>
CommitDate: Wed Feb 4 18:31:40 2026 +0100

    Resolves: tdf#170524 Lock in the start size request including scrollbar 
width
    
    Turn vertical scrollbar on by default, at dialog start measure width
    including the vertical scrollbar that might be needed later in the
    lifetime of the dialog even if it doesn't need it at startup time and
    lock that width in as the widget size request.
    
    That way it the scrollbar is needed later there is space for it without
    obscuring the text area.
    
    Change-Id: If4ad912d3d6eb6650ae1c891ffd7fdbbf12c0c39
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198686
    Reviewed-by: Caolán McNamara <[email protected]>
    Tested-by: Jenkins

diff --git a/cui/source/dialogs/SpellDialog.cxx 
b/cui/source/dialogs/SpellDialog.cxx
index c52f0e61df01..d681e4f4d856 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -255,7 +255,7 @@ SpellDialog::SpellDialog(SpellDialogChildWindow* 
pChildWindow,
 
     Size aEdSize(m_xSuggestionLB->get_approximate_digit_width() * 60,
                  m_xSuggestionLB->get_height_rows(6));
-    m_xSuggestionLB->set_size_request(aEdSize.Width(), -1);
+    m_xSuggestionLB->set_size_request(aEdSize.Width(), aEdSize.Height());
     m_sIgnoreOnceST = m_xIgnorePB->get_label();
     m_xAddToDictMB->set_help_id(m_xAddToDictPB->get_help_id());
     xSpell = LinguMgr::GetSpellChecker();
@@ -1218,6 +1218,11 @@ void 
SentenceEditWindow_Impl::SetDrawingArea(weld::DrawingArea* pDrawingArea)
     SetDocumentColor(pDrawingArea);
 }
 
+void SentenceEditWindow_Impl::SetSizeRequest()
+{
+    
m_xScrolledWindow->set_size_request(m_xScrolledWindow->get_preferred_size().Width(),
 -1);
+}
+
 void SentenceEditWindow_Impl::SetDocumentColor(weld::DrawingArea* pDrawingArea)
 {
     if (!pDrawingArea || !m_xEditView || !m_xEditEngine)
@@ -1690,6 +1695,10 @@ void SentenceEditWindow_Impl::Init(weld::Toolbar* 
pToolbar)
 {
     m_pToolbar = pToolbar;
     m_pToolbar->connect_clicked(LINK(this,SentenceEditWindow_Impl,ToolbarHdl));
+    // tdf#170524 Lock in the starting size request including space required
+    // for a vertical scrollbar that might be needed later in the lifetime of
+    // the dialog even if it doesn't need it at startup time.
+    SetSizeRequest();
 }
 
 IMPL_LINK(SentenceEditWindow_Impl, ToolbarHdl, const OUString&, rCurItemId, 
void)
diff --git a/cui/source/inc/SpellDialog.hxx b/cui/source/inc/SpellDialog.hxx
index 162c2bd28dae..156b8ae8f24d 100644
--- a/cui/source/inc/SpellDialog.hxx
+++ b/cui/source/inc/SpellDialog.hxx
@@ -75,6 +75,7 @@ private:
 
     void DoScroll();
     void SetScrollBarRange();
+    void SetSizeRequest();
 
 protected:
     virtual bool    KeyInput( const KeyEvent& rKEvt ) override;
diff --git a/cui/uiconfig/ui/spellingdialog.ui 
b/cui/uiconfig/ui/spellingdialog.ui
index c18353fc1557..e4b2d822c253 100644
--- a/cui/uiconfig/ui/spellingdialog.ui
+++ b/cui/uiconfig/ui/spellingdialog.ui
@@ -278,8 +278,10 @@
               <object class="GtkScrolledWindow" id="scrolledwindow">
                 <property name="visible">True</property>
                 <property name="can-focus">True</property>
+                <property name="hexpand">True</property>
                 <property name="border-width">0</property>
                 <property name="hscrollbar-policy">never</property>
+                <property name="vscrollbar-policy">always</property>
                 <property name="shadow-type">in</property>
                 <child>
                   <object class="GtkViewport">
@@ -290,6 +292,7 @@
                         <property name="visible">True</property>
                         <property name="can-focus">True</property>
                         <property name="events">GDK_BUTTON_MOTION_MASK | 
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | 
GDK_KEY_RELEASE_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK</property>
+                        <property name="hexpand">True</property>
                         <child internal-child="accessible">
                           <object class="AtkObject" 
id="errorsentence-atkobject">
                             <property name="AtkObject::accessible-description" 
translatable="yes" context="spellingdialog|extended_tip|sentence">Displays the 
sentence with the misspelled word highlighted. Edit the word or the sentence, 
or click one of the suggestions in the text box below.</property>

Reply via email to