Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: frithjofh on September 16, 2016, 09:25:11 pm

Title: small enhancement to statusbar - show current position of caret
Post by: frithjofh on September 16, 2016, 09:25:11 pm
hi everybody,

I made a small patch to make the status bar of the main window show the current caret position besides the line number and column number.

patch file and screen shot attached.

regards
Title: Re: small enhancement to statusbar - show current position of caret
Post by: oBFusCATed on September 17, 2016, 12:36:47 am
What is the purpose of this position?
Title: Re: small enhancement to statusbar - show current position of caret
Post by: frithjofh on September 17, 2016, 08:49:59 am
it helps when writing code for searching tokens or parsing text. often such code uses indices into the text to identify starting points and ending points of tokens. having the caret position shown on status bar helps a lot when tracking and assuring the correct behaviour of such parsing code
Title: Re: small enhancement to statusbar - show current position of caret
Post by: ollydbg on September 17, 2016, 09:35:42 am
it helps when writing code for searching tokens or parsing text. often such code uses indices into the text to identify starting points and ending points of tokens. having the caret position shown on status bar helps a lot when tracking and assuring the correct behaviour of such parsing code
For example, when developing CodeCompletion plugin, I often need the such position value. Maybe other plugin devs need this feature too.

But for a normal C::B user, does he need that feature?
Title: Re: small enhancement to statusbar - show current position of caret
Post by: frithjofh on September 17, 2016, 09:40:39 am
i would not know... but the feature is very unobtrusive, and line number and column number are already there, equally useful or not to normal users
Title: Re: small enhancement to statusbar - show current position of caret
Post by: ollydbg on September 17, 2016, 11:04:49 am
OK, and I have no objection about this change.  :)
Title: Re: small enhancement to statusbar - show current position of caret
Post by: rlb on September 19, 2016, 09:14:08 am
it helps when writing code for searching tokens or parsing text. often such code uses indices into the text to identify starting points and ending points of tokens. having the caret position shown on status bar helps a lot when tracking and assuring the correct behaviour of such parsing code
But for a normal C::B user, does he need that feature?
Speaking as a normal user, not at all; but it isn't a hinder, either. So my opinion would be neutral.
Title: Re: small enhancement to statusbar - show current position of caret
Post by: frithjofh on May 21, 2017, 08:01:22 pm
hello. as far as i can see, this patch hasn't been applied nor discarded... is it going to make into the codebase?
Title: Re: small enhancement to statusbar - show current position of caret
Post by: oBFusCATed on May 22, 2017, 08:56:55 am
I've probably forgotten to apply it.
Title: Re: small enhancement to statusbar - show current position of caret
Post by: oBFusCATed on May 28, 2017, 05:27:37 pm
In svn, thanks for the contribution.
Title: Re: small enhancement to statusbar - show current position of caret
Post by: White-Tiger on June 01, 2017, 07:45:28 pm
weird enough... a byte position usually used with binary files is useful enough for a C/C++ IDE, but a string (selection) length (http://forums.codeblocks.org/index.php/topic,12886.msg91952.html) isn't even though it's hard to develop in C/C++ without it... (in a meaningful way without relying on strcpy(), std:: etc.)
Title: Re: small enhancement to statusbar - show current position of caret
Post by: oBFusCATed on June 01, 2017, 07:58:19 pm
I don't understand your comment. Can you clarify what do you mean with it?

If you ask me I'd never use this position, so I can't comment on the usefulness of the feature.
There was a patch, the author reminded me, I've looked at it and I've committed it.
Your patch has not been rejected, so if you've reminded us we could have applied it first.

Now if your patch differs to the one applied in behaviour you'll need to provide a configuration option or negotiate with the patch author that your behaviour is better and provide a patch to change the behaviour.
Title: Re: small enhancement to statusbar - show current position of caret
Post by: White-Tiger on June 01, 2017, 09:20:54 pm
no.. my patch added a different kind of thing... yet it's now a merge conflict of course..
If there is a "configuration" option to add.. it would have to be a customizable as in a custom format string to be applied.. Which also means to have a meaningful default.

Also, I didn't try to neglect the use of a binary position, it's just that I wouldn't assume to edit binary files through an IDE... (and yes, those could be text files as well as with the CC example)

What might work as well, is different presets for the status bar row... like cycling through possible "sets" by clicking them...
Title: Re: small enhancement to statusbar - show current position of caret
Post by: oBFusCATed on June 02, 2017, 10:21:22 pm
I don't think a custom format string is needed or worth it. Just make the most obvious combinations.

I'm not sure what is better - adding a button like the highlight language button or just adding a configuration option in the settings.
The buttons in the status bar are looking pretty bad when using wx3.x on linux (not sure what is the behaviour on windows). I'll have to investigate this anyway...
Title: Re: small enhancement to statusbar - show current position of caret
Post by: LETARTARE on July 09, 2017, 06:49:30 pm
Hello,
I find that with this change, the place to see the full path of the current file is reduced.
It seems to me more useful to see the path of the file used this change (See attached image)
Title: Re: small enhancement to statusbar - show current position of caret
Post by: oBFusCATed on July 09, 2017, 09:49:47 pm
What is the DPI of your monitor?
For you every block looks bigger than necessary!
Title: Re: small enhancement to statusbar - show current position of caret
Post by: LETARTARE on July 10, 2017, 08:04:07 am
Thank you for your reply.

Monitor ASUS VK221D, 21 inches  (18.5x11.5 inch), 1440x900 pixels
width = 77.8 dpi,  height = 78.2 dpi

The previous image using a font size of 120 ppp

The attached image uses a font size of 96 ppp, but this size is not easy to read !


Title: Re: small enhancement to statusbar - show current position of caret
Post by: frithjofh on July 10, 2017, 10:04:52 am
it doesn’t seem to have very much to do with the change to the field on the status bar. the width of the field didn't change that much... most of the needed space for the new information i took from the already present text making it shorter. the effect shown in your screen shot is not the image i see on my machine. why are all of the fields so long on your machine? there is something else wrong here...
Title: Re: small enhancement to statusbar - show current position of caret
Post by: LETARTARE on July 10, 2017, 10:22:10 am
Thank you.

I use 'svn11112'.

Could you make a picture showing all of your status bar?
Title: Re: small enhancement to statusbar - show current position of caret
Post by: frithjofh on July 10, 2017, 11:17:06 am
sure :)
Title: Re: small enhancement to statusbar - show current position of caret
Post by: LETARTARE on July 10, 2017, 11:31:33 am
Your monitor width is about 1900 pixels, is 460 pixels more than my monitor : which is why you have a large space for file paths.


Title: Re: small enhancement to statusbar - show current position of caret
Post by: frithjofh on July 10, 2017, 11:58:09 am
i am aware of that. but i do think that the fields on your machine are wider than on mine... could be mistaken though  ::)
Title: Re: small enhancement to statusbar - show current position of caret
Post by: White-Tiger on July 10, 2017, 02:38:32 pm
well.. on my machine (Win10) it looks quite the same as in the second screenshot. (here (http://"http://forums.codeblocks.org/index.php/topic,21439.msg149959.html#msg149959"))
just that my "Line, Col, Pos" is bigger.