I've been working on a text editor lately. (You might have seen me asking questions about it.)
link: https://github.com/michael0x18/cedit

Currently, I'm working on scrolling/cursor moving.
Specifically, I'm having trouble with the following parts:
Moving the cursor one row up or down
Scrolling the screen one row up or down.

I have a variable, scr_offset, which points to the start of the screen (the first character displayed).
Could someone take a look at the code and give me some tips/pointers? no pun intended
Okay.
I've got everything working, except for scrolling up.
I'm actually retarded or something, because I've rewritten it like eight times and never gotten it to work right.
(I actually need help with this)
The best way is to store the length of each line in the file.
All right, I've gotten everything debugged (or so I think). Here's a development release: https://github.com/Michael0x18/CEdit/releases/download/ALPHA/CEDIT.8xp If you all could chip in and test it that would be great Very Happy

As for keybinds, look at the images in the repo. They're a little weird.

TODO:
Selection
Open menu
Cut, copy, paste
Document keybindings further
save prompt when exiting
Add more compat - Beck, if you're reading this, can you tell me the BOSShell argument passing method again?
More?
Michael0x18 wrote:
All right, I've gotten everything debugged (or so I think). Here's a development release: https://github.com/Michael0x18/CEdit/releases/download/ALPHA/CEDIT.8xp If you all could chip in and test it that would be great Very Happy

As for keybinds, look at the images in the repo. They're a little weird.

TODO:
Selection
Open menu
Cut, copy, paste
Document keybindings further
save prompt when exiting
Add more compat - Beck, if you're reading this, can you tell me the BOSShell argument passing method again?
More?


This page gives information on the appvar BOSshell initializes when running a program as an editor.
Just tested out the program, I think it would be best it if you included a case indicator. other that the program looks good so far I like the purple color Razz.
Uh... The modifier keys are held, so if you hold the XT0N Key, that's shift (capitals) and if you hold alpha that's, well, alpha. Mode is Meta. (For other shortcuts.) I can add an indicator that displays the modifier state (It can't just be a case indicator, because multi-modifier shortcuts are possible, such as mode-shift-left to select until the start of a line)
Here's a minor update: https://github.com/Michael0x18/CEdit/releases/tag/ALPHA_0.01
Scrolling is weird, the scroll_down thing is sketchy and has known bugs, I just need to knuckle down at some point and rewrite it: scroll_up works in O(1) time from the cursor position, but scroll_down works in O(n^2), scrolling one line down, redrawing, and repeating until the cursor is on the screen.

Also, Beck, thanks. I'll try to add compatibility with BOSShell.
Hey-so I noticed you have compatibility with various shells for this program. How can I get VYSION 2 to work with it, or does it just do the standard "AVNAME":prgmCEDIT (in which case it should already).
Yeah, it just does the standard "NAME":prgmCEDIT.
However, it reads NAME until a space, or a null, or 8 characters are reached, whichever comes first.
You shouldn't worry. Even if VYSION used a weird protocol, it would be my job, not yours, to achieve compatibility.
Double post, but big update and it's been more than 24 hours.
Here's a screenshot(finally)

I've hacked together some screenshot code; I still need to knuckle down and rewrite the downward scrolling.
I also need to find a good monospace font.
How does "Comic code" sound?
Michael0x18 wrote:
Double post, but big update and it's been more than 24 hours.
Here's a screenshot(finally)

I've hacked together some screenshot code; I still need to knuckle down and rewrite the downward scrolling.
I also need to find a good monospace font.
How does "Comic code" sound?

Does this use fontlibc or would gfx_SetMonoSpaceFont() help here?
I'm not currently using Fontlibc, but should I?
Michael0x18 wrote:
I'm not currently using Fontlibc, but should I?


Look into fontlibc's monospace equivalent, I'm sure there's a function for it.

https://github.com/Michael0x18/CEdit/releases/tag/BETA
CEdit is now open for testing!
Nice work! Very Happy Looks like it is coming along.

Also, shame: https://github.com/Michael0x18/CEdit/blob/2cb85403c54aef038bc31731482b2057ce6ac21d/src/main.c#L653
Yeah. My bad. There's a DrMono appvar in the tar.gz file containing the binaries, but none in the github repo.
Edit: Added the var: https://github.com/Michael0x18/CEdit/blob/master/DrMono.8xv?raw=true
??? I was talking more about the use of printf.
Couldn't you just use gfx_PrintStringXY(), or os_PutStrFull() as the lettuce man suggestedI guess there is order in the world after all, or we wouldn't be able to say with certainty that one function is better than another. p.s.if you don't get this, then ignore it Evil or Very Mad
Whoops Razz
I let that slip into the release.
(it's fixed now)
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 3
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement