oh no, as expected, building a text editor is hard. wrapping lines brakes it lol. typical problem that i should have considered earlier! but...140 lines!
Post
ok, no wordwrap then! basically, if you write longer than 80 chars it will keep adding to the line but it won't display on screen, but the status bar at the bottom shows the length of the line as you type. if you really want to see what you're writing (lol), then you can 'insert" to push the remaining text down a line.
it's now about 200 lines of code. but i think it's time to stop.
i could keep adding functionality but i think then it would just get bigger and bigger. it's complex enough as it is now. i haven't included all Vi-commands but there are:
normal mode:
h/j/kl to move around
o / O insert lines above/below
0 / $ to move to beginning / end of line
gg / G to move to start / end of file
dd to delete a line
x to delete a char
i to enter insert mode
a to insert after
i didn't implement ''A' yet but i suppose i should.
where to cut off though?
for example, i don't have line numbers or jumping to line numbers
and i don't have the ability to compose like 4j to jump down 4 rows, or dw to delete forward a word. i think this would add too much complexity at this point. hoping it's useful already. will test out a few days, find bugs and add/delete functionality and hopefully call it a day.
i have achieved singularity and am working on the code for the editor in itself!
one issue is that i haven't implented '/' (search) either. oh well.
things are mostly working, though after saving and quitting a file i get a yabasic error even though everything working / saving ok!
anyone have a better naming suggestion than yabasic-vi ? or maybe if the shoe fits, wear it...
(for example, there is busybox vi, which is a (snort, guffaw) more full-featured vi clone)
Well, my BASIC Vi clone works but i don't know how much functionality to put into it! It's about 200 lines of code, but it's extremely constrained. Do i add `/` for search? Where to cut off work? i've never worked on a text editor before. The more functionality i add, the greater the chance for bugs.
i've come back and am at 360 lines of YaBasic code. i have normal mode, insert mode, command mode and even search mode. you can also prepend a count number before normal commands (e.g. 3j will jump down 3 lines. i was about to say i'm at feature complete but then i was like, oh wait, i need yy yank and p paste. where does it end. i think @dirtycommo hit on something smart when declaring programs should be no more than 100 lines of code, or at the longest no more than 200.