Skip to content

Commit e065545

Browse files
committed
Updated script to match whole word only for r, o, and i. Otherwise commands like ClrText will have its r replaced.
1 parent a22f0ab commit e065545

2 files changed

Lines changed: 24 additions & 24 deletions

File tree

scripts/cb2npp.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
# First we'll start an undo action, then Ctrl-Z will undo the actions of the whole script
44
editor.beginUndoAction()
55

6-
editor.replace(u\r\n","\r\n") # end of line
7-
editor.replace(u\r\n","_\r\n") # output command
8-
editor.replace(u"‡","->") # assignment arrow
6+
editor.replace(\r\n","\r\n") # end of line
7+
editor.replace(\r\n","_\r\n") # output command
8+
editor.replace("‡","->") # assignment arrow
99

10-
editor.replace(u"Ð","r") # r
11-
editor.replace(u"–","o") # theta
12-
editor.replace(u"¸","i") # i
10+
editor.replace("Ð","r") # r
11+
editor.replace("–","o") # theta
12+
editor.replace("¸","i") # i
1313

14-
editor.replace(u"¯",">=") # greater than or equal to
15-
editor.replace(u"®","<=") # less than or equal to
16-
editor.replace(u"¬","<>") # not equal
14+
editor.replace("¯",">=") # greater than or equal to
15+
editor.replace("®","<=") # less than or equal to
16+
editor.replace("¬","<>") # not equal
1717

18-
editor.replace(u"£","*") # multiplication
19-
editor.replace(u"¤","/") # division
20-
editor.replace(u"ƒ","!") # factorial
18+
editor.replace("£","*") # multiplication
19+
editor.replace("¤","/") # division
20+
editor.replace("ƒ","!") # factorial
2121

2222
# End the undo action, so Ctrl-Z will undo the above actions
2323
editor.endUndoAction()

scripts/npp2cb.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
# First we'll start an undo action, then Ctrl-Z will undo the actions of the whole script
44
editor.beginUndoAction()
55

6-
editor.replace("\r\n",u\r\n") # end of line
7-
editor.replace("_\r\n",u\r\n") # output command
8-
editor.replace("->",u"‡") # assignment arrow
6+
editor.replace("\r\n",\r\n") # end of line
7+
editor.replace("_\r\n",\r\n") # output command
8+
editor.replace("->","‡") # assignment arrow
99

10-
editor.replace("r",u"Ð") # r
11-
editor.replace("o",u"–") # theta
12-
editor.replace("i",u"¸") # i
10+
editor.rereplace(r"\br\b","Ð") # r
11+
editor.rereplace(r"\bo\b","–") # theta
12+
editor.rereplace(r"\bi\b","¸") # i
1313

14-
editor.replace(">=",u"¯") # greater than or equal to
15-
editor.replace("<=",u"®") # less than or equal to
16-
editor.replace("<>",u"¬") # not equal
14+
editor.replace(">=","¯") # greater than or equal to
15+
editor.replace("<=","®") # less than or equal to
16+
editor.replace("<>","¬") # not equal
1717

18-
editor.replace("*",u"£") # multiplication
19-
editor.replace("/",u"¤") # division
20-
editor.replace("!",u"ƒ") # factorial
18+
editor.replace("*","£") # multiplication
19+
editor.replace("/","¤") # division
20+
editor.replace("!","ƒ") # factorial
2121

2222
# End the undo action, so Ctrl-Z will undo the above actions
2323
editor.endUndoAction()

0 commit comments

Comments
 (0)