Comments (9)
Hi agbarbosa, please give me an example of how this should ideally work, and I'll see what I can do?
i.e. pretend it was done, ... what would some sample code look like with that functionality?
txs,
Alan
from konsole.
Hi @goblinfactory, thanks for your reply and for the question. The reason I brought this up was due to my attempt to make the code in this repository here to work inside an IConsole window: https://gist.github.com/DanielSWolf/0ab6a96899cc5377bf54
More specifically for the method UpdateText(string text). See if that makes sense to you.
from konsole.
Unfortunately that's too much to read, and doesn't "help me ... help you."
Please provide the smallest code example you can make up, ...write it down now, in this preview, of how you would like it to behave...
var w = new Window();
var sb = new StringBuilder();
w.WriteLine( ... ??? sb ??);
or
sb.WriteLine(...using Konsole semantics?);
Give me 2 or 3 lines of code that shows me how you would ideally like to be able to use an IConsole instance?
For example, are you looking for something like the following?
var sb = new StringBuilder();
var w = new Window(sb);
w.SplitLeft().WriteLine("I am in the left window");
Console.WriteLine(sb.ToString());
My point is that you need to provide a simple example that explains exactly what you want.
Be specific.
Write code that can be easily understood, and that demonstrates the problem you want to solve.
Keep the code as short as possible, a few lines only.
good luck! We want to try to help you, but you have to help us first by writing a short, clean example.
Alan
from konsole.
Sure... thanks again for the so quick reply!
The idea is to keep refreshing a string instead the entire console window. The object type StringBuilder allows me to refresh that specific string (by using the Append() method) in the Console for the specific line where that string was printed. That works like a charm in the code below:
// Backtrack to the first differing character
StringBuilder outputBuilder = new StringBuilder();
outputBuilder.Append('\b', currentText.Length - commonPrefixLength);
// Output new suffix
outputBuilder.Append(text.Substring(commonPrefixLength));
// If the new text is shorter than the old one: delete overlapping characters
int overlapCount = currentText.Length - text.Length;
if (overlapCount > 0) {
outputBuilder.Append(' ', overlapCount);
outputBuilder.Append('\b', overlapCount);
}
Console.Write(outputBuilder);
currentText = text;
I hope that explains better the reason for the change. I am not a native english speaker since I am a Brazilian. But let me know in case you still need more details on that and I will be pleased to interact.
Best regards,
Alex.
from konsole.
Oh, by the way, I have tried to use the Konsole with the "outputBuilder" variable converted using .ToString() but the results are not the same as it does in the normal Console class. So the Konsole.Write should accept the type StringBuilder so I could try it.
from konsole.
Hi Agbarbosa
... Eita!
Unfortunately it's still not clear from your example what code will do? Please explain as follows ...
If I do this ...
// same code goes here
Then I expect the following output
line 1...
line 2...
line 3...
instead of
line 1...
line 1...
line 1...
Insert a suitable example that explains what you want the code to do.
Pretend this was a unit test, what would the simplest test be, that can both verify the behavior works as expected, and also service as documentation that describes how to use the feature?
The code sample you provided does not show what you expect to see at the end of the code.
- What is "currentText" - What does the sample code you provide do to current Text?
- What does the code currently do, and what do you WANT it to do?
- If Goblinfactory.Konsole were to support the feature you are describing, what would the code look like?
If you can't answers these questions very simply and provide simple sample code, then perhaps speak to a colleague and friend first before replying further to this thread?
Remember, I don't use the pattern or library that you might be referring to. So you have to explain it very simply.
Here is a good article to read that will help you write a clean example;
: https://stackoverflow.com/help/minimal-reproducible-example
Please read through the stack overflow notes before replying again.
good luck
regards
Alan
from konsole.
have you tried using the HighSpeedWriter which supports writing to a buffer of a portion of a screen? You ca make multiple updates "writes" and then call .Flush()
to only render the portion of window that the writer covers.
see here : https://github.com/goblinfactory/konsole#highspeedwriter-end-to-end-sample
from konsole.
Hi @goblinfactory, I am gonna try how to implement the HighSpeedWriter. As for the sugestion of change I made in this topic, you can ignore it for now since I could use the ProgressBar class Konsole already has in the way I wanted, which would be my main reason for this. Anyways, CONGRATULATIONS for the great work you've done here! And thanks for your attention on this matter.
from konsole.
:)
Glad you like it.
Just be aware that if you're using progress bar, that Goblinfactory.Konsole is currently not cross platform, despite being .net core. if you want a cross platform progress bar, or, if that's the only part of Konsole you're using you can also use https://github.com/goblinfactory/progress-bar
cheers,
Alan
from konsole.
Related Issues (20)
- Prevent console window resize HOT 16
- ProgressBar does not expose current HOT 8
- SplitRows and SplitColumns without border HOT 1
- Embedded CrLf cause window isolation to break.
- HighSpeed writer to support resize on window size change
- Fix spelling, Boxstyle.Thickness to Thickness.
- Menu not explained in the README. HOT 2
- when splitRows with 3 splits, with even number of parent rows, the last split is not expanding by 1 row
- Konsole.Writer.MoveBufferArea throws System.PlatformNotSupportedException on Nix Platforms HOT 4
- ProgressBar not working on Linux HOT 2
- Does window support chinese character text auto wrap? HOT 4
- Trying to use Konsole for First Time HOT 3
- Ability to close boxes. HOT 9
- Support non "lined" borders (line numbers, blue statusbar, and text header) HOT 1
- Seemingly impossible divide by zero exception thrown HOT 4
- System.ArgumentOutOfRangeException in ProgressBar.Refresh() HOT 16
- How to prevent console from being moved by user? Snap windows feature is changing size of Console. HOT 1
- The simple initialization of ProgressBar is throwing "The handle is invalid." exception in VSCode while debugging. HOT 7
- Add image support HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from konsole.