This issue has now been fixed in build 1125.Ivan Denisov wrote:One more detail
https://forum.oberoncore.ru/viewtopic.p ... 50#p109026
(For the issue see https://redmine.blackboxframework.org/issues/205.)
This issue has now been fixed in build 1125.Ivan Denisov wrote:One more detail
https://forum.oberoncore.ru/viewtopic.p ... 50#p109026
This issue has now been fixed in build 1126.Ivan Denisov wrote:At the document P-S-I in the section Stack Size there is default font in some words. The Arial will be better like everywhere.
Code: Select all
PROCEDURE (IN var: Item) GetStringVal (OUT x: ARRAY OF CHAR; OUT ok: BOOLEAN)
NEW
Reads a string value from an item.
Pre
var.Valid()	20
var.typ = arrTyp & var.BaseTyp() = charTyp	21
var.obj = varObj	22I interpret "read next attribute run" as:Read next attribute run, stops at next view.
My example demonstrates that TextModels.StdReader.ReadRun fails to adhere to this interpretation - it does not stop the reader at exactly the end of the run having attr and thus fails to be useful in iterating text stretches of uniform attributes. While I understand that this is not exactly a bug - it fails to adhere to my interpretation, not the explicitly stated conditions - I move to amend the documentation to include my interpretation (boldface), which is I believe soundly grounded.(* Not a quote, markup just for highliting *)
Post:
(attr = AttributeOf(rd.Pos() - 1)) & (rd.eot OR (attr # AttributeOf(rd.Pos()))
Thus I propose a fix to this issue. The fix is generic to Reader, not specific to StdReader (the reason is, I'm not competent in StdReader/StdModel internals):Except for performance, equivalent to:Code: Select all
VAR a: Attributes; a := rd.attr; REPEAT rd.Read UNTIL (rd.attr # a) OR (rd.view # NIL) OR rd.eot; IF rd.eot THEN attr := NIL ELSE attr := rd.attr END
Code: Select all
PROCEDURE (rd: Reader) ReadRun* (OUT attr: Attributes), NEW, ABSTRACT;Code: Select all
	PROCEDURE (rd: Reader) ReadRun* (OUT attr: TextModels.Attributes), NEW, EXTENSIBLE;
	(** post: rd.eot OR a # NIL, rd.view = ViewAt(rd.Pos() - 1) **)
	BEGIN
		rd.Read; attr := rd.attr;
		IF rd.view = NIL THEN
			WHILE (rd.attr = attr) & (rd.view = NIL) & ~rd.eot DO rd.Read END;
			IF ~rd.eot OR (rd.view # NIL) THEN rd.ReadPrev END
		END
	END ReadRun;	Code: Select all
PROCEDURE (rd: StdReader) ReadRun . But it bugged me nonetheless in my little tool.
. But it bugged me nonetheless in my little tool.Code: Select all
  PROCEDURE (c: StdCtrl) SetNativeProp (selection: BOOLEAN; old, p: Properties.Property);
      VAR t: TextModels.Model; beg, end: INTEGER; (*▶*)toWord: BOOLEAN;(*◀*)
   BEGIN
      t := c.text;
      IF selection THEN beg := c.selBeg; end := c.selEnd;
         (*▶*)IF beg = none THEN toWord := TRUE; c.view.ThisSetter().GetWord(c.carPos, beg, end);
            ASSERT(end <= t.Length())
         ELSE toWord := FALSE END(*◀*)
      ELSE beg := 0; end := t.Length()
      END;
      IF beg < end THEN
         t.Modify(beg, end, old, p);
         IF selection (*▶*)& ~toWord(*◀*) THEN c.SetSelection(beg, end) END
      ELSIF selection THEN
         c.insAttr := TextModels.ModifiedAttr(InsertionAttr(c), p)
      END
   END SetNativeProp;Code: Select all
PROCEDURE (s: StdSetter) GetWord (pos: INTEGER; OUT beg, end: INTEGER);Code: Select all
      UNTIL ~part OR (s.rd.string[0] = 0X) OR (end - beg > wordCutoff);
      (*▶*)end := MIN(end, s.text.Length());
      ASSERT((0 <= beg) & (beg <= end) & (end <= s.text.Length()), 60)(*◀*)
   END GetWord;Code: Select all
	Post
		end <= s.text.Length()