Skip to content

Commit b1c36c8

Browse files
committed
add SI stack dropdown to tracer, relates to #52
1 parent 6cd7f41 commit b1c36c8

4 files changed

Lines changed: 13 additions & 4 deletions

File tree

index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@
151151
<a href=# class='tb_btn tb_RP ' title='Replace' ></a>
152152
<a href=# class='tb_btn tb_PV ' title='Search for previous match' ></a>
153153
<a href=# class='tb_btn tb_NX last ' title='Search for next match' ></a>
154+
<span class=tb_sep></span>
155+
<select class='si_stack tc_only'></select>
154156
</div>
155157
<div class=ride_win_cm></div>
156158
</div>

src/ed.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ D.Ed.prototype={
8383
if(this.btm==-1){this.cm.scrollTo(0,this.cm.heightAtLine(this.cm.lastLine(),"local")-this.cm.getScrollInfo().clientHeight+this.cm.defaultTextHeight()+4)}
8484
else if(this.btm!=null){var i=this.cm.getScrollInfo();this.cm.scrollTo(0,this.btm-i.clientHeight)}
8585
},
86+
updateSIStack:function(x){
87+
this.dom.querySelector('.si_stack').innerHTML=x.stack.map(function(o){return'<option>'+o}).join('')
88+
},
8689
open:function(ee){ //ee:editable entity
8790
var ed=this,cm=ed.cm
8891
this.jumps.forEach(function(x){x.n=x.lh.lineNo()}) //to preserve jumps, convert LineHandle-s to line numbers
@@ -159,7 +162,7 @@ D.Ed.prototype={
159162
cm.replaceRange(s,{line:l,ch:0},{line:l,ch:cm.getLine(l).length},'D')
160163
},
161164
LN:function(){D.prf.lineNums.toggle()},
162-
TC:function(){D.send('StepInto',{win:this.id})},
165+
TC:function(){D.send('StepInto',{win:this.id});D.send('GetSIStack',{})},
163166
AC:function(cm){ //align comments
164167
if(cm.getOption('readOnly'))return
165168
var ed=this,ll=cm.lastLine(),o=cm.listSelections() //o:original selections
@@ -179,7 +182,7 @@ D.Ed.prototype={
179182
cm.setSelections(o)
180183
},
181184
ER:function(cm){
182-
if(this.tc){D.send('RunCurrentLine',{win:this.id});return}
185+
if(this.tc){D.send('RunCurrentLine',{win:this.id});D.send('GetSIStack',{});return}
183186
if(D.prf.autoCloseBlocks()){
184187
var u=cm.getCursor(),l=u.line,s=cm.getLine(l),m
185188
var re=/^(\s*):(class|disposable|for|if|interface|namespace|property|repeat|section|select|trap|while|with)\b([^\{]*)$/i

src/ide.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,10 @@ D.IDE=function(){'use strict'
8484
}
8585
p.addChild({type:'component',componentName:'win',componentState:{id:w},title:ee.name})
8686
ide.WSEwidth=ide.wsew
87-
tc?ide.wins[0].scrollCursorIntoView():ide.wins[0].cm.scrollTo(si.left,si.top)
87+
if(tc){
88+
D.send('GetSIStack',{})
89+
ide.wins[0].scrollCursorIntoView()
90+
}else ide.wins[0].cm.scrollTo(si.left,si.top)
8891
},
8992
ShowHTML:function(x){
9093
if(D.el){
@@ -143,6 +146,7 @@ D.IDE=function(){'use strict'
143146
var t=e.target,i=99;while(t){t=t.previousSibling;i++}ret(i)}}
144147
D.util.dlg(I.gd,{w:400,h:300})
145148
},
149+
ReplyGetSIStack:function(x){var tc=ide.tracer();tc&&tc.updateSIStack(x)},
146150
ReplyTreeList:function(x){ide.wse.replyTreeList(x)},
147151
StatusOutput:function(x){
148152
var w=ide.wStatus;if(!D.el)return

src/se.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ D.Se.prototype={
120120
ED:function(cm){
121121
var c=cm.getCursor(),txt=cm.getLine(c.line);
122122
if(/^\s*$/.test(txt)){
123-
var tc=this.ide.tracer();tc.focus();tc.ED(tc.cm)
123+
var tc=this.ide.tracer();if(tc){tc.focus();tc.ED(tc.cm)}
124124
} else{
125125
D.send('Edit',{win:0,pos:c.ch,text:txt,unsaved:this.ide.getUnsaved()})
126126
}

0 commit comments

Comments
 (0)