|
@@ -282,7 +282,7 @@ $1=_st(self)._currentLine();
|
|
return $1;
|
|
return $1;
|
|
}, function($ctx1) {$ctx1.fill(self,"currentLineOrSelection",{}, smalltalk.HLCodeWidget)})},
|
|
}, function($ctx1) {$ctx1.fill(self,"currentLineOrSelection",{}, smalltalk.HLCodeWidget)})},
|
|
args: [],
|
|
args: [],
|
|
-source: "currentLineOrSelection\x0a ^editor somethingSelected\x0a\x09\x09ifFalse: [self currentLine]\x0a\x09\x09ifTrue: [self selection]",
|
|
|
|
|
|
+source: "currentLineOrSelection\x0a ^editor somethingSelected\x0a\x09\x09ifFalse: [ self currentLine ]\x0a\x09\x09ifTrue: [ self selection ]",
|
|
messageSends: ["ifFalse:ifTrue:", "currentLine", "selection", "somethingSelected"],
|
|
messageSends: ["ifFalse:ifTrue:", "currentLine", "selection", "somethingSelected"],
|
|
referencedClasses: []
|
|
referencedClasses: []
|
|
}),
|
|
}),
|
|
@@ -529,20 +529,25 @@ selector: "print:",
|
|
category: 'actions',
|
|
category: 'actions',
|
|
fn: function (aString){
|
|
fn: function (aString){
|
|
var self=this;
|
|
var self=this;
|
|
-var start,stop;
|
|
|
|
-return smalltalk.withContext(function($ctx1) {
start=_st((smalltalk.HashedCollection || HashedCollection))._new();
|
|
|
|
-stop=_st((smalltalk.HashedCollection || HashedCollection))._new();
|
|
|
|
-_st(start)._at_put_("line",_st(_st(self["@editor"])._getCursor_(false))._line());
|
|
|
|
|
|
+var start,stop,currentLine;
|
|
|
|
+return smalltalk.withContext(function($ctx1) {
currentLine=_st(_st(self["@editor"])._getCursor_(false))._line();
|
|
|
|
+start=_st((smalltalk.HashedCollection || HashedCollection))._new();
|
|
|
|
+_st(start)._at_put_("line",currentLine);
|
|
_st(start)._at_put_("ch",_st(_st(self["@editor"])._getCursor_(false))._ch());
|
|
_st(start)._at_put_("ch",_st(_st(self["@editor"])._getCursor_(false))._ch());
|
|
-_st(stop)._at_put_("line",_st(start)._at_("line"));
|
|
|
|
|
|
+_st(_st(self["@editor"])._getSelection())._ifEmpty_((function(){
|
|
|
|
+return smalltalk.withContext(function($ctx2) {
_st(start)._at_put_("ch",_st(_st(self["@editor"])._getLine_(currentLine))._size());
|
|
|
|
+return _st(self["@editor"])._setSelection_end_(smalltalk.HashedCollection._fromPairs_([_st("line").__minus_gt(currentLine),_st("ch").__minus_gt((0))]),start);
|
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
|
|
|
|
+stop=_st((smalltalk.HashedCollection || HashedCollection))._new();
|
|
|
|
+_st(stop)._at_put_("line",currentLine);
|
|
_st(stop)._at_put_("ch",_st(_st(_st(start)._at_("ch")).__plus(_st(aString)._size())).__plus((2)));
|
|
_st(stop)._at_put_("ch",_st(_st(_st(start)._at_("ch")).__plus(_st(aString)._size())).__plus((2)));
|
|
_st(self["@editor"])._replaceSelection_(_st(_st(_st(_st(self["@editor"])._getSelection()).__comma(" ")).__comma(aString)).__comma(" "));
|
|
_st(self["@editor"])._replaceSelection_(_st(_st(_st(_st(self["@editor"])._getSelection()).__comma(" ")).__comma(aString)).__comma(" "));
|
|
_st(self["@editor"])._setCursor_(_st(self["@editor"])._getCursor_(true));
|
|
_st(self["@editor"])._setCursor_(_st(self["@editor"])._getCursor_(true));
|
|
_st(self["@editor"])._setSelection_end_(stop,start);
|
|
_st(self["@editor"])._setSelection_end_(stop,start);
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"print:",{aString:aString,start:start,stop:stop}, smalltalk.HLCodeWidget)})},
|
|
|
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"print:",{aString:aString,start:start,stop:stop,currentLine:currentLine}, smalltalk.HLCodeWidget)})},
|
|
args: ["aString"],
|
|
args: ["aString"],
|
|
-source: "print: aString\x0a\x09| start stop |\x0a\x09start := HashedCollection new.\x0a\x09stop := HashedCollection new.\x0a\x09start at: 'line' put: (editor getCursor: false) line.\x0a\x09start at: 'ch' put: (editor getCursor: false) ch.\x0a\x09stop at: 'line' put: (start at: 'line').\x0a\x09stop at: 'ch' put: ((start at: 'ch') + aString size + 2).\x0a\x09editor replaceSelection: (editor getSelection, ' ', aString, ' ').\x0a\x09editor setCursor: (editor getCursor: true).\x0a\x09editor setSelection: stop end: start",
|
|
|
|
-messageSends: ["new", "at:put:", "line", "getCursor:", "ch", "at:", "+", "size", "replaceSelection:", ",", "getSelection", "setCursor:", "setSelection:end:"],
|
|
|
|
|
|
+source: "print: aString\x0a\x09| start stop currentLine |\x0a currentLine := (editor getCursor: false) line.\x0a\x09start := HashedCollection new.\x0a\x09start at: 'line' put: currentLine.\x0a\x09start at: 'ch' put: (editor getCursor: false) ch.\x0a (editor getSelection) ifEmpty: [\x0a \x09\x22select current line if selection is empty\x22\x0a \x09start at: 'ch' put: (editor getLine: currentLine) size.\x0a editor setSelection: #{'line' -> currentLine. 'ch' -> 0} end: start.\x0a ].\x0a\x09stop := HashedCollection new.\x0a\x09stop at: 'line' put: currentLine.\x0a\x09stop at: 'ch' put: ((start at: 'ch') + aString size + 2).\x0a\x0a\x09editor replaceSelection: (editor getSelection, ' ', aString, ' ').\x0a\x09editor setCursor: (editor getCursor: true).\x0a\x09editor setSelection: stop end: start",
|
|
|
|
+messageSends: ["line", "getCursor:", "new", "at:put:", "ch", "ifEmpty:", "size", "getLine:", "setSelection:end:", "->", "getSelection", "+", "at:", "replaceSelection:", ",", "setCursor:"],
|
|
referencedClasses: ["HashedCollection"]
|
|
referencedClasses: ["HashedCollection"]
|
|
}),
|
|
}),
|
|
smalltalk.HLCodeWidget);
|
|
smalltalk.HLCodeWidget);
|