Author Topic: qXed: linked list text editor  (Read 12617 times)

0 Members and 1 Guest are viewing this topic.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: qXed: linked list text editor
« Reply #15 on: September 17, 2018, 02:46:06 pm »
LOL - Sure, this coming from the guy in the pic wearing the big hat! Yeah, like I should talk (looks at own avatar.)

Pete

- People who talk out of their hats aren't so bad... unless they're sitting on them at the time.
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: qXed: linked list text editor
« Reply #16 on: September 17, 2018, 07:03:39 pm »
Ah, a computer. The freedom.

Thanks everyone for discussing and motivating this topic, especially Pete - I concur with just about all of the observations you've made. You have picked out plenty of the places where the policy (the word I keep insisting on using to differentiate from the fundamental mechanism) falls outside expectations. The dual-cursor delete stroke is hardly tested, and so are the edge cases. The thing crashes when there are 2 or fewer characters, or more than 64000. That's gotta be dealt with for sure. As for the cursor jumping when scrolling - again I think this is a shallow fix. All duly noted.... Except the scrollbar thing - that is just an indicator, and is not a mouse control. Thought that analysis was still useful though, there might be crash around the corner when the cursor goes off screen.

Thanks again and, I'm gonna keep refining what I have. Let's hope it stays under 500 lines (haha).
You're not done when it works, you're done when it's right.

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: qXed: linked list text editor
« Reply #17 on: September 18, 2018, 12:18:29 am »
Update-

So I chipped away at a few things Pete pointed out, and tightened up the operation overall. The code in the top post has already been updated, so don't worry about finding the old version on the forum. By that token, I refrain from explaining the controls in depth because they are subject to change and don't need junk information floating around.

All that said, enjoy fixed scrolling, cursor confinement, and more magic when you press F11.

https://www.qb64.org/forum/index.php?topic=597.0
You're not done when it works, you're done when it's right.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: qXed: linked list text editor
« Reply #18 on: September 18, 2018, 01:46:03 am »
Bill, this job will probably drive you crazy before you drive it home. WPs have a weird way of a fix in one place causes a fault in another. The first thing I noticed is wrap failed to work upon initiation. The third paragraph that starts with, "[What astonished..." does not wrap correctly.  It ends at the right margin with the "t" in the, which should have been wrapped to the next line.

The cursor problem I mentioned going from the "]" on multiplex now works. The mouse doesn't. I see that what happens is spaces in the line below get added to the next line. This means if I click the last blank space below "]" the cursor is advanced 4 spaces past the left margin on the next line. The code needs to be told when advancing to the next line to ignore the blank spaces so it ends up on the first character. Another cursor issue is the automatic scroll up that happens when you click a character on the last line. I do that in my WP apps, too, but after the scroll up, the cursor needs to be positioned one-line up, too.

Cursor down works great but cursor up is still problematic. This happens if you scroll the text so only the last paragraph is on the scree, put cursor on a character at the left margin, and then keep pressing cursor up. You will see when it starts to jump text lines down that the cursor will migrate to the right instead of staying at the left margin, as expected.

It still gets an illegal function when you delete it down to the last couple of characters.

Now this one is another wrap problem. Place the cursor at the very end of the last paragraph and hold the delete key. keep deleting characters until it gets to the first character on the second line. When you delete it, the text will auto-scroll down, but the wrap function will have "hapel" instead of "chapel" and this will continue to fail as you go up subsequent lines as characters are deleted. Also, the cursor when the line jumps seems to go off to the upper right instead of staying on the last character but strangely enough, if you press delete, without changing the cursor position, it seems to remember where it left off and deletes the last character, of the text, as expected.

Good job on the home-end functions, btw. People don't get that it is a bit of a trick to manage spaces in that right margin.

Nice job on trailing spaces!

I like that you handled hyphenated words so anything after the hyphen would wrap. I can't remember if I addressed that one in my apps, or not.

Pete
« Last Edit: September 18, 2018, 02:27:19 am by Pete »
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: qXed: linked list text editor
« Reply #19 on: September 18, 2018, 07:24:58 am »
Good morning,

Now *there's* the Pete I remember. Niiiiice and encouraging, haha. Yeah I'll just quit by tomorrow, you're right.

Sarcasm aside, it seems you noticed the actual bug I haven't bothered seeking out yet - its an off-by-one error that doesn't wrap the first line in any paragraph, even in non-wrap mode. The bug ins't even in the wrapping code, so its super shallow.

You're totally right about the cursor jumping when scrolling up. I concentrated on scrolling up by the right amount but apparently didn't bother putting the cursor where it belongs - will take one line to fix that.

I still acknowledge that it will crash when you delete basically all the characters. I save edge cases like that for last, dont worry.

As for the juicier observation you made about wrapping - damn, I'm just out of time at the moment. Ill have to pick that up tonight.

Closing comments before I rush out: This code is tight enough for me to aspire for it to be bug-free. I heartfully appreciate your (and everyone's) observations, and the time it takes to spell them all out. Maybe by pure accident this will feel like a Wordpad or a Gedit toward the end, but for now all it needs to do is keep me busy. Now that I've joined the race, I'm dying to know how far other people got with this. Say Pete, is your code from a few months (or years, pick any snapshot) still laying around the Internet somewhere?
« Last Edit: September 18, 2018, 08:04:29 am by STxAxTIC »
You're not done when it works, you're done when it's right.

Offline Aurel

  • Forum Regular
  • Posts: 167
    • View Profile
Re: qXed: linked list text editor
« Reply #20 on: September 18, 2018, 07:25:39 am »
STATIC and others
this approach have advantage only if your editor is used as code editor for programming or
scripting language and makes tekenization or parsing easier.
 
//////////////////////////////////////////////////////////////////
https://aurelsoft.ucoz.com
https://www.facebook.com/groups/470369984111370
//////////////////////////////////////////////////////////////////

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: qXed: linked list text editor
« Reply #21 on: September 18, 2018, 09:24:26 am »
Not sure I follow, Aurel. This method is no better for parsing than MID$, it does not lend itself to parsing for any good reason.

(What it *is* good for, data structure-wise, is nonlinear chains: trees, nodes, neural nets, that ballpark.)

Back to your point though: isnt general text editing almost a special case of coding? What approach is better in your view?
You're not done when it works, you're done when it's right.

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: qXed: linked list text editor
« Reply #22 on: September 27, 2018, 10:28:05 pm »
Ahoy everyone,

I found enough time to iron out the visible bugs, added a few new things as well. Still deciding how the behaviors will really work in the end, so there is no manual at the moment.  Needless to say, it's crystallizing nicely. Code updated in the top post.
You're not done when it works, you're done when it's right.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: qXed: linked list text editor
« Reply #23 on: September 28, 2018, 11:48:39 am »
Hi STxAxTIC,

Looks like fixes cost 200 lines, 2/5 ths the first edition .

Thanks for update. :)
« Last Edit: September 28, 2018, 11:50:02 am by bplus »

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: qXed: linked list text editor
« Reply #24 on: September 29, 2018, 03:31:08 pm »
Now I'm starting to look at the typing, and I discovered this unexpected behavior.

Place the cursor on the second line between "geometrical" and "spaces"

Type 123

That results in the expected: geometrical123 spaces

Without moving the current cursor position, hit the backspace key 3 times. This should undo the 123 that was inserted, but it doesn't.

Results: geometric1spaces

That "1" should have been removed. Instead what got removed is the space, which should have preserved.

This is very odd behavior for any WP. Backspace needs to cursor back first before it deletes a character. I'm pretty sure that's universal in WP applications. That fix, hopefully, will only take calling a cursor back routine before the delete character routine.

I'd like to check more, but I'm pretty tied up with all this SCOTUS appointment drama. Hey Bill, maybe you can help me by adding a replace feature to your WP. Please add a suitable auto-suggestion list of replacement words for the things I'm placing in my rough drafts to congress. It shouldn't take up to many lines. Most of the words that would need to be flagged are only 4-letters long.

Pete

Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: qXed: linked list text editor
« Reply #25 on: September 29, 2018, 03:38:32 pm »
Save time, flag the signature. ;)

bplus ;D

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: qXed: linked list text editor
« Reply #26 on: September 29, 2018, 03:46:06 pm »
Thanks, "Mark"

Pete :D
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: qXed: linked list text editor
« Reply #27 on: September 29, 2018, 03:52:22 pm »
Hey, just call me Mark123.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: qXed: linked list text editor
« Reply #28 on: September 29, 2018, 04:02:31 pm »
Yeah, thanks to my suggestion, I bet Steve is LHAO at Bill, Pete, Mark, and Fell and thanking his folks today for not naming him Jack.

Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: qXed: linked list text editor
« Reply #29 on: September 29, 2018, 06:00:00 pm »
Quote
Without moving the current cursor position, hit the backspace key 3 times. This should undo the 123 that was inserted, but it doesn't.

Hi Pete-

That's not a bug right now, it's perfectly expected and as the program is not prematurely optimized. I know you don't like it. One day I'll make a mode that says "behave exactly like Pete's favorite, Wordpad." Until then, it's confusing probably because you aren't playing the ESC key to change modes, which is probably because I haven't released a manual yet, which is probably because I said a few times already that there will be no manual til I get this how I want it. (So I'm saying press ESC first and redo your test but I don't blame you.)

That said, thanks for testing. Was that the only thing?
« Last Edit: September 29, 2018, 06:01:45 pm by STxAxTIC »
You're not done when it works, you're done when it's right.