Bug 54241 - Folding Markers reappear when you save document
Summary: Folding Markers reappear when you save document
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: kwrite (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
: 57957 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-02-07 13:16 UTC by MikeH
Modified: 2003-05-06 03:58 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description MikeH 2003-02-07 13:16:31 UTC
Version:           4.1 (using KDE 3.1.0)
Installed from:    Gentoo
Compiler:          gcc version 3.2.1
OS:          Linux (i686) release 2.4.19-gentoo-r9

If you have folding markers switched on, then you switch them off, next time you save the document they get switched back on.
Comment 1 Christoph Cullmann 2003-03-06 23:44:07 UTC
you must set your view defaults in the config to "show folding markers if
available" = off
Comment 2 Jens Dagerbo 2003-05-01 15:03:31 UTC
*** Bug 57957 has been marked as a duplicate of this bug. ***
Comment 3 Clarence Dang 2003-05-05 10:40:22 UTC
Subject: kdelibs/kate/part

CVS commit by dang: 


When saving, don't make the Code Folding Markers re-appear if the user
explicitly turned them off for this view.

Of course if you don't want them _at all_ as opposed to just for this time,
then you'll have to switch them off in the "View Defaults" config page.

Without this patch, the behaviour of Kate when saving is senseless (I don't
see how the user could connect saving with the code folding markers
re-appearing when they _deliberately_ turned them off).  This bug has now been
reported twice and closed the same number of times without a proper fix...
ah, well at least it's fixed now :)

CCMAIL: 54241@bugs.kde.org


  M +9 -2      kateview.cpp   1.255
  M +1 -0      kateview.h   1.122


--- kdelibs/kate/part/kateview.cpp  #1.254:1.255
@@ -81,4 +81,5 @@ KateView::KateView( KateDocument *doc, Q
     , m_active( false )
     , m_hasWrap( false )
+    , m_userWantsFoldingMarkersOff( false )
 {
   KateFactory::registerView( this );
@@ -662,5 +663,6 @@ void KateView::slotDropEventPass( QDropE
 void KateView::updateFoldingMarkersAction()
 {
-  setFoldingMarkersOn( m_doc->highlight() && m_doc->highlight()->allowsFolding() && m_doc->m_foldingBar);
+  setFoldingMarkersOn( m_doc->highlight() && m_doc->highlight()->allowsFolding() && m_doc->m_foldingBar &&
+                        !m_userWantsFoldingMarkersOff );
   m_toggleFoldingMarkers->setChecked( foldingMarkersOn() );
   m_toggleFoldingMarkers->setEnabled( m_doc->highlight() && m_doc->highlight()->allowsFolding() );
@@ -899,4 +901,9 @@ void KateView::toggleFoldingMarkers()
 {
   m_viewInternal->leftBorder->toggleFoldingMarkers();
+
+  // if the user has turned off View/Show Folding Markers,
+  // then s/he _really_ doesn't want them to reappear when s/he saves
+  // (but probably just for this time else s/he'd change the View Defaults)
+  m_userWantsFoldingMarkersOff = !foldingMarkersOn();
 }
 

--- kdelibs/kate/part/kateview.h  #1.121:1.122
@@ -351,4 +351,5 @@ class KateView : public Kate::View,
     bool       m_active;
     bool       m_hasWrap;
+    bool       m_userWantsFoldingMarkersOff;
 
     private slots:


Comment 4 Anders Lund 2003-05-05 10:50:25 UTC
Subject: Re:  Folding Markers reappear when you save document

On Monday 05 May 2003 10:40, Clarence Dang wrote:

> +    , m_userWantsFoldingMarkersOff( false )

Maybe we should instantiate a bitmask of user settings, to avoid all those 
properties? Wouldn't that be more efficient?

-anders
Comment 5 Clarence Dang 2003-05-06 03:58:16 UTC
> Maybe we should instantiate a bitmask of user settings,
> to avoid all those properties? Wouldn't that be more efficient? 

Well, m_userWantsFoldingMarkersOff does not neccessarily == !foldingMarkersOn()
 - it's only set if the user has _clicked_ on "Show Folding Markers".  If you 
try to invert the logic and change it to m_userWantsFoldingMarkersOn, then it 
probably won't work (have a think about it...).  So it's a strange variable 
and I'm not sure if it could be considered a "property" (after all you can't 
always click on "Show Folding Markers" because sometimes it's greyed out).

As for efficiency, maybe in terms of memory but in terms of performance an 
access to a bit in a bitfield is far slower than accessing an aligned 
int/bool, if that matters.

Comment 6 Anders Lund 2003-05-06 08:53:12 UTC
Subject: Re:  Folding Markers reappear when you save document

On Tuesday 06 May 2003 03:58, Clarence Dang wrote:

> As for efficiency, maybe in terms of memory but in terms of performance an
> access to a bit in a bitfield is far slower than accessing an aligned
> int/bool, if that matters.

It's not a mission critical issue, so speed is not a topic. 

My point is more that since KateDocument/View are big and complex classes, so 
if anytime we discover an inconvenience we add a variable and 5 lines of 
code, the future looks bleak - as long as a common solution within the 
application is possible, which i think is the case here (a similar problem 
with the highlight mode was solved in a similar way).

-anders
Comment 7 Clarence Dang 2003-05-06 14:39:32 UTC
Subject: Re:  Folding Markers reappear when you save document

On Tue, 6 May 2003 04:53 pm, Anders Lund wrote:
> On Tuesday 06 May 2003 03:58, Clarence Dang wrote:
> > As for efficiency, maybe in terms of memory but in terms of performance
> > an access to a bit in a bitfield is far slower than accessing an aligned
> > int/bool, if that matters.
>
> It's not a mission critical issue, so speed is not a topic.
>
Fine, but you asked "Wouldn't that be more efficient?" after all...

> My point is more that since KateDocument/View are big and complex classes,
> so if anytime we discover an inconvenience we add a variable and 5 lines of
> code, the future looks bleak - as long as a common solution within the
> application is possible, which i think is the case here (a similar problem
> with the highlight mode was solved in a similar way).
>
Ok, good idea then.

Clarence

Comment 8 Clarence Dang 2003-05-06 14:39:57 UTC
Subject: Re:  Folding Markers reappear when you save document

On Tue, 6 May 2003 04:53 pm, Anders Lund wrote:
> On Tuesday 06 May 2003 03:58, Clarence Dang wrote:
> > As for efficiency, maybe in terms of memory but in terms of performance
> > an access to a bit in a bitfield is far slower than accessing an aligned
> > int/bool, if that matters.
>
> It's not a mission critical issue, so speed is not a topic.
>
Fine, but you asked "Wouldn't that be more efficient?" after all...

> My point is more that since KateDocument/View are big and complex classes,
> so if anytime we discover an inconvenience we add a variable and 5 lines of
> code, the future looks bleak - as long as a common solution within the
> application is possible, which i think is the case here (a similar problem
> with the highlight mode was solved in a similar way).
>
Ok, good idea then.

Clarence