#406 wrong character count

General (289)

on windows with geany 0.17
If you select a text with 'special chars' like 'é' you will see in status bar (in french) 'sel: 2' but there is only one char selected !


  • dmaphy

    dmaphy - 2009-12-06

    As far as I know this is a known issue with Unicode files in early versions of Geany. Unicode chars need two bytes for displaying a char. If I remember correctly this got fixed in Geany 0.18, so updating your Geany installation is recommended.

  • Nick Treleaven

    Nick Treleaven - 2009-12-07

    I can confirm this still happens with Geany SVN.

  • Enrico Tröger

    Enrico Tröger - 2009-12-08

    I'm not sure it's worth fixing this.
    If we would want ot fix this, we probably would need to analyse the string to check each byte whether it is a full character or part of a multibyte character. While this is quite easy to implement, it would mean to retrieve and iterate over the selection on each status bar update which happens quite often.
    Imagine one selects a whole bunch of lines or even the whole file using Edit->Select all, then Geany would have to load this whole string into the memory, analyse it and discard it again, just to get the character count.
    While thinking about it, we don't need to copy the selection into the memory but still we would need to iterate over it.

  • Enrico Tröger

    Enrico Tröger - 2009-12-08

    Hmm, I was wrong again. We do need to retrieve the selected text (i.e. copy it into memory) to analyse it.
    Maybe this could be implemented in Scintilla itself as there the access to the selected should be cheaper but the basic problem persists.

  • Lex Trotman

    Lex Trotman - 2012-09-14

    The cost of retrieving and analysing the text is too great to perform it on every change of selection. Note that not just detection of Unicode code points but characters made with multiple code points is needed.

  • Lex Trotman

    Lex Trotman - 2012-09-14
    • status: open --> closed-wont-fix

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks