Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

max text editor file type setting? #58

Open
ramagottfried opened this issue Oct 26, 2022 · 2 comments
Open

max text editor file type setting? #58

ramagottfried opened this issue Oct 26, 2022 · 2 comments

Comments

@ramagottfried
Copy link

I have an object I am working on that works with lua files, and I notice that when I open the file in the text editor, the filename and title are set with the .lua extension, but text is all grey --

but then if I save the file, the syntax highlighting is automatically enabled, which is really useful.

Is there a filetype attribute or object_method I can call so that the "jed" object knows to use syntax highlighting when the file is first opened?

Here is my dbclick function:

void oluajit_dblclick(t_oluajit *x)
{
    if (x->t_editor)
        object_attr_setchar(x->t_editor, gensym("visible"), 1);
    else
    {
        x->t_editor = (t_object *)object_new(CLASS_NOBOX, gensym("jed"), x, 0);

        if( x->filename != "" ){
            object_method(x->t_editor, gensym("settext"), *(x->t_text), gensym("utf-8"));
            object_method(x->t_editor, gensym("filename"), x->filename.c_str(), x->pathID );
            object_attr_setsym(x->t_editor, gensym("title"), gensym(x->filename.c_str()) );
            object_attr_setchar(x->t_editor, gensym("scratch"), 0);
        }
        else
        {
            object_attr_setsym(x->t_editor, gensym("title"), gensym("untitled.lua"));
            object_attr_setchar(x->t_editor, gensym("scratch"), 1);
        }
        
        object_method(x->t_editor, gensym("openwindow"));
    }
}
@ramagottfried
Copy link
Author

also, if I close the text editor, and then reopen it again, the highlighting disappears until I hit cmd-s again.

@shakfu
Copy link

shakfu commented Oct 24, 2023

I would also be interested in custom syntax highlighting for the textedit and code editor widgets. I have a python external which would greatly benefit from this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants