17
17
__author__ = "Cody Precord <cprecord@editra.org>"
18
__svnid__ = "$Id: _fortran.py 63834 2010-04-03 06:04:33Z CJP $"
19
__revision__ = "$Revision: 63834 $"
18
__svnid__ = "$Id: _fortran.py 64561 2010-06-12 01:49:05Z CJP $"
19
__revision__ = "$Revision: 64561 $"
21
21
#-----------------------------------------------------------------------------#
166
166
#---- End Required Module Functions ----#
168
def AutoIndenter(stc, pos, ichar):
169
"""Auto indent cpp code. uses \n the text buffer will
170
handle any eol character formatting.
171
@param stc: EditraStyledTextCtrl
168
def AutoIndenter(estc, pos, ichar):
169
"""Auto indent cpp code.
170
@param estc: EditraStyledTextCtrl
172
171
@param pos: current carat position
173
172
@param ichar: Indentation character
178
line = stc.GetCurrentLine()
179
text = stc.GetTextRange(stc.PositionFromLine(line), pos)
176
line = estc.GetCurrentLine()
177
text = estc.GetTextRange(estc.PositionFromLine(line), pos)
178
eolch = estc.GetEOLChar()
181
indent = stc.GetLineIndentation(line)
180
indent = estc.GetLineIndentation(line)
182
181
if ichar == u"\t":
183
tabw = stc.GetTabWidth()
182
tabw = estc.GetTabWidth()
185
tabw = stc.GetIndent()
184
tabw = estc.GetIndent()
187
186
i_space = indent / tabw
188
ndent = u"\n" + ichar * i_space
187
ndent = eolch + ichar * i_space
189
188
rtxt = ndent + ((indent - (tabw * i_space)) * u' ')
191
190
blks = '(program|function|subroutine|if|do|while)'