Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Comment/Uncomment plus other Smart Editing for alternative languages
dmoore:
thanks Mandrav
I'm happy to hack CB for the smart indenting, if you think this is best :) That might minimize the potential for clashes between CBs current c/c++ smart indenting and what is required for python (and other languages...)
For the comment blocking, I will definitely submit as a patch for CB since it should work for most languages. There's also a 3rd option:
3. create a single xml file containing the comment tokens for all supported languages (so as not to pollute the lexer files, if that's an issue)
dmoore:
ok, I have a patch ready that does two things:
1. comment/uncomment for every language that supports single line comments. presently, I have done this by hard coding the comment tokens for each language. In a subsequent patch I will change this by adding the comment token to the lexer property xml files. I could also write a more general comment/uncomment to handle languages that only support comment token pairs (e.g. html uses <!-- and -->) by placing the each line within a pair (or placing the whole block in a pair)
2. smart indent for python code (any line whose last non-white space char is a colon will indent one level deeper). this also mean smart indent now only operates on files whose lexer is either cpp or python. I don't use other languages often enough to want to think about an appropriate smart indent for them, but I'll take requests. maybe there is a case designing a more flexible smart indent whose properties could be specified in the lexer property xml files? for example, the ideal smart indent in c++ would be to indent the next line following any flow control statement, but then dedent if the user presses { (and indent the next line, instead) although this might be impossibly messy to specify in xml...
as arbiter of cb taste, mandrav, what are your thoughts on:
a) if i submit the patch in its present form does it have any chance of acceptance? I imagine hard coding the comment tokens might be an issue, but i can always repatch later...
b) should i be using styledtextctrl::getlexer or cbeditor::getlanguage to determine the active language? I'm using the former because the language codes are clear cut in scintilla, whereas i couldn't find a well-defined list of strings describing each language for the latter (not that i spent a long time looking)
mandrav:
--- Quote ---as arbiter of cb taste, mandrav, what are your thoughts on:
a) if i submit the patch in its present form does it have any chance of acceptance? I imagine hard coding the comment tokens might be an issue, but i can always repatch later...
b) should i be using styledtextctrl::getlexer or cbeditor::getlanguage to determine the active language? I'm using the former because the language codes are clear cut in scintilla, whereas i couldn't find a well-defined list of strings describing each language for the latter (not that i spent a long time looking)
--- End quote ---
I would say go ahead. We can always refine the rough edges later. What's important is Getting Things Done ;).
dmoore:
patch here: http://developer.berlios.de/patch/?func=detailpatch&patch_id=1839&group_id=5358
(i had a bad day and had to resubmit a few times. should work with latest svn now)
Navigation
[0] Message Index
[*] Previous page
Go to full version