Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Alan Hemmings
    @goblinfactory
    all I need is to be able to embed Konsole's own version of BBCOde in the format string :D
    e.g.
    ("Modified", 20, "[yellow]`YY[/] MMM dd hh: mm")
    performance would be tracked (measured) and might be an issue if this was overused, and I can imagine a huge screen with almost every element consisting of parsed format strings, ... the geek in me says we could compile this dynamically but that would not be worth the complication in the codebase : D
    It might be easier (from a performance) point of view to define column colour ranges for a viewlist,
    columns 25 to 31 are Yellow, because I can ensure that is handled performantly without any parsing (the equivalent of reflection)
    Alan Hemmings
    @goblinfactory
    just thoughts.
    If I do something like this, I'd make it a ToBBString(); format ... in honour of BBCode :D
    I'm going to implement both methods, so if you need performance you provide a lambda, ... and if you want code simplicity, you only pass in the field list, and Konsole finds the properties through reflection.
    Alan Hemmings
    @goblinfactory
    the current ListView prototype listview stretches and shrinks the columns pro-ratio based on the available width.
    listview is also going to scroll.
    Alan Hemmings
    @goblinfactory

    I've reduced the ListView code down to the following, and will provide a range of default listViews, for example

                var listView = new DirectoryListView(console, "../../..");
                listView.Refresh();

    gives me this ...

    Screen Shot 2020-01-26 at 22.20.15.png
    as close to "no code" as possible. :D
    now busy with some decent default theming.
    Alan Hemmings
    @goblinfactory
    Screen Shot 2020-01-27 at 00.21.32.png
    default color now look like this, will release this shortly if anyone want to take a play ?
    (i can create an alpha nuget package if anyone is interested.)
    Alan Hemmings
    @goblinfactory
    Screen Shot 2020-01-27 at 00.52.10.png

    above screen is customised using business rule formatting, here's the code for this

    
            public static void Main(string[] args)
            {
                var window = new Window();
                var console = window.SplitLeft("left");
                var right = window.SplitRight("right");
                var listView = new DirectoryListView(console, "../../..");
    
                // let's highlight - all files > 4 Mb and make directories green
                listView.BusinessRuleColors = (o, column) =>
                {
                    if (column == 2 && o.Size > 4000000) return new Colors(White, DarkBlue);
                    if (column == 1 && o.Item is DirectoryInfo) return new Colors(Green, Black);
                    return null;
                };
    
                listView.Refresh();
    
    
                Console.ReadKey(true);
            }

    @Tr0sT you should be able to use this instead of BBCode?

    Alan Hemmings
    @goblinfactory
    in case I'm asleep if anyone comments back, the new ListView and DirectoryListView is available to play with in the branch https://github.com/goblinfactory/konsole/tree/feature/list-view
    Alan Hemmings
    @goblinfactory
    I've been working on adding theme support to the base ListView control, and this is what the poc looks like. busy cleaning up and will be posting a new update to Konsole this weekend
    Alan Hemmings
    @goblinfactory
    here's a short screenshot of the theming in action...
    themed-dirlist.gif
    Cerebral Mischief
    @CerebralMischief
    @goblinfactory Thank you very much for this library! I've been looking for EXACTLY this type of lib. I greatly appreciate all your hard work on this and just wanted to jump in here and quickly tell you thanks. :)
    Alan Hemmings
    @goblinfactory
    thank you! super appreciated... watch this space, next few days a really big update to konsole coming...
    Alan Hemmings
    @goblinfactory

    ...theming was necessary for me to be able to start working on a decent input library for konsole. so that you can do things like...

    var user = window.Read<User>( ok:F10, cancel:Escape, escapeReturns: new User("guest", 0, null));

    which will open something like this

    Name                [              ]
    Age                 [   ]
    Date of birth       [00/00/00]
    [  F10 - ok   ]  [ esc -  cancel ]
    • first field is auto highlighted
    • pressing arrow up or down moves between fields
    • form uses microsoft data annotations for length and required field attributes
    • press F10 to accept
    • press escape to return default value
    • form is wrapped in a neat window using the styling of the parent window, see the theming demo'd in the animated gif above.
    Alex Barbosa
    @agbarbosa
    Hi guys... I am sorry beforehand to ask something that may be too simple for some, but how do I keep data being updated inside a Window.OpenBox instance?
    Alex Barbosa
    @agbarbosa
    found it... I discovered the PrintAt method.
    Alex Barbosa
    @agbarbosa
    Now I come with another issue... when I put it in a "Docker Container", the interface doesn't work for some reason.
    Alan Hemmings
    @goblinfactory
    hi @agbarbosa for now konsole is tested on windows only. there's a small bit of work I need to still do to make it properly cross platform that relates to scrolling screen. I do have plans to release a cross platform interface that supports features that can be used without windowing. Essentially it's the "window" feature, the ability to open a scrolling window at X, Y with width and height that is the big problem. Take that away and a lot of the useful functionality of console can still be used.
    I've not tested konsole in docker, it's really meant as to aid with user facing console applications, not for server applications. the use case for konsole is any application that a user starts, and the user interacts with.
    Cerebral Mischief
    @CerebralMischief
    @goblinfactory You've clearly been very busy! Thank you for your continued dedication and hard work on Konsole!
    Alan Hemmings
    @goblinfactory
    going to pause work on Konsole until I can get a much faster driver. going to look at the code in Gui.cs to see if there's a faster driver i can use there. That opens up a world of possibilities for Konsole. Gui.cs won't make Konsole obsolete because they're for totally different programming styles and use cases.
    LPL
    @lploumen
    Hi, does this project is supposed to run on Linux via .net core ?
    When running a sample project, I get this error :
    Unhandled exception. System.PlatformNotSupportedException: Operation is not supported on this platform.
    at System.ConsolePal.MoveBufferArea(Int32 sourceLeft, Int32 sourceTop, Int32 sourceWidth, Int32 sourceHeight, Int32 targetLeft, Int32 targetTop, Char sourceChar, ConsoleColor sourceForeColor, ConsoleColor sourceBackColor)
    Alan Hemmings
    @goblinfactory
    Hi @lploumen .net is not fully compatible on Linux, so no, it won't run on Linux. .net core has not fully implemented all of the .net Console class library, specifically MoveBufferArea, that is essential to provide scrolling support. There is a way around this, but involves writing a replacement high speed writer "per platform".
    it's not even fixed with .net 5. See : https://docs.microsoft.com/en-us/dotnet/api/system.console.movebufferarea?view=net-5.0 and see the "platform not supported exception".
    Currently, this error has nothing to do with Konsole, that's a Microsoft .net issue. I have code I'm investigating, that can act as a proxy "buffered high speed writer" on different platforms, but it will take a while to implement.
    @lploumen btw, the most popular piece from Konsole when I first started was the progressBar. In case that's what you need, it works on Linux, and is here : https://github.com/goblinfactory/progress-bar
    Also, if you write console apps and utilities, you might also be interested in https://github.com/goblinfactory/pretty-json (cross platform pretty print json files)
    Screen Shot 2020-12-24 at 15.21.48.png
    Alan Hemmings
    @goblinfactory
    Just a post to say that Konsole is still being worked on, ...big update coming shortly.
    Alex Barbosa
    @agbarbosa
    @goblinfactory your work on this is awesome. I am still willing to make the progressbar to work on Linux and I would appreciate any updates you have on that. Thanks for keeping this moving forward
    Alan Hemmings
    @goblinfactory
    @agbarbosa progress bar is availble on it's own and can be used (is tested) on Linux. get it here : https://github.com/goblinfactory/progress-bar
    Or am I misunderstanding what you are saying?
    Alan Hemmings
    @goblinfactory
    Quick critical update to anyone using Konsole. Just release 6.2.1 which fixes a nasty bug that oddly no-one has reported, that I encountered when writing stream data to a window.
    If the streaming source contained embedded CrLf, or Cr, or Lf, then the windows would break.
    That's fixed, so Konsole now supports embedded CrLf, so you can con.WriteLine( "line1\nLine2"); inside a window, and it will stay inside the windows, with newlines for each embedded crlf.
    this passes now
            [Test]
            public void replace_crlf_cr_lf_lfcr_with_individual_writeLines()
            {
                var w = new MockConsole(20, 5);
                (var left, var right) = w.SplitLeftRight("left", "right");
    
                left.WriteLine("one\r\ntwo\rthree\nfour");
                right.WriteLine("one\r\ntwo\rthree\nfour");
                var expected = new[]
                {
                    "┌─ left ─┬─ right ─┐",
                    "│three   │three    │",
                    "│four    │four     │",
                    "│        │         │",
                    "└────────┴─────────┘"
                };
    
                w.Buffer.Should().BeEquivalentTo(expected);
            }
    In the sample above, if you want to fill the left and right window without the empy line at the bottom, then change to left.Write(...) so that the Write doesnt add a LineFeed to the end. Then the boxes will be filled without the last line being blank. There is a corresponding unit test for Window.WriteShould.
    Jonathan Goyvaerts
    @jgoyvaerts
    Hey Alan, glad to see you updating Konsole again, love the library. My main gripe with it is that handling input through Console.ReadLine is a bit quirky, and sometimes doesn't work as I'd like it to. I noticed you have input improvements on the roadmap for version 8, I assume there's no way to get these improvements added in 7? :P
    Alan Hemmings
    @goblinfactory
    Hi Jonathan, version 7 is just a technicality, two step approach to getting to version 8. version "editing" has to have a lot more quality control than 7, so I can make breaking changes to support editing, in version 7, and release lots of v7 alpha's without breaking v6 usages, when that's tested the V7 bcomes the framework for v8, where I can focus on edit features.
    ... including a modal pop up etc ...
    i.e. my focus is to get edit features out as quickly as possible because that's what I need for my own projects.
    edit and list views with scrolling and keyboard handling
    Alan Hemmings
    @goblinfactory
    @jgoyvaerts send me a DM with your email address and we can exchange emails, then I can work with you to get your input on what edit features to build first and if you can offer me some early testing and feedback I would be able to get it out much faster.