XawTextPosition left, XawTextPosition right, XawTextBlock *block) { Arg args[1]; Widget src; XawTextEditType edit_mode; if (left == right && block->length == 0) return (XawEditDone); src = ctx->text.source; XtSetArg(args[0], XtNeditType, &edit_mode); XtGetValues(src, args, 1); if (edit_mode == XawtextAppend) { if (block->length == 0) return (XawEditError); ctx->text.insertPos = ctx->text.lastPos; } #ifndef OLDXAW return (SrcReplace(src, left, right, block)); #else if (SrcReplace(src, left, right, block) == XawEditDone) { _XawTextSourceChanged((Widget)ctx, left, right, block, 0); return (XawEditDone); } return (XawEditError); #endif } /* * This routine will display text between two arbitrary source positions. * In the event that this span contains highlighted text for the selection, * only that portion will be displayed highlighted. */ static void OldDisplayText(Widget w, XawTextPosition left, XawTextPosition right) { static XmuSegment segment; static XmuScanline next; static XmuScanline scanline = {0, &segment, &next}; static XmuArea area = {&scanline}; TextWidget ctx = (TextWidget)w; int x, y, line; XawTextPosition start, end, last, final; XmuScanline *scan; XmuSegment *seg; XmuArea *clip = NULL; Bool cleol = ctx->text.clear_to_eol; Bool has_selection = ctx->text.s.right > ctx->text.s.left; left = left < ctx->text.lt.top ? ctx->text.lt.top : left; if (left > right || !LineAndXYForPosition(ctx, left, &line, &x, &y)) return; last = XawTextGetLastPosition(ctx); segment.x2 = (int)XtWidth(ctx) - ctx->text.r_margin.right; if (cleol) clip = XmuCreateArea(); for (start = left; start < right && line < ctx->text.lt.lines; line++) { if ((end = ctx->text.lt.info[line + 1].position) > right) end = right; final = end; if (end > last) end = last; if (end > start) { if (!has_selection || (start >= ctx->text.s.right || end <= ctx->text.s.left)) _XawTextSinkDisplayText(ctx->text.sink, x, y, start, end, False); else if (start >= ctx->text.s.left && end <= ctx->text.s.right) _XawTextSinkDisplayText(ctx->text.sink, x, y, start, end, True); else { OldDisplayText(w, start, ctx->text.s.left); OldDisplayText(w, Max(start, ctx->text.s.left), Min(end, ctx->text.s.right)); OldDisplayText(w, ctx->text.s.right, end); } } x = ctx->text.left_margin; if (cleol) { segment.x1 = ctx->text.lt.info[line].textWidth + x; if (XmuValidSegment(&segment)) { scanline.y = y; next.y = ctx->text.lt.info[line + 1].y; XmuAreaOr(clip, &area); } } start = final; y = ctx->text.lt.info[line + 1].y; } if (cleol) { for (scan = clip->scanline; scan && scan->next; scan = scan->next) for (seg = scan->segment; seg; seg = seg->next) SinkClearToBG(ctx->text.sink, seg->x1, scan->y, seg->x2 - seg->x1, scan->next->y - scan->y); XmuDestroyArea(clip); } } /*ARGSUSED*/ static void DisplayText(Widget w, XawTextPosition left, XawTextPosition right) { #ifndef OLDXAW static XmuSegment segment; static XmuScanline next; static XmuScanline scanline = {0, &segment, &next}; static XmuArea area = {&scanline}; TextWidget ctx = (TextWidget)w; int y, line; XawTextPosition from, to, lastPos; XmuScanline *scan; XmuSegment *seg; Bool cleol = ctx->text.clear_to_eol; Bool has_selection = ctx->text.s.right > ctx->text.s.left; XawTextPaintList *paint_list; left = left < ctx->text.lt.