Closed GoogleCodeExporter closed 8 years ago
I've had a quick bash at modifying the code to do this. I'm not familiar with
python and this is the first time I've ever worked with gedit plugins, so I'm
sure the code could be improved radically. In my limited testing, it seems to
work as I expected it to. Patch attached.
Original comment by callum.m...@gmail.com
on 15 May 2011 at 9:26
Attachments:
Nice job! I've integrated the patch into the main branch and created a new
download. I'll have a look at the other issue whenever I get a chance. Thanks
for the patch!
Original comment by kevin.mcguinness@gmail.com
on 16 May 2011 at 10:26
I think the patch could be improved a little, what do you think?
For example, I call self.get_char_under_cursor() twice. Would it be better to
store that as a variable? I'd assumed so, but I wasn't sure if I could simply
declare a new variable as in PHP, so I just used the function call twice.
Original comment by callum.m...@gmail.com
on 16 May 2011 at 11:12
Ok, I answered my own question, and created a second patch. Do you think this
one is better than the first? I'm not very familiar with python / gedit, so it
might be a minor change that's not worth the hassle.
Original comment by callum.m...@gmail.com
on 16 May 2011 at 11:19
Attachments:
Yep, that could be better alright -- although I don't think that
get_char_under_cursor() is a very expensive operation. You don't need to
declare variables in python, just assign them and then use them. So you could
rewrite that part as:
cursor_ch = self.get_char_under_cursor(doc)
if (self.is_closing_paren(cursor_ch) and
self.would_balance_parens(doc, cursor_ch )):
...
That's a little more tidy actually :-) I've added you as a committer to the
project anyway, so feel free to make changes to the main branch.
Original comment by kevin.mcguinness@gmail.com
on 16 May 2011 at 11:24
Heh, yeah, sorry.. replied before I read your next comment there. Yes, the
second patch is a bit better. You can commit the changes to the default branch
yourself if you like.
Original comment by kevin.mcguinness@gmail.com
on 16 May 2011 at 11:26
Ok, update committed. Another two firsts, first use of hg and first commit to
Google Code. :-)
Original comment by callum.m...@gmail.com
on 16 May 2011 at 11:58
Good stuff, cheers!
Original comment by kevin.mcguinness@gmail.com
on 16 May 2011 at 12:09
Original issue reported on code.google.com by
callum.m...@gmail.com
on 15 May 2011 at 8:17