Author Topic: Selection Length  (Read 4195 times)

Offline White-Tiger

  • Multiple posting newcomer
  • *
  • Posts: 83
Selection Length
« on: July 11, 2010, 05:28:35 pm »
Hello,

I'm using Code::Blocks a while ago and there is something that really pissed me of.
I miss a "Selection Length" within the status bar to see how many bytes/chars i have selected. Currently i have to count them by myself or i have to open Notepad (Notepad2/Notepad++ etc.)

Is there a way to integrate it into Code::Blocks? Sry when it is "easy" to activate/enable but i didn't find anything about that.
And why isn't it there already? I mean it is very helpful and even little editors like Notepad2 have it.

Kind regards
White-Tiger
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 Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Selection Length
« Reply #1 on: July 11, 2010, 05:44:33 pm »
Is there a way to integrate it into Code::Blocks?
I think so.

And why isn't it there already?
As far as I know, nobody ever asked for it.

Offline White-Tiger

  • Multiple posting newcomer
  • *
  • Posts: 83
Re: Selection Length
« Reply #2 on: November 09, 2010, 03:37:13 pm »
So... now finally I did it by myself :P

Before:
After:   

For comparison
Notepad2:   
Notepad++:

I've chosen the Notepad++ layout, just because I think many already know it, and it's also more handy as Code::Blocks current default. You have less to read, so you spend less time to take a look ;)
Also I've removed some spacings, i don't like it when it isn't equal on both ends :P (I know, it isn't yet either, but it's better ;))

Diff
Code
Index: src/src/main.cpp
===================================================================
--- src/src/main.cpp (revision 6843)
+++ src/src/main.cpp (working copy)
@@ -1699,12 +1699,12 @@
 
     width[num++] = -1; // main field
 //    width[num++] = 128; // progress bar
-    dc.GetTextExtent(_(" WINDOWS-1252 "),           &width[num++], &h);
-    dc.GetTextExtent(_(" Line 12345, Column 123 "), &width[num++], &h);
-    dc.GetTextExtent(_(" Overwrite "),              &width[num++], &h);
-    dc.GetTextExtent(_(" Modified "),               &width[num++], &h);
-    dc.GetTextExtent(_(" Read/Write....."),         &width[num++], &h);
-    dc.GetTextExtent(_(" name_of_profile "),        &width[num++], &h);
+    dc.GetTextExtent(_("WINDOWS-1252"),           &width[num++], &h);
+    dc.GetTextExtent(_("Ln : 12345   Col : 1234   Sel : 12345"), &width[num++], &h);
+    dc.GetTextExtent(_("Overwrite"),              &width[num++], &h);
+    dc.GetTextExtent(_("Modified"),               &width[num++], &h);
+    dc.GetTextExtent(_("Read/Write....."),         &width[num++], &h);
+    dc.GetTextExtent(_("name_of_profile"),        &width[num++], &h);
 
     wxStatusBar* sb = CreateStatusBar(num);
     if (sb)
@@ -1736,8 +1736,9 @@
     {
         int panel = 0;
         int pos = ed->GetControl()->GetCurrentPos();
+        long a, b;ed->GetControl()->GetSelection(&a, &b);
         wxString msg;
-        msg.Printf(_("Line %d, Column %d"), ed->GetControl()->GetCurrentLine() + 1, ed->GetControl()->GetColumn(pos) + 1);
+        msg.Printf(_("Ln : %d   Col : %d   Sel : %ld"), ed->GetControl()->GetCurrentLine() + 1, ed->GetControl()->GetColumn(pos) + 1, b-a);
         SetStatusText(ed->GetFilename(), panel++);
         SetStatusText(ed->GetEncodingName(), panel++);
         SetStatusText(msg, panel++);
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)