home *** CD-ROM | disk | FTP | other *** search
- /* CHESS FUNCTION(S): go_home, go_end
- /* DATE: 2/1/93
- /* AUTHOR: C. Schanck
- /*
- /* DESCRIPTION:
- /* This is a pair of functions which can be attached to your home
- /* and end keys and will give you some different functionality.
- /*
- /* for the first, pressing the home key will take you to the:
- /* 1) beginning of the line, if you are not there
- /* 2) top of the screen if you are not there
- /* 3) top of the file if you are not there
- /* evaluated in that order.
- /*
- /* for the second, pressing the end key will take you to the:
- /* 1) end of the line, if you are not there
- /* 2) bottom of the screen if you are not there
- /* 3) bottom of the file if you are not there
- /* evaluated in that order.
- /*
- /* many thanks to the CIS gang for there suggestions and efforts in
- /* these -- they aren't my originals, just mods of things people on
- /* Compuserve came up with! Enjoy!
- /*
- go_home{
- int i,ret;
- i=ask("file_column") /* find out what column we are on...
- if(i==1){ /* were we at the beginning?
- if(ask("file_y")==1){ /* are we at the top of the screen?
- ret=b_cmd("top_of_file");
- }
- else{
- /* here we were at the begin of the line, but not the screen
- ret=b_cmd("top_of_screen");
- }
- }
- else
- ret=b_cmd("begin_line");
- /* return the value of whatever bingo op we did last...
- return(ret);
- }
- go_end{
- int i,ret;
- i=ask("file_column") /* find out what column we are on...
- ret=b_cmd("end_line"); /* go to the end of the line
- if(i==ask("file_column")){ /* were we at the end?
- /* calculate the cursor position which is the end ...
- i=ask("file_w_top")+ask("file_w_height")-1;
- if(ask("file_y")==i){ /* are we there?
- /* we are at the bottom of the screen
- ret=b_cmd("bot_of_file");
- }
- else{
- /* here we were at the end of the line, but not the bot of screen
- ret=b_cmd("bottom_of_screen");
- }
- }
- /* return the value of whatever bingo op we did last...
- return(ret);
- }
-