return;
var str = '';
if (indent != undefined)
- for (var i = 0; i < indent; i++)
+ for (var i = 0; i <= indent; i++)
str += ' ';
Xex.LogNode.value = str + arg + "\n" + Xex.LogNode.value;
}
str += ' vname="' + this.vari.name + '"';
if (len == 0)
return str + '/>';
- for (var i = 0; i < len; i++)
- arglist += '.'; //this.args[i].toString ();
+ if (this.func instanceof Xex.Subrountine)
+ for (var i = 0; i < len; i++)
+ arglist += this.args[i].toString ();
+ else
+ for (var i = 0; i < len; i++)
+ arglist += '.';
return str + '>' + arglist + '</' + this.func.name + '>';
}
return ic.preedit.charCodeAt (p);
}
- MIM.NamedMarker = function (name) { this.val = name; }
- MIM.NamedMarker.prototype = new MIM.Marker ();
- MIM.NamedMarker.prototype.Position = function (ic)
- {
- var p = ic.marker_positions[this.val];
- if (p == undefined)
- Xex.Log ('no position of ' + this.val);
- return (p == undefined ? 0 : p);
- }
- MIM.NamedMarker.prototype.Mark = function (ic)
- {
- ic.marker_positions[this.val] = ic.cursor_pos;
- }
+ MIM.FloatingMarker = function (name) { this.val = name; };
+ var proto = new MIM.Marker ();
+ MIM.FloatingMarker.prototype = proto;
+ proto.Position = function (ic) { return ic.marker_positions[this.val]; };
+ proto.Mark = function (ic) { ic.marker_positions[this.val] = ic.cursor_pos; };
MIM.PredefinedMarker = function (name) { this.val = name; }
MIM.PredefinedMarker.prototype = new MIM.Marker ();
throw new Xex.ErrTerm (MIM.Error.ParseError,
"Invalid marker: " + name);
}
- return new MIM.NamedMarker (name);
+ return new MIM.FloatingMarker (name);;
}
}) ();
ic.rep (old_text, new_text, can);
}
else
- Xex.Log ('no candidates');
+ Xex.Log ('no candidates at ' + ic.cursor_pos + ' of ' + ic.candidate_table.table.length);
return args[0];
}
this.state = null;
this.initial_state = this.im.initial_state;
this.keys = new MIM.KeySeq ();
- this.marker_positions = {};
+ this.marker_positions = new Array ();
this.candidate_table = new MIM.CandidateTable ();
this.reset ();
}
this.table = new Array ();
}
- MIM.CandidateTable.prototype.get = function (from)
+ MIM.CandidateTable.prototype.get = function (pos)
{
for (var i = 0; i < this.table.length; i++)
{
var elt = this.table[i];
- if (elt.from <= from && elt.to > from)
+ if (elt.from < pos && pos <= elt.to)
return elt.val;
}
}
for (var i = 0; i < this.table.length; i++)
{
var elt = this.table[i];
- if (elt.from >= from && elt.from < to
- || elt.to >= from && elt.to < to)
+ if (elt.from < to && elt.to > from)
{
elt.from = from;
elt.to = to;
MIM.CandidateTable.prototype.adjust = function (from, to, inserted)
{
var diff = inserted - (to - from);
+ if (diff == 0)
+ return;
for (var i = 0; i < this.table.length; i++)
{
var elt = this.table[i];
function set_cursor (prefix, pos)
{
this.cursor_pos = pos;
- if (pos > 0)
- this.candidates = this.candidate_table.get (pos - 1);
- else
- this.candidates = null;
+ this.candidates = this.candidate_table.get (pos);
}
function save_state ()
reset: function ()
{
this.cursor_pos = 0;
- this.candidates = null;
this.candidate_show = false;
this.prev_state = null;
this.title = this.initial_state.title;
{
var diff = inserted - (to - from);
- for (var m in this.marker_positions)
+ for (var name in this.marker_positions)
{
- var pos = this.marker_positions[m];
+ var pos = this.marker_positions[name];
if (pos > from)
{
if (pos >= to)
- {
- this.marker_positions[m] = pos + diff;
- Xex.Log ('Marker ' + m + ' = ' + this.marker_positions[m]);
- }
+ this.marker_positions[name] += diff;
else if (pos > from)
- {
- this.marker_positions[m] = from;
- Xex.Log ('Marker ' + m + ' = ' + this.marker_positions[m]);
- }
+ this.marker_positions[name] = from;
}
}
if (this.cursor_pos >= to)