Hello, I am writing a text editor on pascal :) I think how to organize the input, there was a thought to make an array with strings, we just use a text editor, sometimes we start writing a new line, and using the standard read procedure, after we press enter, it writes to variable, what the user enters, I think to make a loop type, and if the user clicked on enter, then simply add the old line to the array, and create a new one, but I’m not sure about the correctness of this solution, and you need to set up in Pascal using HotKeys how to catch the event when the user is pushing em ctrl + s
1 answer
With read [ln], you are not implementing a text editor, but a string editor. Yes, here you read the cycle line by line, put each input string into the array. Get a sort of copy con.
A more interesting text editor should be written with the help of readkey, gotoxy, etc. (google for help modulo crt). Those. get the entered character, and depending on what you entered, perform the actions — type the character, move the cursor, delete the character, etc. Here and shortcuts can handle.
|