sw/source/ui/index/cnttab.cxx |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

New commits:
commit 87c68c17afc4c7b9d2fd2164f91b0df8bbb20155
Author:     Manish Bera <[email protected]>
AuthorDate: Sun Mar 1 14:27:24 2026 +0530
Commit:     Michael Weghorn <[email protected]>
CommitDate: Tue Mar 10 09:17:02 2026 +0100

    tdf#50050 Make LE component character style match LS
    
    Change-Id: I5a89e26f16d9332375e3a381cc0222a3f271d44d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181214
    Reviewed-by: Michael Weghorn <[email protected]>
    Tested-by: Jenkins

diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index 664d4bb6dc69..6251a5450732 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -3008,10 +3008,10 @@ void SwTokenWindow::InsertAtSelection(const 
SwFormToken& rToken)
         //<insert> LS
         //<insert> LE
         //<insert>
-        bool bPreStartLinkFound = false;
         bool bPreEndLinkFound = false;
 
         SwTOXButton* pExchange = nullptr;
+        SwTOXButton* pMatchingLinkStart = nullptr; // track unmatched LS 
before cursor
 
         auto it = m_aControlList.cbegin();
         for( ; it != m_aControlList.cend() && m_pActiveCtrl != it->get(); ++it 
)
@@ -3025,13 +3025,13 @@ void SwTokenWindow::InsertAtSelection(const 
SwFormToken& rToken)
 
                 if( TOKEN_LINK_START == rNewToken.eTokenType )
                 {
-                    bPreStartLinkFound = true;
+                    pMatchingLinkStart = pButton;
                     pExchange = nullptr;
                 }
                 else if(TOKEN_LINK_END == rNewToken.eTokenType)
                 {
-                    if( bPreStartLinkFound )
-                        bPreStartLinkFound = false;
+                    if (pMatchingLinkStart)
+                        pMatchingLinkStart = nullptr;
                     else
                     {
                         bPreEndLinkFound = false;
@@ -3043,7 +3043,7 @@ void SwTokenWindow::InsertAtSelection(const SwFormToken& 
rToken)
 
         bool bPostLinkStartFound = false;
 
-        if(!bPreStartLinkFound && !bPreEndLinkFound)
+        if(!pMatchingLinkStart && !bPreEndLinkFound)
         {
             for( ; it != m_aControlList.cend(); ++it )
             {
@@ -3075,10 +3075,12 @@ void SwTokenWindow::InsertAtSelection(const 
SwFormToken& rToken)
             }
         }
 
-        if(bPreStartLinkFound)
+        if(pMatchingLinkStart)
         {
             aToInsertToken.eTokenType = TOKEN_LINK_END;
             aToInsertToken.sText =  m_aButtonTexts[TOKEN_LINK_END];
+            const SwFormToken& rStartTok = pMatchingLinkStart->GetFormToken();
+            aToInsertToken.sCharStyleName = rStartTok.sCharStyleName;
         }
 
         if(bPostLinkStartFound)

Reply via email to