Repository navigation
Tags
Tags
ENH: Add fake#get_keynames(), useful e.g. for writing custom completions As s:fake_codes and s:fake_cache are script-local, we cannot access them from outside, but the information therein is necessary to obtain a list of all possible fake data sources, e.g. when writing a custom completion function for a :command that takes a fake data source. Add fake#get_keynames(), with an implementation that somewhat mirrors fake#has_keyname().
fake#betapdf(0.2, 0.4) hangs on Vim 8.0 with 64-bit integers I noticed a regression with Vim version 8.0, which uses 64-bit integers instead of 32-bit. A call to fake#betapdf() would just hang; the function is looping endlessly because now p evaluates to a very large value, not something between 0 and 1. In s:Random.randombits(), the conversion of the SHA256 hash into a number now results in a 64-bit integer, but the self.RAND_MAX still is (32-bit) 0x7fffffff. I suppose the initialization loop for RAND_MAX now aborts too soon. In general, the check of str2nr(rand_max, 16) < 0 doesn't seem to work; it will never be < 0 (on 64-bit), not for 0x7fffffffffffffff, not for even larger values. Instead, I fixed the problem by restricting the SHA256 hash value to the first 8 digits, i.e. a 32-bit range, so that _r fits inside RAND_MAX again.