tclib icon indicating copy to clipboard operation
tclib copied to clipboard

[tc_editline] Add callbacks for tab completion and hints

Open darkuranium opened this issue 9 years ago • 0 comments

Currently, only a single callback exists. Instead, multiple events should be recognized and passed to the user.

I have already decided to go with option nr. 3, but for the record, there were three options:

  1. N callbacks registered separately

    void tcedit_register_tabcomplete(int (*cb)(<...>), void* udata);
    void tcedit_register_echo(<...>, void* udata);
    
  2. N callbacks registered at once (via a struct)

    typedef struct TC_EditHandler {
        int (*tabcomplete)(<...>);
        <...>
        void* udata;
    } TC_EditHandler;
    void tcedit_register_handler(TC_EditHandler* handler);
    
  3. A single callback which is passed an event type.

    typedef struct TC_EditEvent {
        int type;
        TC_String* input;
        <...>
    } TC_EditEvent;
    typedef int TC_EditCallback(TC_EditEvent* event, void* udata);
    void tcedit_register_callback(TC_EditCallback* callback, void* udata);
    

darkuranium avatar Sep 08 '16 14:09 darkuranium