Bug 97400 - Unable to unset background colors of certain schema elements
Summary: Unable to unset background colors of certain schema elements
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: part (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-19 05:16 UTC by Luke Sandell
Modified: 2012-03-04 19:30 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luke Sandell 2005-01-19 05:16:20 UTC
Version:            (using KDE KDE 3.3.1)
Installed from:    Compiled From SourcesCompiled From Sources
OS:                Linux

This is really a bug in KatePart; but since there is no such category, I filed it under Kate. This bug pertains to editing the "Normal Text Styles" section of a Schema. If you unset the background color for items "Alert" or "Region Marker", either from the dialog or by manually editing your katesyntaxhighlightingrc, it always resets itself to a default color. If this is the intended behavior, then the dialog should at least give you an error when you try to unset them, rather than simply resetting them without your knowledge. (Although if you deem highlighting necessary for these items, I don't see why it must be with a background color and not some other distinction). At any rate, it's possible to get around your "safeguard" by simply setting the background color of the item to the background color of the window, which has the same effect as unsetting it.
Comment 1 Anders Lund 2005-01-19 11:10:13 UTC
"This is really a bug in KatePart; but since there is no such category, I filed it under Kate. This bug pertains to editing the "Normal Text Styles" section of a Schema."

We have a component here for katepart, as you see :)

"If you unset the background color for items "Alert" or "Region Marker", either from the dialog or by manually editing your katesyntaxhighlightingrc, it always resets itself to a default color."

It seems when I use the 'unset' the dialog does not enable apply. I'll look into why that is. Thank you for reporting.
 
"If this is the intended behavior, then the dialog should at least give you an error when you try to unset them, rather than simply resetting them without your knowledge. (Although if you deem highlighting necessary for these items, I don't see why it must be with a background color and not some other distinction)."

You should be able to configure the styles just as you like.

"At any rate, it's possible to get around your "safeguard" by simply setting the background color of the item to the background color of the window, which has the same effect as unsetting it."

What on earth do you mean? The highlight system is meant as a aid *for you* to make using your text easier.
Comment 2 Luke Sandell 2005-01-19 16:23:26 UTC
> What on earth do you mean? The highlight system is meant as a aid *for you*
> to make using your text easier. 

I understand the purpose of highlighting ;-) I *assumed* that the reason unsetting background highlighting for those items was not allowed was because you wanted the user to always be aware of them, hence a "safeguard." I guess I assumed wrong.

> We have a component here for katepart, as you see.

Yeah, the only problem was when I chose the application the description of KatePart was "embedding in other applications like Konqueror, Quanta, ..." so since this is specific to other applications I didn't know whether it applied.

Confused yet?

Comment 3 Luke Sandell 2005-01-19 16:33:17 UTC
Wait.. there's more!

> It seems when I use the 'unset' the dialog does not enable apply. I'll look
> into why that is. Thank you for reporting. 

Oddly enough, I do not even have an Apply button! All I have is OK and Cancel!

Furthermore, this couldn't be the problem, because even when I edit "kateschemarc" manually and then run Kate, the colors are reset as soon as I open the dialog. So it can't be the Apply button.
Comment 4 Anders Lund 2005-01-19 16:45:01 UTC
The apply button will be new in KDE 3.4.
And the error is otherwhere (I belive the highlight loader uses the default color if the config entry is empty, but i didn't get to look at it yet). So the report is very much in place, and I'm also going ot fix it.

Confused yet? 
No, but I know its complex.. :)
Comment 5 Anders Lund 2005-01-20 16:38:13 UTC
CVS commit by alund: 

Save a string indicating if a background color is explicitly unset.
BUG: 97400


  M +18 -5     katehighlight.cpp   1.213


--- kdelibs/kate/part/katehighlight.cpp  #1.212:1.213
@@ -3210,8 +3210,21 @@ void KateHlManager::getDefaults(uint sch
 
       tmp=s[6]; if (!tmp.isEmpty()) {
-         col=tmp.toUInt(0,16); i->setBGColor(col); }
-
+        if ( tmp != "-" )
+        {
+          col=tmp.toUInt(0,16);
+          i->setBGColor(col);
+        }
+        else
+          i->clearAttribute(KateAttribute::BGColor);
+      }
       tmp=s[7]; if (!tmp.isEmpty()) {
-         col=tmp.toUInt(0,16); i->setSelectedBGColor(col); }
+        if ( tmp != "-" )
+        {
+          col=tmp.toUInt(0,16);
+          i->setSelectedBGColor(col);
+        }
+        else
+          i->clearAttribute(KateAttribute::SelectedBGColor);
+      }
     }
   }
@@ -3234,6 +3247,6 @@ void KateHlManager::setDefaults(uint sch
     settings<<(i->itemSet(KateAttribute::StrikeOut)?(i->strikeOut()?"1":"0"):"");
     settings<<(i->itemSet(KateAttribute::Underline)?(i->underline()?"1":"0"):"");
-    settings<<(i->itemSet(KateAttribute::BGColor)?QString::number(i->bgColor().rgb(),16):"");
-    settings<<(i->itemSet(KateAttribute::SelectedBGColor)?QString::number(i->selectedBGColor().rgb(),16):"");
+    settings<<(i->itemSet(KateAttribute::BGColor)?QString::number(i->bgColor().rgb(),16):"-");
+    settings<<(i->itemSet(KateAttribute::SelectedBGColor)?QString::number(i->selectedBGColor().rgb(),16):"-");
     settings<<"---";
 


Comment 6 Dominik Haumann 2012-03-04 19:30:03 UTC
Git commit 8021a3c937a062d45362df1f2f0ae082574f6c58 by Dominik Haumann.
Committed on 04/03/2012 at 20:25.
Pushed by dhaumann into branch 'KDE/4.8'.

backport: make unset background colors work again
Related: bug 242576

M  +2    -2    part/syntax/katesyntaxmanager.cpp

http://commits.kde.org/kate/8021a3c937a062d45362df1f2f0ae082574f6c58