[GRASS-SVN] r55873 - grass/branches/develbranch_6/gui/wxpython/modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Apr 17 23:58:36 PDT 2013
Author: annakrat
Date: 2013-04-17 23:58:35 -0700 (Wed, 17 Apr 2013)
New Revision: 55873
Modified:
grass/branches/develbranch_6/gui/wxpython/modules/mcalc_builder.py
Log:
wxGUI/mapcalc: fix cursor position when adding function (merge from trunk, r55870)
Modified: grass/branches/develbranch_6/gui/wxpython/modules/mcalc_builder.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/modules/mcalc_builder.py 2013-04-18 06:53:31 UTC (rev 55872)
+++ grass/branches/develbranch_6/gui/wxpython/modules/mcalc_builder.py 2013-04-18 06:58:35 UTC (rev 55873)
@@ -18,6 +18,7 @@
import os
import sys
+import re
import wx
import grass.script as grass
@@ -450,11 +451,15 @@
pass
newmcalcstr += what + ' ' + mcalcstr[position:]
- position_offset += len(what)
self.text_mcalc.SetValue(newmcalcstr)
- if len(what) > 1 and what[-2:] == '()':
- position_offset -= 1
+ if len(what) > 1:
+ match = re.search(pattern="\(.*\)", string=what)
+ if match:
+ position_offset += match.start() + 1
+ else:
+ position_offset += len(what)
+
self.text_mcalc.SetInsertionPoint(position + position_offset)
self.text_mcalc.Update()
More information about the grass-commit
mailing list