guns / vim-sexp

Precision Editing for S-expressions
MIT License
612 stars 33 forks source link

vim patch 8.2.1506 breaks plugin: "using number as bool" #27

Closed atweiden closed 3 years ago

atweiden commented 3 years ago

Breaks sexp#leaf_flow on occasion. May break other things.

see: https://github.com/vim/vim/commit/d70840ed68296c1144d743e6335003c81c558c24

bpstahlman commented 3 years ago

Do you happen to know why this change was made? Why would Vim not treat all nonzero numbers as true in boolean context?

On Tue, Sep 22, 2020, 5:10 PM Andy Weidenbaum notifications@github.com wrote:

Breaks sexp#leaf_flow on occasion. May break other things.

see: vim/vim@d70840e https://github.com/vim/vim/commit/d70840ed68296c1144d743e6335003c81c558c24

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/guns/vim-sexp/issues/27, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXOSQB2WDBNYBKSJUMZBL3SHEHEFANCNFSM4RWH7CPA .

bpstahlman commented 3 years ago

Andy, I haven't had a chance to download the latest Vim and test yet, but can you tell me which part of the code you think is causing the issue? IIUC, the Vim change you referenced is not supposed to affect legacy scripts at all... Thanks, Brett S.

On Tue, Sep 22, 2020 at 5:10 PM Andy Weidenbaum notifications@github.com wrote:

Breaks sexp#leaf_flow on occasion. May break other things.

see: vim/vim@d70840e https://github.com/vim/vim/commit/d70840ed68296c1144d743e6335003c81c558c24

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/guns/vim-sexp/issues/27, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXOSQB2WDBNYBKSJUMZBL3SHEHEFANCNFSM4RWH7CPA .

atweiden commented 3 years ago

Dunno if Bram is correct there. Unless src/typval.c only applies to vim9script, the patch makes it an error to use numbers besides 0 and 1 as booleans.

case VAR_NUMBER:
    if (want_bool && varp->vval.v_number != 0
                  && varp->vval.v_number != 1)
atweiden commented 3 years ago

Fixed in https://github.com/vim/vim/commit/bade44e5cad1b08c85d4a8ba08d94a30458dddfb

bpstahlman commented 3 years ago

So IIUC, the Vim bug never made it into an official Vim release and would affect only those who built from git source or downloaded from a site that regularly generates binaries from master. I still might fix at some point. Actually, I may look at the list of Vim9 changes to see what it would take to make the whole plugin Vim9-safe to benefit from the increased speed...