From: DeaDDooMER Date: Wed, 30 Oct 2019 15:40:28 +0000 (+0300) Subject: fix question char X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=2d2ce4c1770a59c3e780f3fd31249ce6043f374c;p=d2df-sdl.git fix question char --- diff --git a/src/game/sdl2/g_system.pas b/src/game/sdl2/g_system.pas index 45a45fd..f46c327 100644 --- a/src/game/sdl2/g_system.pas +++ b/src/game/sdl2/g_system.pas @@ -408,14 +408,12 @@ implementation procedure HandleTextInput (var ev: TSDL_TextInputEvent); var ch: UnicodeChar; sch: AnsiChar; begin - if g_dbg_input then - e_LogWritefln('Input Debug: text, text=%s', [ev.text]); Utf8ToUnicode(@ch, PChar(ev.text), 1); - if IsValid1251(Word(ch)) then - begin - sch := AnsiChar(wchar2win(ch)); + sch := AnsiChar(wchar2win(ch)); + if g_dbg_input then + e_LogWritefln('Input Debug: text, text="%s", ch = %s, sch = %s', [ev.text, Ord(ch), Ord(sch)]); + if IsValid1251(Word(ch)) and IsPrintable1251(ch) then CharPress(sch); - end; end; function sys_HandleInput (): Boolean; diff --git a/src/shared/utils.pas b/src/shared/utils.pas index bf8abf4..14fa53b 100644 --- a/src/shared/utils.pas +++ b/src/shared/utils.pas @@ -508,7 +508,7 @@ var const cp1251: array[0..127] of Word = ( $0402,$0403,$201A,$0453,$201E,$2026,$2020,$2021,$20AC,$2030,$0409,$2039,$040A,$040C,$040B,$040F, - $0452,$2018,$2019,$201C,$201D,$2022,$2013,$2014,$003F,$2122,$0459,$203A,$045A,$045C,$045B,$045F, + $0452,$2018,$2019,$201C,$201D,$2022,$2013,$2014,$FFFD,$2122,$0459,$203A,$045A,$045C,$045B,$045F, $00A0,$040E,$045E,$0408,$00A4,$0490,$00A6,$00A7,$0401,$00A9,$0404,$00AB,$00AC,$00AD,$00AE,$0407, $00B0,$00B1,$0406,$0456,$0491,$00B5,$00B6,$00B7,$0451,$2116,$0454,$00BB,$0458,$0405,$0455,$0457, $0410,$0411,$0412,$0413,$0414,$0415,$0416,$0417,$0418,$0419,$041A,$041B,$041C,$041D,$041E,$041F, @@ -1017,12 +1017,12 @@ end; function IsValid1251 (ch: Word): Boolean; begin - result := (ch = Ord('?')) or (wc2shitmap[ch] <> '?') + result := ((ch = Ord('?')) or (wc2shitmap[ch] <> '?')) and (ch <> $98) end; function IsPrintable1251 (ch: AnsiChar): Boolean; begin - result := (ch >= #32) and (ch <> #127) + result := (ch >= #32) and (ch <> #127) and (ch <> #$98) end;