[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: KDE/kdelibs/kate
From:       Dominik Haumann <dhdev () gmx ! de>
Date:       2010-09-19 22:14:45
Message-ID: 201009200014.46044.dhdev () gmx ! de
[Download RAW message or body]

Does that partly fix https://bugs.kde.org/show_bug.cgi?id=243740 ?

Greetings,
Dominik

On Samstag, 18. September 2010, Pascal Létourneau wrote:
> SVN commit 1176817 by pletourn:
> 
> Speed up highlighing on context change by doing it as needed
> 
> 
>  M  +16 -10    document/katebuffer.cpp
>  M  +1 -0      document/katebuffer.h
>  M  +2 -0      view/kateviewinternal.cpp
> 
> 
> --- trunk/KDE/kdelibs/kate/document/katebuffer.cpp #1176816:1176817
> @@ -72,6 +72,7 @@
>     m_regionTree (this),
>     m_tabWidth (8),
>     m_lineHighlighted (0),
> +   m_ctxChanged (true),
>     m_maxDynamicContexts (KATE_MAX_DYNAMIC_CONTEXTS)
>  {
>    // we need kate global to stay alive
> @@ -115,15 +116,12 @@
>        if (editTagLineStart > 0)
>          --editTagLineStart;
> 
> -      bool needContinue = doHighlight (
> +      m_ctxChanged = doHighlight (
>            editTagLineStart,
>            editTagLineEnd,
>            true);
> 
> -      editTagLineStart = editTagLineEnd;
> -
> -      if (needContinue)
> -        m_lineHighlighted = editTagLineStart;
> +      m_lineHighlighted = editTagLineEnd;
>      }
>    }
>  }
> @@ -139,6 +137,7 @@
>    m_brokenEncoding = false;
> 
>    m_lineHighlighted = 0;
> +  m_ctxChanged = true;
>  }
> 
>  bool KateBuffer::openFile (const QString &m_file)
> @@ -243,7 +242,7 @@
>    // update hl until this line + max KATE_HL_LOOKAHEAD
>    int end = qMin(line + KATE_HL_LOOKAHEAD, lines ()-1);
> 
> -  doHighlight ( m_lineHighlighted, end, false );
> +  m_ctxChanged = doHighlight ( m_lineHighlighted, end, m_ctxChanged );
> 
>    m_lineHighlighted = end;
>  }
> @@ -321,6 +320,7 @@
>  void KateBuffer::invalidateHighlighting()
>  {
>    m_lineHighlighted = 0;
> +  m_ctxChanged = true;
>  }
> 
> 
> @@ -421,7 +421,7 @@
> 
>          // doHighlight *shall* do his work. After invalidation, some
> highlight has // been recalculated, but *maybe not* until endLine ! So
> we shall force it manually... -        doHighlight ( m_lineHighlighted,
> endLine, false );
> +        m_ctxChanged = doHighlight ( m_lineHighlighted, endLine, false
> ); m_lineHighlighted = endLine;
> 
>          KateHlManager::self()->setForceNoDCReset(false);
> @@ -458,6 +458,7 @@
>    bool stillcontinue=false;
>    bool indentContinueWhitespace=false;
>    bool indentContinueNextWhitespace=false;
> +  bool ctxChanged = false;
>    // loop over the lines of the block, from startline to endline or end
> of block // if stillcontinue forces us to do so
>    while ( (current_line < lines()) && (stillcontinue || (current_line <=
> endLine)) ) @@ -466,7 +467,7 @@
>      Kate::TextLine textLine = plainLine (current_line);
> 
>      QVector<int> foldingList;
> -    bool ctxChanged = false;
> +    ctxChanged = false;
> 
>      m_highlight->doHighlight (prevLine.data(), textLine.data(),
> foldingList, ctxChanged);
> 
> @@ -685,7 +686,7 @@
>      codeFoldingUpdate = codeFoldingUpdate | retVal_folding;
> 
>      // need we to continue ?
> -    stillcontinue = ctxChanged || indentChanged ||
> indentContinueWhitespace || indentContinueNextWhitespace; +   
> stillcontinue = indentChanged || indentContinueWhitespace ||
> indentContinueNextWhitespace; if (stillcontinue && start_spellchecking <
> 0) {
>        start_spellchecking=current_line;
>      }
> @@ -701,7 +702,12 @@
> 
>    // tag the changed lines !
>    if (invalidate) {
> +    // prevent infinite recursion
> +    int temp = m_lineHighlighted;
> +    m_lineHighlighted = INT_MAX;
>      emit tagLines (startLine, current_line);
> +    m_lineHighlighted = temp;
> +
>      if(start_spellchecking >= 0 && lines() > 0) {
>        emit respellCheckBlock(start_spellchecking,
>                               qMin(lines()-1,
> (last_line_spellchecking==-1)?current_line:last_line_spellchecking)); @@
> -720,7 +726,7 @@
> 
>    // if we are at the last line of the block + we still need to continue
>    // return the need of that !
> -  return stillcontinue;
> +  return ctxChanged;
>  }
> 
>  void KateBuffer::codeFoldingColumnUpdate(int lineNr) {
> --- trunk/KDE/kdelibs/kate/document/katebuffer.h #1176816:1176817
> @@ -251,6 +251,7 @@
>      int m_tabWidth;
> 
>      int m_lineHighlighted;
> +    bool m_ctxChanged;
> 
>      /**
>       * number of dynamic contexts causing a full invalidation
> --- trunk/KDE/kdelibs/kate/view/kateviewinternal.cpp #1176816:1176817
> @@ -3262,6 +3262,8 @@
>    if (editSessionNumber > 0)
>      return;
> 
> +  doc()->buffer().ensureHighlighted(endLine());
> +
>    // fix start position, might have moved from column 0
>    m_startPos.setPosition (m_startPos.line(), 0);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic