Skip to Main Content
Volume 7A: XView Programming Manual
book

Volume 7A: XView Programming Manual

by Dan Heller
October 1994
Intermediate to advanced content levelIntermediate to advanced
770 pages
22h 58m
English
O'Reilly Media, Inc.
Content preview from Volume 7A: XView Programming Manual
The code fragment below can be used to find delimited text. Notice that the field_flag
value is TEXTSW_DELIMITER_FORWARD.
Textsw_index first, last_plus_one, pos;
first = (Textsw_index) xv_get(textsw, TEXTSW_INSERTION_POINT);
pos = textsw_match_bytes(textsw, &first, &last_plus_one,
"/*", 2,
"*/", 2, TEXTSW_DELIMITER_FORWARD);
if (pos > 0) {
textsw_set_selection(textsw, first, last_plus_one, 1);
xv_set(textsw, TEXTSW_INSERTION_POINT, last_plus_one, NULL);
} else
(void) window_bell(textsw);
This code searches forward from first until it finds the starting /* and matches it forward
with the next */. If no match is found, a bell will ring in the text subwindow.
8.9 Marking Positions
Often a client wants to keep track of a particular character or group of characters that are in
the text subwindow. Given that arbitrary editing can occur in a text subwindow and that it is
very tedious to intercept and track all of the editing operations applied to a text subwindow, it
is often easier to simply place one or more marks at various positions in the text subwindow.
These marks are automatically updated by the text subwindow to account for user and client
edits. There is no limit to the number of marks you can add.
A new mark is created by calling:
Textsw_mark
textsw_add_mark(textsw, position, flags)
Textsw textsw;
Textsw_index position;
unsigned flags;
The flags argument is either TEXTSW_MARK_DEFAULTS or TEXTSW_MARK_
MOVE_AT_INSERT
. The latter causes an insertion at the marked position to move the mark to
the end of
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Volume 6A: Motif Programming Manual

Volume 6A: Motif Programming Manual

David Brennan, Dan Heller, Paula Ferguson
Java™ Media APIs: Cross-Platform Imaging, Media, and Visualization

Java™ Media APIs: Cross-Platform Imaging, Media, and Visualization

Alejandro Terrazas, John Ostuni, Michael Barlow

Publisher Resources

ISBN: 9780937175873