Recent Posts

Pages: 1 ... 4 5 6 7 8 [9] 10
1. Concentrate on wx 3.1.x, no need to bother deeply with wx2.8
2. I don't think you should bother with utf16 or utf32
3. Have you considered switching to working on lines and not characters? There is this call:
Code: [Select]
wxString GetCurLine(int* linePos=NULL);It gives you the whole line to work with.

4. Also there are these:
Code: [Select]
    // Compact the document buffer and return a read-only pointer to the
    // characters in the document.
    const char* GetCharacterPointer() const;

    // Return a read-only pointer to a range of characters in the document.
    // May move the gap so that the range is contiguous, but will only move up
    // to rangeLength bytes.
    const char* GetRangePointer(int position, int rangeLength) const;
Aren't they useful to give you the whole utf8 character's byte sequence?
Using Code::Blocks / Re: Length of selected text
« Last post by oBFusCATed on May 12, 2019, 10:42:25 am »
Yes, it is getting too long and it doesn't convey that it is length.

After the previous change in this area there was a discussion to make this thing configurable with some kind of a formatting string.
Help / Re: Projects
« Last post by oBFusCATed on May 12, 2019, 10:39:53 am »
Do you have a list of project templates in the dialog for new project creation?
Help / Re: Projects
« Last post by Miguel Gimenez on May 12, 2019, 10:39:15 am »
Where are you trying to create the new projects? Some folders are protected in Windows 10, and there is also a protection against ransomware that prevents modifying files under My documents by "unknown" software. It is off by default, but may be you have it activated.

Are you using spaces, forbidden or non-ASCII characters in the projects's name?
Help / Projects
« Last post by Blackie on May 12, 2019, 06:17:16 am »
I'm using version 17.12 and I can't create new projects. I tried from the 'create a project' on the start up screen and under file under new. It just says can't create new project. No error code given. I'm using Windows 10 on an HP notebook with a one terabyte drive, if that helps. I have no problems on my desktop computer. I can open existing projects on the laptop but not new projects. Please, any help would be appreciated.

PS. Why is the code:blocks manual version 10.5 (or whatever the number is) when you're up to 17.12?
Using Code::Blocks / Re: Length of selected text
« Last post by BlueHazzard on May 12, 2019, 12:49:22 am »
This would be a quite easy fix:
Code: [Select]
diff --git a/src/src/main.cpp b/src/src/main.cpp
index 87e5c5e5c..df2ff0655 100644
--- a/src/src/main.cpp
+++ b/src/src/main.cpp
@@ -2055,7 +2055,7 @@ void MainFrame::DoCreateStatusBar()
     dc.GetTextExtent(_(" Highlight Button "),                &widths[num++], &h);
     dc.GetTextExtent(_(" Windows (CR+LF) "),                 &widths[num++], &h);
     dc.GetTextExtent(_(" WINDOWS-1252 "),                    &widths[num++], &h);
-    dc.GetTextExtent(_(" Line 12345, Col 123, Pos 123456 "), &widths[num++], &h);
+    dc.GetTextExtent(_(" Line 12345, Col 123, Pos 123456, Sel 123456 "), &widths[num++], &h);
     dc.GetTextExtent(_(" Overwrite "),                       &widths[num++], &h);
     dc.GetTextExtent(_(" Modified "),                        &widths[num++], &h);
     dc.GetTextExtent(_(" Read/Write "),                      &widths[num++], &h);
@@ -2127,7 +2127,7 @@ void MainFrame::DoUpdateStatusBar()
         SetStatusText(msg, panel++);
         SetStatusText(ed->GetEncodingName(), panel++);
-        msg.Printf(_("Line %d, Col %d, Pos %d"), control->GetCurrentLine() + 1, control->GetColumn(pos) + 1, pos);
+        msg.Printf(_("Line %d, Col %d, Pos %d, Sel %d"), control->GetCurrentLine() + 1, control->GetColumn(pos) + 1, pos, control->GetSelectionEnd() - control->GetSelectionStart());
         SetStatusText(msg, panel++);
         SetStatusText(control->GetOvertype() ? _("Overwrite") : _("Insert"), panel++);
 #if wxCHECK_VERSION(3, 0, 0)

Does something speaks against this?
Ok, lets summarize all this and look if i have understood all:
1) scintilla uses utf-8 internally
2) wxScintilla::GetCharAt returns a single byte from position pos (so it can return them middle of a code point) but always 1 byte. There is the possibility to find the beginning of the codepoint and extract the full codepoint.
3) All code uses wxChar (aka wchar_t ) to represent one character. This is 2 Bytes on windows and 4 Bytes on UNIX. So we have to implement platform depended code....
4) The plugin basically goes trough every character byte by byte. This will work as long as you use utf-8 or any other "single byte" encoding for your document and the dictionary
5) Hunspell uses UTF-8 but should be able to handle every encoding. In our case we use UTF8 and we should stick to it...
5) Now we hit the wxIspunct (aka iswpunct) function:
5.1) On linux this function kind of works with utf8 because it treads all characters above  0x80 as non punctuation characters (how it should ). But it will not work for Unicode character that are punctuations and non ascii, but this kind of characters are probably rare in the programming space
5.2) On windows this does not work because some characters above 0x80 (at least with the english localization) are treated as punctuation (for example: 0xBB ( ╗ ) ) and if you use a utf8 encoded document you will hit this characters quite fast...

So there are two main problems:
1) We do not handle unicode correctly: wxScintilla::GetCharAt should return the full code point. But here we diverge between unix and windows (wchar_t has different length) As noted top we could probably come away by only using 2 bytes and use utf16 on windows. Why is this needed?
2) wxIspunct (aka iswpunct)  needs the full code point to work correctly. On windows this has to be UTF 16 and on linux probably UTF32 or UTF8 idk...

I really do not feel to rewrite all this in unicode aware code... Specially because wxWidgets does not take the load from us, because we still have to make ... (100% not wx2.8...)
How can we fix this for the next release (or even nightly)?
1) On Linux we do not need to do anything
2) On windows:
2.1) feed only valuse < 0x80 to wxIspunct  or
2.2) Use the code described top that worked until now....

If no big objections i would like do implement 2.2.

There are many punctuation characters outside ascii :( :

i tried to convert utf8 to utf16 with the functions provided with hunspell. they work pretty well, but i still get errors for the russian characters:
Code: [Select]
is alpha:  ( 0x447 ) is alpha: true
( 0x0438 ) is alpha: false
( 0x0441 ) is alpha: true
( 0x043b ) is alpha: false
( 0x043e ) is alpha: false
( 0x0432 ) is alpha: false
( 0x044b ) is alpha: true
( 0x0445 ) is alpha: true
They should all be true... I think this is because i have a english locale set and using isalphaw() with locale does not work for me, because i do not know what locale to set...
After this experiment i even stronger think 2.2 is good enough...
Using Code::Blocks / Re: Length of selected text
« Last post by zdena on May 11, 2019, 06:37:54 pm »
@oBFusCATed: Thank you.

  • It could help me with counting characters in a (long) string if it could fit in a char array.
  • I don't know how. But for example Programmer's Notepad can count it.
  • I am not so good to write scripts.
Using Code::Blocks / Re: Const variables mouse over
« Last post by zdena on May 11, 2019, 06:27:09 pm »
@BlueHazzard: Thank you.
Using Code::Blocks / Re: Length of selected text
« Last post by BlueHazzard on May 11, 2019, 05:12:54 pm »
What would you like to do with it?
How would you like to get it?
I think it would not be to difficult to add a script binding...
Pages: 1 ... 4 5 6 7 8 [9] 10