Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 413e241

Browse files
author
Monte Goulding
committed
[[ EditScriptChunk ]] added docs and proper errors
1 parent ac2b4a3 commit 413e241

5 files changed

Lines changed: 17 additions & 7 deletions

File tree

docs/dictionary/command/edit.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<name>edit</name>
44
<type>command</type>
55
<syntax>
6-
<example>edit [the] script of <i>object</i></example>
6+
<example>edit [the] script of <i>object</i> [at line,column]</example>
77
</syntax>
88
<library></library>
99
<objects>
@@ -23,6 +23,7 @@
2323
</references>
2424
<history>
2525
<introduced version="1.0">Added.</introduced>
26+
<introduced version="6.5">Added optional at syntax.</introduced>
2627
</history>
2728
<platforms>
2829
<mac/>
@@ -40,9 +41,9 @@
4041
<examples>
4142
<example>edit the script of the mouseStack</example>
4243
<example>edit the script of this card</example>
43-
<example>edit the script of player "Show Me"</example>
44+
<example>edit the script of player "Show Me" at 100,0</example>
4445
</examples>
4546
<description>
46-
<p>Use the <b>edit</b> <glossary tag="command">command</glossary> in the <glossary tag="development environment">development environment</glossary> to open the LiveCode <glossary tag="script editor">script editor</glossary> with the <property tag="script">script</property> of the specified <glossary tag="object">object</glossary>.</p><p/><p><b>Parameters:</b></p><p>The <i>object</i> is any <href tag="reference/object_reference.rev">object reference</href>.</p><p/><p><b>Comments:</b></p><p>The <b>edit</b> <glossary tag="command">command</glossary> is equivalent to selecting the object and choosing Object menu<img src="202656"/>Object Script<important/>. If the script ed is not open, the <b>edit</b> command opens a window that shows the <a/>script.</p>
47+
<p>Use the <b>edit</b> <glossary tag="command">command</glossary> in the <glossary tag="development environment">development environment</glossary> to open the LiveCode <glossary tag="script editor">script editor</glossary> with the <property tag="script">script</property> of the specified <glossary tag="object">object</glossary>.</p><p/><p><b>Parameters:</b></p><p>The <i>object</i> is any <href tag="reference/object_reference.rev">object reference</href>.</p><p>Usint the optional at syntax will pass the subsequent items to the editScript handler as a second parameter. By convention the first two parameters should be a line number and a column character offset from the start of the line.</p><p/><p><b>Comments:</b></p><p>The <b>edit</b> <glossary tag="command">command</glossary> is equivalent to selecting the object and choosing Object menu<img src="202656"/>Object Script<important/>. If the script ed is not open, the <b>edit</b> command opens a window that shows the <a/>script.</p>
4748
</description>
4849
</doc>

docs/dictionary/message/editScript.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<name>editScript</name>
44
<type>message</type>
55
<syntax>
6-
<example>editScript <i>objectID</i></example>
6+
<example>editScript <i>objectID</i>,<i>atItems</i></example>
77
</syntax>
88
<library></library>
99
<objects>
@@ -19,6 +19,7 @@
1919
</references>
2020
<history>
2121
<introduced version="1.0">Added.</introduced>
22+
<introduced version="6.5">Added atItems.</introduced>
2223
</history>
2324
<platforms>
2425
<mac/>
@@ -37,6 +38,6 @@
3738
<example>on editScript theObject <code><i>-- save current script before editing</i></code></p><p> set the oldScript of theObject to the script of theObject</p><p> pass editScript</p><p>end editScript</example>
3839
</examples>
3940
<description>
40-
<p>Handle the <b>editScript</b> <keyword tag="message box">message</keyword> if you want to intercept attempts to edit a <property tag="script">script</property> via the <keyword tag="message box">message box</keyword> or a <glossary tag="handler">handler</glossary>.</p><p/><p><b>Parameters:</b></p><p>The <i>objectID</i> is the long <property tag="ID">ID</property> <glossary tag="property">property</glossary> of the <glossary tag="object">object</glossary> whose <property tag="script">script</property> is about to be opened.</p><p/><p><b>Comments:</b></p><p>The <b>editScript</b> <keyword tag="message box">message</keyword> is sent when you use the <command tag="edit">edit</command> command in a <glossary tag="handler">handler</glossary>. However, it is not sent when the <glossary tag="development environment">development environment</glossary> is active.</p>
41+
<p>Handle the <b>editScript</b> <keyword tag="message box">message</keyword> if you want to intercept attempts to edit a <property tag="script">script</property> via the <keyword tag="message box">message box</keyword> or a <glossary tag="handler">handler</glossary>.</p><p/><p><b>Parameters:</b></p><p>The <i>objectID</i> is the long <property tag="ID">ID</property> <glossary tag="property">property</glossary> of the <glossary tag="object">object</glossary> whose <property tag="script">script</property> is about to be opened.</p><p>The <i>atItems</i> parameter may be sent if the optional edit script of object at syntax is used. By convention the atItems are used to provide a line and column that a script editor should be opened at.<p/><p><b>Comments:</b></p><p>The <b>editScript</b> <keyword tag="message box">message</keyword> is sent when you use the <command tag="edit">edit</command> command in a <glossary tag="handler">handler</glossary>. However, it is not sent when the <glossary tag="development environment">development environment</glossary> is active.</p>
4142
</description>
4243
</doc>

engine/src/cmds.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ Parse_stat MCEdit::parse(MCScriptPoint &sp)
574574
{
575575
if (sp.parseexp(False, True, &m_at) != PS_NORMAL)
576576
{
577-
MCperror->add(PE_EDIT_NOTARGET, sp);
577+
MCperror->add(PE_EDIT_NOAT, sp);
578578
return PS_ERROR;
579579
}
580580
}
@@ -600,7 +600,7 @@ Exec_stat MCEdit::exec(MCExecPoint &ep)
600600
if (m_at->eval(ep) != ES_NORMAL)
601601
{
602602
MCeerror->add
603-
(EE_FIND_BADSTRING, line, pos);
603+
(EE_EDIT_BADAT, line, pos);
604604
return ES_ERROR;
605605
}
606606
t_at = ep.getsvalue();

engine/src/executionerrors.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2416,6 +2416,10 @@ enum Exec_errors
24162416

24172417
// {EE-0796} group: object cannot be grouped
24182418
EE_GROUP_NOTGROUPABLE,
2419+
2420+
// {EE-0797} edit script: bad at expression
2421+
EE_EDIT_BADAT,
2422+
24192423
};
24202424

24212425
extern const char *MCexecutionerrors;

engine/src/parseerrors.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1618,6 +1618,10 @@ enum Parse_errors
16181618

16191619
// {PE-0530} variance: bad parameters
16201620
PE_VARIANCE_BADPARAM,
1621+
1622+
// {EE-0531} edit script: no at expression
1623+
PE_EDIT_NOAT,
1624+
16211625
};
16221626

16231627
extern const char *MCparsingerrors;

0 commit comments

Comments
 (0)