On 7/31/07, Neil Hodgson <[EMAIL PROTECTED]> wrote:
>    How are you going to arbitrate between the current extension's
> choice and the history? I commonly make a series of searches with one
> mask.

I've thought about that. One method would be to (a) always make unique
insertions into the history and (b) ensure that the current extension
pattern is the first in the history list. Uniqueness is necessary,
otherwise we get lots of bogus copies.  I'll see if I can come up with
a reasonably elegant way to implement this. (This behaviour would only
happen if some property, say find.files.using.extension, was non-zero)

>     Don't really see the advantage over using quotes where needed when
> specifying commands.
I'll post a solution; it isn't too complicated.

Apropos MenuCommand changes:
>    This has been looked at before. If you have a good way of doing it
> I'll probably include it.

The patch involves changing the signature of ExtensionAPI::DoMenuCommand;
in Extender.h around line 30, we then have
   virtual void DoMenuCommand(const char *cmd)=0;

in SciTEBase.h around 901 we have:
   void DoMenuCommand(const char* cmd);

and the corresponding method definition in SciTEBase.cpp, at the end
of the file, actually does the interesting bit:

void SciTEBase::DoMenuCommand(const char* cmd) {
    int cmdID;
    if (cmd && cmd[0]) {
        if (isdigit(cmd[0])) {
            cmdID = atoi(cmd);
        } else {
            cmdID = GetMenuCommandAsInt(cmd);
        }
        MenuCommand(cmdID, 0);
    }
}

In LuaExtension.cxx, around 277, there is a new implementation of
cf_scite_menu_commmand():

static int cf_scite_menu_command(lua_State *L) {
    const char* cmdID = lua_tostring(L,1);
        if (cmdID) {
                host->DoMenuCommand(cmdID);
        }
        return 0;
}
(Here we're relying on lua_tostring() that tries to convert any value
into a string)

As an added bonus, in SciTEBase::PerformOne() (around 4588) we use
DoMenuCommand to implement the 'menucommand' extension verb:

    } else if (isprefix(action, "menucommand:")) {
       DoMenuCommand(arg);
    }...

steve d.
_______________________________________________
Scite-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scite-interest

Reply via email to