1
edit
Changes
→Line Editor: int iof_edit(........): added links to IsTextEditor and made minor changes.
# If '''"*curpos"''' exceeds the value of fieldlen, correct the '''"*curpos"''' so that cursor stands at the last position inside the field.
# If '''"*offset"''' is greater than the length of the string, set the '''"*offset"''' so the “last character of str” is hidden right before the first space in the field. (See'''“[[OOP344 BIO 20101#IsTextEditor:|IsTextEditor]] ”''' for more)
# After the above, if cursor is past the last character of '''“str”''', set '''"*curpos"''' so the cursor stands right after the last character of "str".
The cursor is never allowed tobe: 1- move # before the start of the field, 2- be .# more than one position past the last character in the string, 3- be .# after the end of the field.
<u>Editing is terminated by pressing ENTER, TAB, UP, DOWN, PGUP, PGDN or any of the function keys (F1 to F12)</u>. Pressing<u>ESCAPE will terminate the iof_edit() and abort editing</u>: '''"str"'''will contain originally passed data when leaving function.
Note that the conditions of termination are changed if the '''“IsTextEditor”''' flag is true (non-zero). See '''“IsTextEditor”“[[OOP344 BIO 20101#IsTextEditor:|IsTextEditor]]”'''section for detail.
If '''"ReadOnly"''' has a true value (non-zero), then any attempt to change the content of '''"str"''' should end the function and return the key. Note that all other keys should work (Function and Non-ASCII keys). This makes the '''iof_edit()''' funciton "read only", but the user still can scroll the text to left or right and etc....
* TAB:
** if '''IsTextEditor''' is false, TAB will simply terminate the function like a Function key
** if '''IsTextEditor''' is true, TAB will insert CIO_TAB_SIZE number of spaces into the string.'''CIO_TAB_SIZE''' should be a defined "tab size" value in ciol.h. If '''CIO_TAB_SIZE''' spaces cannot be inserted into the string for any reason then the inputted tab should be ignored. (See below for more about '''“[[OOP344 BIO 20101#IsTextEditor:|IsTextEditor]]”''' flag)* ESCAPE - Terminates iof_edit() and aborts editing: '''"str"''' will contain originally passed data when leaving function. (See'''“[[OOP344 BIO 20101#IsTextEditor:|IsTextEditor]] ”''' for exception)
* INSERT - toggle Insert/Overstrike mode<br />In Insert mode, printable characters are inserted into the string, moving the remainder of the string to the right to make room. In Overstrike mode, printable characters overwrite existing characters (if any). Note that if you are past the end of the string, printable characters are appended to the string (as long as the string isn't full) regardless of the mode. Also note that, regardless of the mode, the cursor advances as printable characters are typed into the string. Finally, if the cursor is at the end of the field, instead of moving to right, the characters are shifted to left.