commit 830319a2a6e548f85ca9ebfdcbda0b474bdb628c
Author: Juergen Spitzmueller <[email protected]>
Date:   Tue Jul 8 15:27:23 2025 +0200

    Amend ad1675e9919
    
    Consider textwidth and linewidth as well
---
 src/insets/InsetTabular.cpp | 2 +-
 src/support/Length.cpp      | 9 +++++++++
 src/support/Length.h        | 2 ++
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index 97ee6e00b0..89ca6ac943 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -1379,7 +1379,7 @@ bool Tabular::updateColumnWidths(MetricsInfo & mi)
                // we use 100% colwidth
                tab_width = Length(100, Length::PCW);
        int table_width = mi.base.inPixels(tab_width);
-       if (tab_width == Length(100, Length::PCW))
+       if (tab_width.isWorkareaWidth())
                // Subtract the additional widths from the table width
                // to keep the too large markers sleeping
                table_width -= 2 * ADD_TO_TABULAR_WIDTH;
diff --git a/src/support/Length.cpp b/src/support/Length.cpp
index 507c31effe..28fb86bfc6 100644
--- a/src/support/Length.cpp
+++ b/src/support/Length.cpp
@@ -277,6 +277,15 @@ Length::UNIT Length::defaultUnit()
 }
 
 
+bool Length::isWorkareaWidth() const
+{
+       return val_ == 100.0
+               && (unit_ == PCW
+                   || unit_ == PTW
+                   || unit_ == PLW);
+}
+
+
 /////////////////////////////////////////////////////////////////////
 //
 // GlueLength
diff --git a/src/support/Length.h b/src/support/Length.h
index 0a4e1adb1c..cd0ad81012 100644
--- a/src/support/Length.h
+++ b/src/support/Length.h
@@ -80,6 +80,8 @@ public:
        bool zero() const { return val_ == 0.0; }
        ///
        bool empty() const { return unit_ == Length::UNIT_NONE; }
+       /// This amounts to 100% of the workarea width 
+       bool isWorkareaWidth() const;
        /// return string representation
        std::string const asString() const;
        /// return string representation
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to