[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4787: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4789: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4790: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4791: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
InsideQC Forums • View topic - Text Manipulation

Text Manipulation

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

Text Manipulation

Postby Baker » Sat Feb 25, 2012 4:36 am

Thought experiment (maybe). This relates to some extent to a lack of multi platform tools for Quake and the inability of engines to display a text document for the most part. (Fixed width font type of thinking. Variable width gets into pixel width, font overhang and other factors that increase the complexity beyond the basics).

Functions of Text Editors

1) In-Memory Representation: A buffer to hold the characters of size X (perhaps limited to 65536 chars for starters).
2) Open/Save = fopen/fwrite the file from memory to file or the reverse

Base Navigation/Manipulation of Data (No consideration of view)

3) Cursor. The offset into the file.
4) Left arrow / Right arrow. Cursor offset +/- 1. Special consideration for TAB and carriage return and linefeed (?)
5) Up arrow / Down arrow. Cursor to identical offset in next row or previous row.
6) (Ctrl) Home / End. Beginning of line and end of line. With Control pressed, beginning/end of file. With alt, beginning or end of word.
7) Input. If insert mode on, memmove the buffer from cursor position to end + 1 (if space available), then place character. Otherwise overwrite.
8 ) Delete. memmove cursor + 1 to EOF to cursor position.
9) Paste. Depending on insert state, either overwrite starting a cursor point or memmove to location + size of paste data.
10) Undo. A crude version would be to have 5 in-memory copies of previous full text versions of the doc.
11) Cut or Copy? This would require selection ability. Shift held with arrow movement key would expand or begin selection mode. Any other operation would end selection except copy.

On-Screen Representation - View port

12) Viewport: Rows and columns of display. Topmost row. Leftmost column. (Leftmost column, topmost row, #columns, #rows).
13) Document characteristics: total rows, widest column.
14) Viewport stats: Rows of display as a percent of the document total rows. Columns of display as a percent of the widest column.
15) Cursor positioning moving beyond bounds of (leftmost column, topmost row, leftmost column + #columns - 1, topmost row + row - 1) moves viewport.
16) Up/Down arrow molded more to view port?
17) Wordwrap ... treat word breaks as newline if next word will not fit. Behavior of up/down must change a bit.
18) Refreshable linked list of line break locations. Indexed too. For fast display.

Other manipulation

19) Find function. Locate instances of X. Build an indexed results list.
20) Replace. Zzzz.
21) Find in files? Locate instances of X. Build an indexed results list with file and row and offset of each match.

I am also thinking that the viewing representation might be useful for displaying a doc. Possibly with some minimal HTML or RTF like characteristics. Like <img src = "my image">
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: Text Manipulation

Postby Baker » Sat Feb 25, 2012 12:02 pm

The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am


Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 2 guests