Skip to content
Browse files

fixed some very silly mistakes

git-svn-id: http://svn.textmate.org/trunk/Bundles/Matlab.tmbundle@10848 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
  • Loading branch information...
1 parent ee1dacb commit 7607cc1d9c34fcc26c4400e97462a2415bffe958 @mattfoster mattfoster committed
Showing with 13 additions and 5 deletions.
  1. +13 −5 Commands/Introduce variable (throughout).tmCommand
View
18 Commands/Introduce variable (throughout).tmCommand
@@ -32,9 +32,11 @@ def first_occurance(arr, str):
for line in lines:
try:
line.index(sel)
- except ValueError:
line_no = lines.index(line)
- break;
+ break
+ except ValueError:
+ pass
+
return line_no
@@ -49,10 +51,16 @@ except KeyError:
else:
line_no = first_occurance(lines, sel)-1
var = dialog_get_string('Enter new variable name', 'Variable name:')
- print '%s = %s;\n' % (var, sel)
-for line in lines:
- print line.replace(sel, var),</string>
+for line in lines[0:line_no]:
+ print line.replace(sel, var),
+
+print '%s = %s;' % (var, sel),
+
+for line in lines[line_no:]:
+ print line.replace(sel, var),
+
+</string>
<key>input</key>
<string>document</string>
<key>keyEquivalent</key>

0 comments on commit 7607cc1

Please sign in to comment.
Something went wrong with that request. Please try again.