spectre.console icon indicating copy to clipboard operation
spectre.console copied to clipboard

MultilineTaskDescriptionColumn for Progress

Open Yaroshvitaliy opened this issue 4 years ago • 6 comments

It would be useful to implement MultilineTaskDescriptionColumn for Progress. This didn't help me for multiline description:

    public sealed class MultilineTaskDescriptionColumn : ProgressColumn
    {
        /// <inheritdoc/>
        protected internal override bool NoWrap => true;

        /// <inheritdoc/>
        public override IRenderable Render(RenderContext context, ProgressTask task, TimeSpan deltaTime)
        {
            //var text = task.Description?.RemoveNewLines()?.Trim();
            //return new Markup(text ?? string.Empty).Overflow(Overflow.Ellipsis).RightAligned();

            return new Markup(task.Description ?? string.Empty);
        }
    }

Please upvote :+1: this issue if you are interested in it.

Yaroshvitaliy avatar Feb 14 '21 09:02 Yaroshvitaliy

@Yaroshvitaliy You will need to set "NoWrap" to false for that to work:

image

patriksvensson avatar Feb 14 '21 13:02 patriksvensson

@patriksvensson I tried NoWrap set to false but it didn't help me. I mean Environment.NewLine is not working.

Yaroshvitaliy avatar Feb 14 '21 15:02 Yaroshvitaliy

I can see the following code in ProgressTask:

description = description?.RemoveNewLines()?.Trim();

Yaroshvitaliy avatar Feb 14 '21 15:02 Yaroshvitaliy

Yeah, Environment.Newline is probably not working. It will wrap the text at the end of the column.

patriksvensson avatar Feb 14 '21 15:02 patriksvensson

Environment.Newline is what I need as a separator between lines, so could you reopen the issue since my original question is not answered? Maybe anoter string/object property can be added to ProgressTask so that it can be used in custom advabced columns?

Yaroshvitaliy avatar Feb 14 '21 16:02 Yaroshvitaliy