/* * A very quick application to test a FullTextEditor. */ #include "fulltexteditor.h" main () { World* w = new World; char* buf = new char[1000]; /* * Open a FullTextEditor of a standard size. The initial file will be * ./fulltexteditor.h. A text buffer of an appropriate size will be * allocated automatically in the FullTextEditor constructor. */ FullTextEditor* fed = new FullTextEditor("fulltexteditor.h", 24, 80, 8, 1); /* * Insert some test text into the FullTextEditor and run a few test * functions. All of the standard TextEditor functions are available for a * FullTextEditor object. See "man TextEditor" for the complete * documentation. To access the contained TextBuffer, use the GetBuffer * function. See "man TextBuffer" for complete doc on text buffer * functions. */ fed->InsertText("THIS IS NEW TEXT ADDED TO THE TOP OF THE BUFFER, ", strlen("THIS IS NEW TEXT ADDED TO THE TOP OF THE BUFFER, ")); fed->InsertText("JUST FOR TESTING PURPOSES\n", strlen("JUST FOR TESTING PURPOSES\n")); fed->ForwardCharacter(3); printf("The 26th char in buffer is %c\n", fed->GetBuffer()->Char(26)); char* tempbuf = new char[16]; strncpy(tempbuf, fed->GetBuffer()->Text(26,40), 15); tempbuf[15] = '\0'; printf("The text between the 26th and 40th chars is %s\n", tempbuf); /* * Fire it up. The end user will have all of the editing commands * available in a standard InterViews sted, except for quit, close, and * visit See "man sted" for complete user-level documentation. */ w->InsertApplication(fed); /* * Test out the options settings. */ w->InsertApplication( new FullTextEditor(24, 80, 8, Reversed, false, false, OutlineCaret)); w->Run(); }