Menu

#846 Manual selection of syntax highlighting scheme

closed-fixed
Usability (267)
5
2007-04-12
2007-03-29
No

1. There is no ability of manual selection of syntax highlighting scheme.

2. It would be nice if WinMerge could recognize type of file by content. It's needed to enable syntax highlighting when filenames has no extension.

Discussion

  • Gal Hammer

    Gal Hammer - 2007-03-29

    Logged In: YES
    user_id=411238
    Originator: NO

    Please assign this request to me. I have a patch ready you for. :-)

     
  • Kimmo Varis

    Kimmo Varis - 2007-03-29

    Logged In: YES
    user_id=631874
    Originator: NO

    Assigning. Which problem your patch solves?

     
  • Kimmo Varis

    Kimmo Varis - 2007-03-29
    • assigned_to: nobody --> galh
     
  • Gal Hammer

    Gal Hammer - 2007-03-29

    Manual selection of color scheme patch

     
  • Gal Hammer

    Gal Hammer - 2007-03-29

    Logged In: YES
    user_id=411238
    Originator: NO

    Only the the first request for now.

    Do we want to add an auto-guessing capability? I guess a good statistic knowledge is required in order to implement it.

    File Added: ChangeSchemePatch.7z

     
  • Kimmo Varis

    Kimmo Varis - 2007-03-29

    Logged In: YES
    user_id=631874
    Originator: NO

    That's why I was asking - I don't think implementing #2 makes much sense. It makes for some formats, but then there are things like PHP embedded into HTML etc. And wrong selection there just makes people unhappy.

     
  • Gal Hammer

    Gal Hammer - 2007-03-29

    Logged In: YES
    user_id=411238
    Originator: NO

    PHP and HTML is easy, you'll have "<?" or "<?php" tags. :-)

    > And wrong selection there just makes people unhappy.

    It will make me unhappy first! Why didn't they had file extensions at first place? :-)

    Seriously now. Using some kind of "Bayesian Filter" mechanism we might be able to do it. We'll need collect a lot of inputs files, though. I don't think it worth the efforts. With the new patch, if you don't like the highlighted syntax, you can replace it.

     
  • Kimmo Varis

    Kimmo Varis - 2007-03-29

    Logged In: YES
    user_id=631874
    Originator: NO

    Completely agreed.

    Your patch is what we need and want. Autodetection is not worth the time it takes.

     
  • Stanislav Kruchinin

    Logged In: YES
    user_id=1589856
    Originator: YES

    I thought only about simple pattern matching. Example: if we have #!/bin/sh or bunch of ### in the beginning of file, this is a shell script.

     
  • Gal Hammer

    Gal Hammer - 2007-03-30

    Logged In: YES
    user_id=411238
    Originator: NO

    > I thought only about simple pattern matching.

    That's only one case. Is it a Perl script or a shell script (which can start with /bin/sh, /bin/tcsh or /bin/bash) or a Python?

     
  • Gal Hammer

    Gal Hammer - 2007-03-30

    Logged In: YES
    user_id=411238
    Originator: NO

    Comitted to SVN. Completed: At revision: 4213.

    Only manual gear for now. :-)

     
  • Stanislav Kruchinin

    Logged In: YES
    user_id=1589856
    Originator: YES

    > That's only one case.
    I know, but it's very common case. Most of editors with syntax highlighting (especially for Unix-like OSes) do this matching.

     
  • Stanislav Kruchinin

    Logged In: YES
    user_id=1589856
    Originator: YES

    > Is it a Perl script or a shell script (which can start with /bin/sh, /bin/tcsh or /bin/bash) or a Python?

    I really don't see any difficulties. Python interpreter is "python", Ruby -- "ruby", Perl -- "perl", etc. Shell interpreters always have suffix "sh" in their name.

     
  • Kimmo Varis

    Kimmo Varis - 2007-03-30

    Logged In: YES
    user_id=631874
    Originator: NO

    I think there is a problem with the patch as it is now:
    - syntax highlighting "schema" names are hard-coded into the code (editlib/ccrystaltextview.cpp). This for sure makes translators unhappy. :(

    Also, I don't think some of those names are good.. Like "plain"? I suppose it means "no highlighting", so it should be just "none". Etc.

     
  • Gal Hammer

    Gal Hammer - 2007-03-30

    Logged In: YES
    user_id=411238
    Originator: NO

    > This for sure makes translators unhappy.

    I don't think there is a need to translate the "schema" names. These are language names and you don't say REXX or C different in other language.

    On the other hand, I guess it possible to move these names to a string resource.

    > Also, I don't think some of those names are good.

    I just used the names I found. The menu I create is also very similar to other editor's menus I saw, names included.

     
  • Kimmo Varis

    Kimmo Varis - 2007-03-31

    Logged In: YES
    user_id=631874
    Originator: NO

    I'm pretty sure that "Plain" is not same in Japanese, Korean or Chinese. So there definitely is need for translating. Not all world is ISO-8859-1.

    Notepad++ has "Normal Text".

     
  • Kimmo Varis

    Kimmo Varis - 2007-04-02

    Logged In: YES
    user_id=631874
    Originator: NO

    Ok, I think I'd be fine with:
    - moving the schema names to resource strings (find a free number area for them)
    - replacing "plain" with "Normal Text" or "None"
    - replacing "C" with "C/C++"

    Though, I think "Schema" itself isn't GUI-proper word? I doubt many users know it. Maybe just "Syntax Highlight" as Main-menu-item?

     
  • Gal Hammer

    Gal Hammer - 2007-04-04

    Logged In: YES
    user_id=411238
    Originator: NO

    I'm fine with these guidelines and I'll apply the changes soon.

     
  • Kimmo Varis

    Kimmo Varis - 2007-04-10

    Logged In: YES
    user_id=631874
    Originator: NO

    Do you have time to get this into SVN before Thursday? I know it is tight.. If you don't have time I can delay next beta few days.

     
  • Gal Hammer

    Gal Hammer - 2007-04-10

    Logged In: YES
    user_id=411238
    Originator: NO

    Don't you want to review my changes first?

     
  • Kimmo Varis

    Kimmo Varis - 2007-04-10

    Logged In: YES
    user_id=631874
    Originator: NO

    I don't think that is necessary - should be pretty trivial change. However it would be nice to attach patch file here just for sake somebody later looks at this item and discussion here. Just English rc file patch is enough (as usual).

     
  • Gal Hammer

    Gal Hammer - 2007-04-10

    Logged In: YES
    user_id=411238
    Originator: NO

    Patch was submitted: http://www.winmerge.org/patch/1697691

     
  • Kimmo Varis

    Kimmo Varis - 2007-04-12

    Logged In: YES
    user_id=631874
    Originator: NO

    I'm closing this item as the patch is in SVN trunk.

     
  • Kimmo Varis

    Kimmo Varis - 2007-04-12
    • status: open --> closed-fixed
     

Log in to post a comment.