[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gforth] char translation with 'everychar' causes word completion error

From: Marcos Cruz
Subject: [gforth] char translation with 'everychar' causes word completion error
Date: Fri, 21 Jun 2013 00:14:10 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Hi all,

In order to make it impossible to type spaces during the user's input
(with 'accept') in a game, I investigated how 'accept' works (files
<kernel/accept.fs> and <kernel/history.fs> of the Gforth's sources) and
then tried this:

: (everychar)   ( key -- key )  dup bl <> and  ;
' (everychar) is everychar

It works as expected: any space is converted to zero, a key code that
has no effect because of its 'false' in the 'ctrlkeys' table.

But there's a problem. In the first input the tab key works as usual,
but in the next inputs it fails (also when pressed twice as the first
key of the input):

:2: malformed UTF-8 character
$B6939148 throw
$B6939928 address@hidden
$B693A9E0 x-width
$B693AAD8 cur-correct
$B693B194 .all
$B693B25C xkill-expand
$B692AF4C perform
$B692AFAC decode
$B692B004 edit-line
$B692B408 accept
$B692B07C perform

I tried other key conversions (e.g. bl to 31, 'a' to 'b'...) and the
same problem happens.

Beside, there's something I don't understand: The backtrace shows
'decode' executes 'xkill-expand', but the xt associated with the tab key
in the 'ctrlkeys' table is that of 'xtab-expand' (set in
'xchar-history'), as shown this way right after the error:

#tab cells ctrlkeys + @ >name id.

I have not found yet where that binding is changed to 'xkill-expand'.

Anyway I don't see yet the relation between the exchange of input chars
at the start of 'decode' and word completion. I have to investigate the
source code more deeply (by the way, many times I miss a simple one-line
comment describing what certain word is supposed to do; comments are
sparse in Gforth's sources, especially in low-level words not described
in the docs).

I'd appreciate any help.

Thank you.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]