rebol2

Rebol shift-tab side effects


Given this: view layout [ field [print "1" ] field [print "2"] ]

When I shift+tab from field #2 to field #1, no actions are fired. How do I get them to fire just like a normal tab?


Solution

  • It is a bug in the key handler for field style in the Rebol/View engine. Here is a quick patch you can include in your code to fix it and make SHIFT+Tab work:

    use [body f pos][
        ;-- patch `ctx-text/back-field` function to fix the bug
        body: copy/deep second f: get in ctx-text 'back-field
        insert body/2/while [if head? item [item: tail item]]
        ctx-text/back-field: func first :f :body
    
        ;-- remove test that disables face/action for back-tabs
        body: second get in ctx-text 'edit-text
        body: find body 'word?
        pos: at body/3/7/tab-char/5/6 11
        change/part pos pos/4 4
    ]
    

    This code will walk through View engine functions at run-time (code is data in Rebol) and hot-patch the functions bodies, by injecting or removing code where required.

    If you happen to be a Rebol/SDK user, I can give you the instructions for patching the source files directly, so you can encap a fixed View executable.

    Enjoy.