[Geany-devel] [PATCH] Some editor/snippets/keybindings enhancements

Eugene Arshinov earshinov at xxxxx
Fri Oct 8 02:03:33 UTC 2010


On Thu, 30 Sep 2010 13:23:58 +0100%
Nick Treleaven <nick.treleaven at btinternet.com> wrote:

> On Sat, 10 Jul 2010 21:48:35 +0400
> Eugene Arshinov <earshinov at gmail.com> wrote:
> 
> > Hi all.
> > 
> > I attach three patches:
> > 1. Keybindings to insert new line after/before current
> ...
> > 3. Automatically insert additional indentation in XML/HTML files if
> > previous line ends with an opening tag
> 
> I finally got round to replying to the other patches, sorry for the
> delay.
> 
> > The drawback of the first patch is that I doubt it's so useful.  I
> > know Vi[m] provides shortcuts for these actions ('o' and 'O' in
> > normal mode), but their necessity is questionable for me.  I
> > implemented this to ease XML editing with tag autocompletion turned
> > on.  Suppose you need to write to consequent <li>'s.  Without this
> > patch you need to press End+Enter after writing the first <li> to
> > place the cursor where you need to start the second.  With my
> > patch, you only need to press one shortcut you can assign in
> > Preferences > Keybindings :)
> 
> Maybe we could add these. BTW you could use utils_get_eol_char().
> Also we already have sci_get_line_indent_position().
> 

I missed this function…  Updated patch attached.

> > The drawback of the third patch is that it's not completed.  If user
> > likes to leave HTML tags like <br> "unclosed", she would be
> > disturbed by automatic indentation caused by my patch, so a check
> > box in Preferences is desirable.  I'll code it as soon as we decide
> > this patch can go to trunk.
> 
> For HTML perhaps we could have a filetype pref for this.
> 

What should it look like?  I can't name this pref "autoindent" because
it would be confusing if for XML and HTML it only controls the
indentation after XML/HTML tags, not after braces in PHP/JS chunks.  If
I make the pref more specific (e.g., "xml-autoindent"), it won't
probably be quite proper to insert such a specific member to
GeanyFiletype struct.

Maybe it's more appropriate to add a check button near "Preferences >
Editor > Indentation > Auto-indent mode" list?  AFAIK (never used it),
"Match braces" mode works only for braces languages and thus is
already somewhat filetype-specific.

For the present, I attach an updated patch which doesn't insert
indentation after "short" HTML tags.  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.

Best regards,
Eugene.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: geany.19.newline_keybindings.r5279.UPD.patch
Type: text/x-patch
Size: 5109 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20101008/be31931f/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: geany.21.xml_autoindent.r5279.UPD.patch
Type: text/x-patch
Size: 6205 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20101008/be31931f/attachment-0001.bin>


More information about the Devel mailing list