|
Post by alexfish on Apr 23, 2020 18:13:10 GMT 1
Hi Rik
found some problems but here nee to point to what is happens to the cursor when win is resized if the cursor pos col = 1 then y is increment .. then if press space it goes to 2 and y does not increment any more and hence your cursor no matter what will be at the foot of the page
pi@raspberrypi:~/Downloads $ ./editor PRINT THIS x 1:10 x 1:11 x 1:12 x 1:13 x 1:14 x 1:15 x 1:16 x 1:17 x 1:18 x 1:19 x 1:20 x 1:21 x 1:22 x 1:23 x 2:24
main note of interest here : and as recommended the screen is not been reset at start can be done in two ways :: a term without scroll-back and use bacon CLEAR or use any term and use the RESET as posted
BR Alex
|
|
|
Post by rikky on Apr 24, 2020 8:04:14 GMT 1
Thanks Alex. I will look into this. Unfortunately I have to work, so I have only a few hours left each day. Anyway, I'm taking a new approach, putting each row in a ASSOC string : editor_row$(STR$(rownumber)) Suddenly the subroutines for scrolling up and down etc etc, are becoming incredibly more easy and shorter and simpler. Rik.
|
|
|
Post by rikky on Apr 25, 2020 11:20:34 GMT 1
So, I did not make a new editor from scratch eventually. I invented a new method by putting each row into a ASSOC variable. And only implemented this method there were I had still bugs. So now there is a mix of all methods together. Downside is that I reinitialise the ASSOC array every time again in the 'catch the key' loop. With big texst this results in seeing the weird escape characters appearing when you continually press a key. At least on my system. This was exactly the reason why I wanted my own console editor by the way. And if you copy past a text in the editor, you can notice how horribly slow the thing is, for it is loading the whole text into arrays, with every single character it adds. But this can easily be solved by just changing only the rows that are really effected, in the routines for the arrows backspace etc. So this is now only a proof of concept. I think its working this time. Also because it is not evident to debug a console editor, for you cannot print the debug information on the same console, I have included the debug version. Rik. EDIT: Note that in the debug version the escape and F1 key are configured to give some debug information. EDIT: bug fix in the cursorposition on 1,1 at startup instead of 1,GETY. important for the debug version. Attachments:editor.tgz (7.1 KB)
|
|
|
Post by alexfish on Apr 26, 2020 12:22:13 GMT 1
Hi Rik
have tested the editor.bac in lxterminal
looks good
can copy and paste :: this is from the terminal
PRINT "THIS"
Just one question : how does one exit
BR Alex
|
|
|
Post by rikky on Apr 26, 2020 21:48:42 GMT 1
Cntr_D It exits, and it spits out the text to standard output. So you can use it in your scripts. R.
|
|
|
Post by rikky on May 12, 2020 22:20:04 GMT 1
Turns out that if you use GOTOXY somewhere on the page you ruin your ability to copy/past. This is NOT a BaCon bug, for BaCon just follows the POSIX rules, as far as I understood. And NOT a Lxterminal bug, for Xterm does the same thing. RESET
FOR j = 1 TO 3 FOR i = 1 TO COLUMNS PRINT "@"; NEXT i NEXT j
FOR j = 1 TO 3 GOTOXY 1,j+4 FOR i = 1 TO COLUMNS PRINT "@"; NEXT i
NEXT j You see? You get 2 times 3 rows. But when you copy past them into your Geany editor, the first group of 3 rows, is pasted as one line, as it should. And the second one is pasted as three lines. But it is only one. Very nasty. For if you copy and past a few lines from your own editor to your own editor, you suddenly have a couple of extra newlines extra. Ghhhhh. So now, to make an editor, you have to avoid the GETX, GETY AND GOTOXY Thanks.. The solution is, you won't believe this, reprint the whole page, even for the tiniest of little changes you make. Rik. Attachments:editor.bac (20.92 KB)
|
|
|
Post by Pjot on May 13, 2020 20:03:53 GMT 1
Thanks Rik, For those functions GETX, GETY and GOTOXY BaCon uses the standard ANSI Escape Codes. If a terminal has implemented these codes, then they should work as expected I can see your editor was a lot of work. From my experience I know it is not easy to implement something on the ASCII terminal. Alternatively, we could use the Ncurses library, but this also introduces a dependency. This library must then exist on the target platform as well. Anyway, good to see that your perseverance has paid off! Best regards Peter
|
|
|
Post by vovchik on May 13, 2020 20:41:30 GMT 1
Dear Rik,
Also thanks from me - it runs fine on Pi and Mint. I will have to think of a way to use your code intelligently - maybe in bish. Any interesting ideas, apart from editing per se?
With kind regards, vovchik
|
|
|
Post by rikky on May 17, 2020 14:36:35 GMT 1
Ncurses, yes. There is a whole include Library available. But I could not find any examples. The examples on the basic-converter home page I simply overlooked. So it was to difficult. But the next editor I will make with Ncurses. Yes, That's why I respond so late. I wanted to give a real example. Coming up in a few minutes in 'bash for dummy's Rik.
|
|
|
Post by vovchik on May 17, 2020 15:44:57 GMT 1
Dear Rik,
Thanks. I just downloaded your latest BACON and will start testing.
With kind regards, vovchik
|
|