~ubuntu-branches/ubuntu/raring/wxwidgets2.8/raring

« back to all changes in this revision

Viewing changes to wxPython/wx/tools/Editra/src/syntax/_fortran.py

  • Committer: Package Import Robot
  • Author(s): Stéphane Graber
  • Date: 2012-01-07 13:59:25 UTC
  • mfrom: (1.1.9) (5.1.10 sid)
  • Revision ID: package-import@ubuntu.com-20120107135925-2601miy9ullcon9j
Tags: 2.8.12.1-6ubuntu1
* Resync from Debian, changes that were kept:
  - debian/rules: re-enable mediactrl. This allows libwx_gtk2u_media-2.8 to be
    built, as this is required by some applications (LP: #632984)
  - debian/control: Build-dep on libxt-dev for mediactrl.
  - Patches
    + fix-bashism-in-example
* Add conflict on python-wxgtk2.8 (<< 2.8.12.1-6ubuntu1~) to python-wxversion
  to guarantee upgrade ordering when moving from pycentral to dh_python2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
"""
16
16
 
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 $"
20
20
 
21
21
#-----------------------------------------------------------------------------#
22
22
# Imports
165
165
 
166
166
#---- End Required Module Functions ----#
167
167
 
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
174
 
    @return: string
175
173
 
176
174
    """
177
175
    rtxt = u''
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()
180
179
 
181
 
    indent = stc.GetLineIndentation(line)
 
180
    indent = estc.GetLineIndentation(line)
182
181
    if ichar == u"\t":
183
 
        tabw = stc.GetTabWidth()
 
182
        tabw = estc.GetTabWidth()
184
183
    else:
185
 
        tabw = stc.GetIndent()
 
184
        tabw = estc.GetIndent()
186
185
 
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' ')
190
189
 
191
190
    blks = '(program|function|subroutine|if|do|while)'
194
193
    if text.endswith('{') or blk_pat.match(text) or text == 'else':
195
194
        rtxt += ichar
196
195
 
197
 
    return rtxt
 
196
    # Put text in the buffer
 
197
    estc.AddText(rtxt)