Search

четверг, 22 сентября 2011 г.

Edit Function 1

Ok, so, the Edit function, I have enough information to complete it... Unless I get into some kind of small problem as I did in the display function.
Thing I need to do, possibly today:
1. Fix DEL case.
2. Write BACKSPACE case. 
3. Fix LEFT case.
4. Write RIGHT case.
5. Write HOME and END cases.
6. Work on INSERT mode.

*20:10*
Ok, I just finished fixing DEL case. That was easy - basically one line of code. It's not that hard, once you realize that you need to put a NULL in the right place. Then, the will appear a problem… Ok, not a problem, but a bag – if you push Delete continuously, eventually you will pass the cursor and keep deleting, even though I need it to Stop once it reaches the cursor. This bag was solved in about half an hour, I just needed to experiment a little.
Also, a Good line of code for testing, just put it in Left/Right cases:


display("Cursor"/"Set   ", 20, 0);       
//Displays the way you are moving (cursor or offset)
std::cout<<"                       "<<*curPosition<<"  "<<fieldLength; 
//Displays values you need for testing, can only be use with values that are passed to the Edit function and values in this function


I know there is a better debuggers out there, especially considering the fact that I use Visual Studio, but I’m not doing something too large or difficult to compile, so I’m using those lines, just because I feel more comfortable with them. 
Now I'll start working on a BACKSPACE case...  

*21:20*
Heh, documenting everything takes A Lot of Time.
 So, where was I? Oh yes, BACKSPACE. This is not that hard, the basic thing you need to understand while writing it – backspace is LEFT and DEL cases combined.

*21:40*
Well that was easy… Left and Right commands can be tricky, but it took me about half an hour to make them work the way they are supposed to. Now I just going to make the easiest (I think) ones – HOME and END. Let’s see what I can do.

*21:50*
That wasn’t that easy, but I also found out about a few more bags in the Left function. That might take some time, but that’s why I love this subject so much…

*22:22*
It took a while, but I got rid of one more bag – I tried to make it move a bit further if you hit left and if cursor  position is 0, and apparently without proper If statements it just went TOO far into space… I mean… String.
Ok, I need to wake up tomorrow around 8 am, I guess I’m done for today.

Комментариев нет:

Отправить комментарий