Beispiel #1
0
        public override CommandResult Evaluate(EntryRenderContext ctx)
        {
            var options = ctx.NewOptions();

            if (Selected)
            {
                options.Inverted = true;
            }

            var charsWritten = WriteString(ctx, $"{Aux}: ");

            ctx.RenderPosition += charsWritten;

            options.Underline = true;
            var value = ctx.Document.GetData(Property)?.ToString() ?? string.Empty;

            if (value.Length > InputLineLength)
            {
                value = value.Substring(Math.Max(0, value.Length - InputLineLength), InputLineLength);
            }
            var inputText = value.PadRight(InputLineLength);

            charsWritten += WriteString(ctx, inputText);

            ctx.PopOptions();
            return(new CommandResult(true, charsWritten));
        }
Beispiel #2
0
        public override CommandResult Evaluate(EntryRenderContext ctx)
        {
            var @checked = ctx.Document.GetData(Property) as bool?;// ?? false;

            if ([email protected] && HasArgument("RE"))
            {
                if (int.TryParse(GetArgument("RE"), out var checkedInt))
                {
                    @checked = checkedInt == 1;
                }
                else
                {
                    @checked = false;
                }
            }

            var options = ctx.NewOptions();

            if (Selected)
            {
                options.Inverted = true;
            }

            var builder = new StringBuilder();

            if (!string.IsNullOrEmpty(Tag))
            {
                builder.Append($"{Tag}: ");
            }
            builder.Append($"[{(@checked.Value ? "X" : " ")}]");
            var writtenChars = WriteString(ctx, builder.ToString());

            ctx.PopOptions();
            return(new CommandResult(true, writtenChars));
        }
Beispiel #3
0
        public override CommandResult Evaluate(EntryRenderContext ctx)
        {
            var options = ctx.NewOptions();

            if (Selected)
            {
                options.Inverted = true;
            }

            var charsWritten = WriteString(ctx, Tag);

            WriteBorder(ctx, Tag.Length);

            ctx.PopOptions();
            return(new CommandResult(true, charsWritten));
        }
Beispiel #4
0
        public override CommandResult Evaluate(EntryRenderContext ctx)
        {
            var options = ctx.NewOptions();

            options.ForegroundColor = EgaColor.Red;

            if (!HasFlag("UL", false))
            {
                options.Underline = true;
            }

            var charsWritten = WriteString(ctx, Tag);

            ctx.PopOptions();
            return(new CommandResult(true, charsWritten));
        }
Beispiel #5
0
        public override CommandResult Evaluate(EntryRenderContext ctx)
        {
            var options = ctx.NewOptions();

            if (Selected)
            {
                options.Inverted = true;
            }

            var key          = values.Keys.ToArray()[selectedIndex];
            var length       = values.Values.Max(value => value.ToString().Length);
            var writtenChars = WriteString(ctx, $"{Aux}: [{values[key].ToString().PadLeft(length)}]");

            ctx.PopOptions();
            return(new CommandResult(true, writtenChars));
        }
Beispiel #6
0
        public override CommandResult Evaluate(EntryRenderContext ctx)
        {
            var options = ctx.NewOptions();

            options.ForegroundColor = EgaColor.LtBlue;

            var lm   = GetArgument("LM");
            var text = Tag ?? lm;

            if (!HasFlag("UL", false))
            {
                options.Underline = true;
            }
            var charsWritten = WriteString(ctx, text);

            ctx.PopOptions();
            return(new CommandResult(true, charsWritten));
        }
Beispiel #7
0
        public override CommandResult Evaluate(EntryRenderContext ctx)
        {
            var options = ctx.NewOptions();

            options.Underline       = true;
            options.ForegroundColor = EgaColor.Purple;

            bool collapsed = !HasFlag("C", false);
            var  icon      = collapsed ? "+" : "-";

            var writtenCharacters = WriteString(ctx, $"{icon}] {Tag}");

            ctx.PopOptions();

            // Find the tree's domain. It spans from the first $ID$ to the $ID$ that brings it to its original level.
            if (collapsed)
            {
                ctx.Options.CollapsedTreeNodeIndentationLevel = ctx.Options.Indentation;
            }

            return(new CommandResult(true, writtenCharacters));
        }