On Tue, 26 Oct 2010 12:14:25 +0400 Eugene Arshinov earshinov@gmail.com wrote:
For the present, I attach an updated patch which doesn't insert indentation after "short" HTML tags.
OK, looks like a good solution.
Do I understand correctly that you think we don't need GUI preference?
I think we could add a per-filetype indent mode option so it would be easy to disable in case someone wanted to. The user could then set auto-indent to basic for HTML.
I also modified existing tag autocompletion code so that it doesn't check for HTML tags if current lexer is XML, not HTML. I slightly modified utils_find_open_xml_tag() in order to reuse it in my autoindentation code. Particularly I removed `check_tag' parameter and strange condition
else if (! check_tag && *cur == '>') break;
I'm not sure why this condition was needed there.
Was it necessary to remove it? Just checking as we should leave it otherwise. (Currently the change is applied).
No, technically it wasn't necessary. The removal just allows to prune check_tag argument and make the function and it's usage a bit simpler.
Yes, I forgot that ;-)
Maybe you're right, we should keep the condition, but I think we should change it to just "*cur == '>'" (so the check_tag argument still can be removed).
OK, done.
The condition may become true only for invalid HTML: it should contain two > > without < between them (follow the code of utils_find_open_xml_tag). The condition guarantees that if we have such an erroneous HTML line, no close tag will be automatically inserted. For example, it is helpful when you write "<script>if (a >" with XML tag autocompletion turned on.
In previous email I wrote this condition is strange as I can't understand why we account `check_tag' argument here (i.e., why not just check for *cur == '>'). Basically, in original editor.c:handle_xml check_tag was set to
0 if we autocomplete after > 1 if we autocomplete after </
What's the difference for the condition we discuss, if we always start backward search for an open tag _before_ those ">" and "</" chunks?
Not sure. Let me know if there are any problems.
Nick