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

List:       kwrite-devel
Subject:    Re: KDE/kdelibs/kate
From:       Dominik Haumann <dhdev () gmx ! de>
Date:       2010-08-08 10:53:31
Message-ID: 201008081253.31942.dhdev () gmx ! de
[Download RAW message or body]

On Tuesday 03 August 2010, Matthew Woehlke wrote:
> SVN commit 1158818 by
mwoehlke:
> 
> delay trailing-space-removal until config/variables are
parsed
> 
> Move removal of trailing spaces from KateTextBuffer::load to
>
KateDocument::openFile, after config and variable parsing (which might
>
tell us not to remove trailing space!) has been performed. Note that the
>
removal also now goes into the undo stack; for now we're considering
>
this a good thing.

Can we show a message somewhere to tell the user why
the buffer is modified? I'm pretty sure we'll have confused users, if a
loaded file is immediately modified. What comes to my mind:
1. a view bar
for showing messages (top or bottom?)
2. use
KTextEditor::View::informationMessage(), it's even implemented by
  
Kate.

Besides that, this should go into the What's-This
tooltip.

Greetings,
Dominik


> BUG: 239077
> 
> 
>  M  +0 -10    
buffer/katetextbuffer.cpp
>  M  +2 -0      document/katebuffer.cpp
>  M 
+10 -0     document/katedocument.cpp
> 
> 
> ---
trunk/KDE/kdelibs/kate/buffer/katetextbuffer.cpp #1158817:1158818
> @@
-545,16 +545,6 @@
>        // get unicode data for this line
>       
const QChar *unicodeData = file.unicode () + offset;
> 
> -      // strip
trailing spaces
> -      if (m_removeTrailingSpaces) {
> -        while
(length > 0) {
> -          if (unicodeData[length-1].isSpace())
> -      
     --length;
> -          else
> -            break;
> -        }
> -   
  }
> -
>        // construct new text line with content from file
>      
 TextLine textLine = TextLine (new TextLineData(QString
> (unicodeData,
length)));
> 
> --- trunk/KDE/kdelibs/kate/document/katebuffer.cpp
#1158817:1158818
> @@ -159,6 +159,8 @@
>    setEndOfLineMode
((EndOfLineMode) m_doc->config()->eol());
> 
>    // remove trailing
spaces?
> +  // NOTE: The buffer won't actually remove trailing space on
load. This
> is because +  // we need to do it later, after the config and
variables
> have been parsed. setRemoveTrailingSpaces
>
(m_doc->config()->removeSpaces());
> 
>    // then, try to load the file
>
--- trunk/KDE/kdelibs/kate/document/katedocument.cpp #1158817:1158818
> @@
-2010,6 +2010,16 @@
>      // read vars
>      readVariables();
> 
> +   
// remove trailing space
> +    // NOTE: wait until now because the config
or variables might tell
> us not to do this! +   
m_buffer->setRemoveTrailingSpaces
> (config()->removeSpaces()); +    if (
m_buffer->removeTrailingSpaces() )
> +    {
> +      int n = lines();
> + 
    while (n--)
> +        removeTrailingSpace (n);
> +    }
> +
>      //
update the md5 digest
>      createDigest( m_digest );


_______________________________________________
KWrite-Devel mailing list
KWrite-Devel@kde.org
https://mail.kde.org/mailman/listinfo/kwrite-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

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