Interactive line editing
I am currently trying to write a console based util which needs users to interactively edit a line of text.
I want to output a line to the text console and then allow the user to edit the line I have just written - similar to the behaviour of a text editor when you save a file - it presents you with the current filename of your file and allows you to edit it. Only one line of text at a time needs to be edited - I am not trying to implement a text editor.
you want to print 1 line of text, and to let the user edit it.
Well, this means that you know:
1. how long is this line
2. the position on the screen where you will print it
3. The User can make only this:
1. To move only left/right
2. To insert a "char" in the string
3. To delete a "char"
4. (optionally) to have End/Home
So, read the mans about manipulating the cursor on the console text screen.
Then, just read the KBD and filter the input. If the allmighty User hits the DEL button or arrow and etc - now you know what ti do :)))
Mr.PLS.... Enjoy coding
Cheers! I was hoping that there was a better way than that - nevermind! I'll give it a go ... thanks again!
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL