Author Topic: New feature: whitespace colour  (Read 5925 times)

Offline yvesdm3000

  • Almost regular
  • **
  • Posts: 225
New feature: whitespace colour
« on: October 04, 2015, 03:57:46 pm »
I added a feature to CB to alter the colour of whitespace.

I think this should be base functionality, no idea if it can be implemented as a plugin or if it's worth it to do so...

Signed-off-by: Yves De Muyter <yves@alfavisio.be>
Clang based code completion for Code::Blocks:   http://github.com/yvesdm3000/ClangLib

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: New feature: whitespace colour
« Reply #1 on: October 04, 2015, 04:08:21 pm »
Can you show a screenshot depicting the use case for this feature?
I'm not sure I understand why someone will choose different colour than the background colour in the syntax highlight.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5916
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New feature: whitespace colour
« Reply #2 on: October 04, 2015, 04:16:06 pm »
About this topic, some program like Notepad++ can show the "white space" and "tab" as a special characters(dot and arrow), see image shot below, which I though is a quite nice feature. :)



EDIT: it looks like C::B already has this feature. ;)
« Last Edit: October 04, 2015, 04:17:55 pm by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline yvesdm3000

  • Almost regular
  • **
  • Posts: 225
Re: New feature: whitespace colour
« Reply #3 on: October 04, 2015, 04:31:42 pm »
ollydbg : Good news,  Code::Blocks can do this allready !

But with latest SVN version, you can't alter it's colour, it simply uses the normal text colour and I find that a bit too intrusive.

In this screenshot, I altered the default to use a light grey. You hardly notice it unless you need it, which is way better than the black it had before. About any other editor that I know of and tried can do this, and once you get used to a feature and you change apps, you start to miss it...

A lot of other editors and Scintilla also allows you to set the whitespace background color and the size of the dot, but I don't really see the use for these extra features so I didn't add them (although it would be very easy to add them)

-Yves
« Last Edit: October 04, 2015, 07:57:42 pm by yvesdm3000 »
Clang based code completion for Code::Blocks:   http://github.com/yvesdm3000/ClangLib

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: New feature: whitespace colour
« Reply #4 on: October 04, 2015, 05:13:20 pm »
So this allows changing the colour of the white space special character when they are shown?

BTW: The screen shot doesn't show.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline yvesdm3000

  • Almost regular
  • **
  • Posts: 225
Re: New feature: whitespace colour
« Reply #5 on: October 04, 2015, 07:58:32 pm »
So this allows changing the colour of the white space special character when they are shown?

That's correct.

BTW: I updated the image with a better one.
Clang based code completion for Code::Blocks:   http://github.com/yvesdm3000/ClangLib

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: New feature: whitespace colour
« Reply #6 on: October 04, 2015, 08:14:30 pm »
So this allows changing the colour of the white space special character when they are shown?
That's correct.
I like the idea. I wouldn't mind if this gets applied. I'll give it a try...
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: New feature: whitespace colour
« Reply #7 on: October 04, 2015, 08:17:44 pm »
yvesdm3000: Can you give us rgb values for the color you're using in the screen shot.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline yvesdm3000

  • Almost regular
  • **
  • Posts: 225
Re: New feature: whitespace colour
« Reply #8 on: October 04, 2015, 09:06:23 pm »
Does it matter what colour? The patch I've sent in gives you the choice to select the color and I honestly didn't give that much attention selecting any exact colour, the color I took might even be a little bit too bright.
In any case, if you intend to hardcode it, be aware that a lot of people have black backgrounds and will therefore need another colour (or shade of grey or any other colour like red as in the screenshot from Notepad++)

The colour that I seemed to have picked is #D2D2D2 (R=G=B=210 or H=0, S=0, V=82)

The attached screenshot shows how it's configured.

-Yves
Clang based code completion for Code::Blocks:   http://github.com/yvesdm3000/ClangLib

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: New feature: whitespace colour
« Reply #9 on: October 04, 2015, 09:09:03 pm »
No, I don't want to hard code it, but I don't think black is a good default value.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline yvesdm3000

  • Almost regular
  • **
  • Posts: 225
Re: New feature: whitespace colour
« Reply #10 on: October 04, 2015, 09:37:50 pm »
Oh, I chose black because that was the colour it was before...

-Yves
Clang based code completion for Code::Blocks:   http://github.com/yvesdm3000/ClangLib

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: New feature: whitespace colour
« Reply #11 on: October 20, 2015, 01:32:53 am »
In svn, a bit modified, thank you.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]