I'm tormented by curiosity.
editor.CharAt returns an unsigned integer.
And though conversion is simple (editor.CharAt[x] % 256), in lua unsigned integers are not used.
It is a defect or unfathomable wisdom?
Neil, you will accept a patch?
--
mozers
<http://scite.net.ru>
That's probably because it is a blind, automatic interface to the
# Returns the character byte at the position.
get int GetCharAt=2007(position pos,)
Scintilla message, like most Lua bindings/functions.
Why do you do modulus? You can get more than one byte with Unicode
characters?
--
Philippe Lhoste
-- (near) Paris -- France
-- http://Phi.Lho.free.fr
-- -- -- -- -- -- -- -- -- -- -- -- -- --
> I'm tormented by curiosity.
> editor.CharAt returns an unsigned integer.
Don't you mean signed? The C 'char' type is signed on most commonly
used platforms.
> And though conversion is simple (editor.CharAt[x] % 256), in lua unsigned integers are not used.
> It is a defect or unfathomable wisdom?
> Neil, you will accept a patch?
No. It would break existing code.
Neil
>> And though conversion is simple (editor.CharAt[x] % 256), in lua unsigned integers are not used.
> Why do you do modulus? You can get more than one byte with Unicode characters?
For characters with code from 0 to 127 editor.CharAt returns the correct values.
For characters with code from 128 to 256 editor.CharAt returns a negative value.
e.g.
char=} asciiCode=125 editor.CharAt return 125
char=~ asciiCode=126 editor.CharAt return 126
char= asciiCode=127 editor.CharAt return 127
char=Ђ asciiCode=128 editor.CharAt return -128
char=Ѓ asciiCode=129 editor.CharAt return -127
char=‚ asciiCode=130 editor.CharAt return -126
You can check it
print(editor.CharAt[editor.CurrentPos])
Transform to real ascii code variant 1:
if char_at < 0 then char_at = 256 + char_at end
Transform to real ascii code variant 2:
char_at = char_at % 256
--
mozers
<http://scite.net.ru>
>> editor.CharAt returns an unsigned integer.
> Don't you mean signed? The C 'char' type is signed on most commonly used platforms.
I try to explain a detail in the prev post to Philippe.
>> in lua unsigned integers are not used.
>> It is a defect or unfathomable wisdom?
>> Neil, you will accept a patch?
> No. It would break existing code.
If you do not think this is a mistake, then I - retreat.
--
mozers
<http://scite.net.ru>