Author Topic: small enhancement to statusbar - show current position of caret  (Read 12453 times)

Offline frithjofh

  • Regular
  • ***
  • Posts: 376
small enhancement to statusbar - show current position of caret
« 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
architect with some spare time  -  c::b compiled from last svn  -   openSuSE leap x86_64  -  AMD FX-4100

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: small enhancement to statusbar - show current position of caret
« Reply #1 on: September 17, 2016, 12:36:47 am »
What is the purpose of this position?
(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 frithjofh

  • Regular
  • ***
  • Posts: 376
Re: small enhancement to statusbar - show current position of caret
« Reply #2 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
architect with some spare time  -  c::b compiled from last svn  -   openSuSE leap x86_64  -  AMD FX-4100

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: small enhancement to statusbar - show current position of caret
« Reply #3 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?
« Last Edit: September 17, 2016, 11:03:40 am 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 frithjofh

  • Regular
  • ***
  • Posts: 376
Re: small enhancement to statusbar - show current position of caret
« Reply #4 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
architect with some spare time  -  c::b compiled from last svn  -   openSuSE leap x86_64  -  AMD FX-4100

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: small enhancement to statusbar - show current position of caret
« Reply #5 on: September 17, 2016, 11:04:49 am »
OK, and I have no objection about this change.  :)
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 rlb

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: small enhancement to statusbar - show current position of caret
« Reply #6 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.
Richard Bos

Offline frithjofh

  • Regular
  • ***
  • Posts: 376
Re: small enhancement to statusbar - show current position of caret
« Reply #7 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?
architect with some spare time  -  c::b compiled from last svn  -   openSuSE leap x86_64  -  AMD FX-4100

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: small enhancement to statusbar - show current position of caret
« Reply #8 on: May 22, 2017, 08:56:55 am »
I've probably forgotten to apply it.
(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 oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: small enhancement to statusbar - show current position of caret
« Reply #9 on: May 28, 2017, 05:27:37 pm »
In svn, thanks for the contribution.
(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 White-Tiger

  • Multiple posting newcomer
  • *
  • Posts: 83
Re: small enhancement to statusbar - show current position of caret
« Reply #10 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 isn't even though it's hard to develop in C/C++ without it... (in a meaningful way without relying on strcpy(), std:: etc.)
Windoze 8.1 x86_64 16GiB RAM, wxWidgets-2.8x (latest,trunk), MinGW-builds (latest, posix-threads)
Code::Blocks (x86 , latest , selection length patch , build option fixes/additions , toggle comments)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: small enhancement to statusbar - show current position of caret
« Reply #11 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.
(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 White-Tiger

  • Multiple posting newcomer
  • *
  • Posts: 83
Re: small enhancement to statusbar - show current position of caret
« Reply #12 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...
Windoze 8.1 x86_64 16GiB RAM, wxWidgets-2.8x (latest,trunk), MinGW-builds (latest, posix-threads)
Code::Blocks (x86 , latest , selection length patch , build option fixes/additions , toggle comments)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: small enhancement to statusbar - show current position of caret
« Reply #13 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...
(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 LETARTARE

  • Lives here!
  • ****
  • Posts: 531
  • L'ami de l'homme.The friend of man.
    • LETARTARE
Re: small enhancement to statusbar - show current position of caret
« Reply #14 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)
CB-13483, plugins-sdk-2.25.0 : Collector-2.0.0, AddOnForQt-3.9.1
1-Win7 Business Pack1 64bits : wx-3.2.4, gcc-8.1.0,
2-OpenSuse::Leap-15.4-64bits : wx-3.2.4;gtk3, gcc-8.2.1,
=> !! The messages are translated by Deepl