Lines Matching refs:text
58 #define MULT(w) (w->text.mult == 0 ? 4 : \
59 w->text.mult == 32767 ? -4 : w->text.mult)
275 TextSrcObject src = (TextSrcObject)ctx->text.source;
278 _XawTextPrepareToUpdate((TextWidget)src->textSrc.text[i]);
288 ctx->text.time = event->xbutton.time;
292 ctx->text.time = event->xkey.time;
295 ctx->text.time = event->xmotion.time;
299 ctx->text.time = event->xcrossing.time;
310 ctx->text.ev_x = (Position)event->xbutton.x;
311 ctx->text.ev_y = (Position)event->xbutton.y;
316 XawTextSinkGetCursorBounds(ctx->text.sink, &cursor);
317 ctx->text.ev_x = (Position)(cursor.x + cursor.width / 2);
318 ctx->text.ev_y = (Position)(cursor.y + cursor.height / 2);
321 ctx->text.ev_x = (Position)(event->xmotion.x);
322 ctx->text.ev_y = (Position)(event->xmotion.y);
326 ctx->text.ev_x = (Position)(event->xcrossing.x);
327 ctx->text.ev_y = (Position)(event->xcrossing.y);
336 TextSrcObject src = (TextSrcObject)ctx->text.source;
339 _XawTextExecuteUpdate((TextWidget)src->textSrc.text[i]);
341 ctx->text.mult = 1;
342 ctx->text.numeric = False;
343 if (ctx->text.kill_ring) {
344 if (--ctx->text.kill_ring == KILL_RING_YANK_DONE) {
345 if (ctx->text.kill_ring_ptr) {
346 --ctx->text.kill_ring_ptr->refcount;
347 ctx->text.kill_ring_ptr = NULL;
352 ctx->text.mult = 1;
374 XawTextBlock text;
395 /* We tried all possible text targets in this param.
437 text.format = XawFmtWide;
439 text.ptr = (char*)value;
440 text.firstPos = 0;
441 text.length = (int)*length;
442 if (_XawTextReplace(ctx, ctx->text.insertPos, ctx->text.insertPos, &text)) {
448 ctx->text.from_left = -1;
449 ctx->text.insertPos = SrcScan(ctx->text.source, ctx->text.old_insert,
450 XawstPositions, XawsdRight, text.length, True);
512 GetSelection(w, ((TextWidget)w)->text.time, params, *num_params);
531 insertPos = SrcScan(ctx->text.source, ctx->text.insertPos,
536 if (ctx->text.s.left != ctx->text.s.right)
540 ctx->text.numeric = False;
542 ctx->text.mult = 1;
543 ctx->text.showposition = True;
544 ctx->text.from_left = -1;
545 ctx->text.insertPos = insertPos;
585 XawTextPosition position = ctx->text.insertPos;
589 ctx->text.mult = (short)(-mult);
595 position = SrcScan(ctx->text.source, position,
598 while (position == SrcScan(ctx->text.source, position,
600 if (++position > ctx->text.lastPos) {
605 position = SrcScan(ctx->text.source, position,
607 if (position != ctx->text.lastPos)
608 position = SrcScan(ctx->text.source, position - 1,
614 if (position != ctx->text.insertPos) {
617 ctx->text.showposition = True;
618 ctx->text.from_left = -1;
619 ctx->text.insertPos = position;
623 ctx->text.mult = 1;
631 XawTextPosition position = ctx->text.insertPos;
635 ctx->text.mult = (short)(-mult);
641 position = SrcScan(ctx->text.source, position,
644 while (position == SrcScan(ctx->text.source, position,
651 position = SrcScan(ctx->text.source, position,
653 if (position > 0 && position < ctx->text.lastPos)
659 if (position != ctx->text.insertPos) {
662 ctx->text.showposition = True;
663 ctx->text.from_left = -1;
664 ctx->text.insertPos = position;
668 ctx->text.mult = 1;
699 cnew = SrcScan(ctx->text.source, ctx->text.insertPos,
702 if (ctx->text.from_left < 0)
703 FindDist(ctx->text.sink, cnew, ctx->text.left_margin, ctx->text.insertPos,
704 &ctx->text.from_left, <emp, &itemp);
706 cnew = SrcScan(ctx->text.source, ctx->text.insertPos, XawstEOL, dir,
709 next_line = SrcScan(ctx->text.source, cnew, XawstEOL, XawsdRight, 1, False);
711 FindPos(ctx->text.sink, cnew, ctx->text.left_margin, ctx->text.from_left,
712 False, &ctx->text.insertPos, &from_left, &itemp);
714 if (from_left < ctx->text.from_left) {
717 XawTextSourceRead(ctx->text.source, ctx->text.insertPos, &block, 1);
721 ++ctx->text.insertPos;
724 ++ctx->text.insertPos;
728 if (ctx->text.insertPos > next_line)
729 ctx->text.insertPos = next_line;
741 ctx->text.mult = (short)(-mult);
746 if (ctx->text.insertPos < ctx->text.lastPos)
749 ctx->text.mult = 1;
759 ctx->text.mult = (short)(-mult);
764 if (ctx->text.lt.top != 0 || (ctx->text.lt.lines > 1 &&
765 ctx->text.insertPos >= ctx->text.lt.info[1].position))
768 ctx->text.mult = 1;
795 if (ctx->text.lt.lines > 1
797 || ctx->text.lastPos >= ctx->text.lt.info[1].position)) {
808 ctx->text.mult = 1;
810 ctx->text.numeric = False;
835 ctx->text.from_left = -1;
838 if (ctx->text.lt.top != 0)
839 scroll_val = -Max(1, ctx->text.lt.lines - 1);
842 if (!IsPositionVisible(ctx, Max(0, ctx->text.lastPos)))
843 scroll_val = Max(1, ctx->text.lt.lines - 1);
849 ctx->text.left_margin - ctx->text.r_margin.left);
851 old_pos = ctx->text.insertPos;
854 if (IsPositionVisible(ctx, Max(0, ctx->text.lastPos)))
855 ctx->text.insertPos = Max(0, ctx->text.lastPos);
857 ctx->text.insertPos = ctx->text.lt.top;
858 if (ctx->text.insertPos < old_pos)
859 ctx->text.insertPos = SrcScan(ctx->text.source, old_pos,
864 ctx->text.insertPos = 0;
865 else if (ctx->text.lt.lines)
866 ctx->text.insertPos =
867 ctx->text.lt.info[ctx->text.lt.lines - 1].position;
869 ctx->text.insertPos = ctx->text.lt.top;
870 if (ctx->text.insertPos > old_pos)
871 ctx->text.insertPos = SrcScan(ctx->text.source, old_pos,
884 ctx->text.mult = (short)(-mult);
889 if (ctx->text.insertPos < ctx->text.lastPos) {
892 ctx->text.clear_to_eol = True;
893 while (mult-- && ctx->text.insertPos < ctx->text.lastPos)
898 ctx->text.mult = 1;
909 ctx->text.mult = (short)(-mult);
914 if (ctx->text.insertPos > 0) {
917 ctx->text.clear_to_eol = True;
918 while (mult-- && ctx->text.insertPos > 0)
923 ctx->text.mult = 1;
951 Widget src = ctx->text.source;
969 XmuConvertStandardSelection(w, ctx->text.time, selection,
996 for (salt = ctx->text.salt2; salt; salt = salt->next)
1137 if (XmuConvertStandardSelection(w, ctx->text.time, selection, target, type,
1159 for (salt = ctx->text.salt2; salt; salt = nextSalt) {
1217 ctx->text.salt2 = nextSalt;
1231 XawTextBlock text;
1234 if (ctx->text.kill_ring_ptr) {
1235 --ctx->text.kill_ring_ptr->refcount;
1236 ctx->text.kill_ring_ptr = NULL;
1251 if (ctx->text.kill_ring == KILL_RING_APPEND) {
1252 old_from = ctx->text.salt2->s.left;
1256 ctx->text.kill_ring = KILL_RING_BEGIN;
1327 salt->next = ctx->text.salt2;
1328 ctx->text.salt2 = salt;
1332 ctx->text.kill_ring = KILL_RING_BEGIN;
1337 XtOwnSelection((Widget)ctx, selection, ctx->text.time,
1341 text.length = 0;
1342 text.firstPos = 0;
1344 text.format = (unsigned long)_XawTextFormat(ctx);
1345 text.ptr = (char*)"";
1347 if (_XawTextReplace(ctx, from, to, &text)) {
1351 ctx->text.from_left = -1;
1352 ctx->text.insertPos = from;
1353 ctx->text.showposition = TRUE;
1371 _XawSourceSetUndoMerge((TextSrcObject)ctx->text.source, True);
1373 to = SrcScan(ctx->text.source, ctx->text.insertPos,
1381 if (to == ctx->text.insertPos)
1382 to = SrcScan(ctx->text.source, ctx->text.insertPos,
1387 to = ctx->text.insertPos;
1390 from = ctx->text.insertPos;
1401 if (ctx->text.s.left != ctx->text.s.right)
1415 ctx->text.mult = mul;
1421 _XawSourceSetUndoErase((TextSrcObject)ctx->text.source,
1507 end_of_line = SrcScan(ctx->text.source, ctx->text.insertPos, XawstEOL,
1509 if (end_of_line == ctx->text.insertPos)
1510 end_of_line = SrcScan(ctx->text.source, ctx->text.insertPos, XawstEOL,
1514 _DeleteOrKill(ctx, ctx->text.insertPos, end_of_line, True);
1516 _DeleteOrKill(ctx, end_of_line, ctx->text.insertPos, True);
1531 _DeleteOrKill(ctx, ctx->text.s.left, ctx->text.s.right, kill);
1548 XawTextPosition insertPos = ctx->text.insertPos;
1551 if (ctx->text.s.left != ctx->text.s.right)
1556 if (ctx->text.kill_ring_ptr == NULL) {
1557 ctx->text.kill_ring_ptr = &kill_ring_prev;
1558 ++ctx->text.kill_ring_ptr->refcount;
1559 ctx->text.s.left = ctx->text.s.right = insertPos;
1562 if (ctx->text.kill_ring_ptr) {
1564 XawTextBlock text;
1569 --ctx->text.kill_ring_ptr->refcount;
1571 if ((ctx->text.kill_ring_ptr = ctx->text.kill_ring_ptr->next) == NULL)
1572 ctx->text.kill_ring_ptr = &kill_ring_null;
1574 ++ctx->text.kill_ring_ptr->refcount;
1576 text.firstPos = 0;
1577 text.length = ctx->text.kill_ring_ptr->length;
1578 text.ptr = ctx->text.kill_ring_ptr->contents;
1579 text.format = ctx->text.kill_ring_ptr->format;
1581 if (_XawTextReplace(ctx, ctx->text.s.left, insertPos, &text) == XawEditDone) {
1582 ctx->text.kill_ring = KILL_RING_YANK;
1583 ctx->text.insertPos = ctx->text.s.left + text.length;
1611 XawTextBlock block, text;
1614 text.firstPos = 0;
1615 text.format = XawFmt8Bit;
1616 text.ptr = (char*)" ";
1617 text.length = 1;
1619 XawTextSourceRead(ctx->text.source, position, &block, (int)(right - left));
1641 if (_XawTextReplace(ctx, tmp + i, tmp + i + 1, &text))
1646 position = XawTextSourceRead(ctx->text.source, tmp,
1652 text.ptr = (char*)"";
1653 text.length = 0;
1655 XawTextSourceRead(ctx->text.source, position, &block, (int)(right - left));
1656 ipos = ctx->text.insertPos;
1680 if (_XawTextReplace(ctx, tmp + i - count, tmp + i, &text))
1706 position = XawTextSourceRead(ctx->text.source, tmp,
1712 ctx->text.insertPos = ipos;
1723 XawTextBlock text, block;
1725 TextSinkObject sink = (TextSinkObject)ctx->text.sink;
1730 text.firstPos = 0;
1731 text.ptr = (char*)"\t";
1732 text.format = XawFmt8Bit;
1733 text.length = 1;
1735 XawTextSourceRead(ctx->text.source, position, &block, (int)(right - left));
1736 ipos = ctx->text.insertPos;
1811 if (_XawTextReplace(ctx, tmp + i - count + 1, tmp + i + 1, &text))
1849 position = XawTextSourceRead(ctx->text.source, tmp,
1855 ctx->text.insertPos = ipos;
1866 XawTextBlock block, text;
1868 TextSinkObject sink = (TextSinkObject)ctx->text.sink;
1874 text.firstPos = 0;
1875 text.format = XawFmt8Bit;
1876 text.ptr = tabs;
1878 XawTextSourceRead(ctx->text.source, position, &block, (int)(right - left));
1879 ipos = ctx->text.insertPos;
1921 text.length = (tab_base + tab_column) - count;
1922 if (text.length > 8) {
1925 text.ptr = XtMalloc((Cardinal)text.length);
1926 for (j = 0; j < text.length; j++)
1927 text.ptr[j] = ' ';
1930 text.ptr = tabs;
1933 text.length = DEFAULT_TAB_SIZE - (count % DEFAULT_TAB_SIZE);
1935 if (_XawTextReplace(ctx, tmp + i, tmp + i + 1, &text)) {
1936 if (tab_count && text.length > 8)
1937 XtFree(text.ptr);
1940 if (tab_count && text.length > 8)
1941 XtFree(text.ptr);
1942 count += text.length;
1943 right += text.length - 1;
1951 pos[cpos] += text.length;
1961 ipos += text.length;
1973 position = XawTextSourceRead(ctx->text.source, tmp,
1979 ctx->text.insertPos = ipos;
1991 XawTextBlock block, *text;
1992 XawTextPosition end = ctx->text.lastPos, buf[32];
1993 TextSrcObject src = (TextSrcObject)ctx->text.source;
1994 XawTextPosition right = SrcScan(ctx->text.source, left, XawstEOL,
2003 pos[i] = ((TextWidget)src->textSrc.text[i])->text.insertPos;
2012 text = █
2015 text = NULL;
2017 result = DoFormatText(ctx, left, force, 1, text, pos, num_pos, paragraph);
2024 rlen = (unsigned)(llen + (ctx->text.lastPos - end));
2050 TextWidget tw = (TextWidget)src->textSrc.text[i];
2051 tw->text.insertPos = XawMin(XawMax(0, pos[i]), tw->text.lastPos);
2067 XawTextPosition right = SrcScan(ctx->text.source, left, XawstEOL,
2070 XawTextBlock block, text;
2076 position = XawTextSourceRead(ctx->text.source, left, &block, (int)(right - left));
2089 tmp = ctx->text.lastPos;
2092 right += ctx->text.lastPos - tmp;
2093 position = XawTextSourceRead(ctx->text.source, left, &block,
2097 text.firstPos = 0;
2098 text.format = XawFmt8Bit;
2100 ipos = ctx->text.insertPos;
2124 position = XawTextSourceRead(ctx->text.source, position,
2130 if (count < ctx->text.left_column) {
2131 int bytes = ctx->text.left_column - count;
2133 text.ptr = XawStackAlloc((unsigned)bytes, buf);
2134 text.length = bytes;
2136 text.ptr[i] = ' ';
2138 if (_XawTextReplace(ctx, left, left, &text)) {
2139 XawStackFree(text.ptr, buf);
2142 XawStackFree(text.ptr, buf);
2156 && ipos <= right && ipos - left > ctx->text.right_column) {
2157 XawTextPosition len = ctx->text.lastPos;
2158 int skip = ctx->text.justify == XawjustifyRight
2159 || ctx->text.justify == XawjustifyCenter ?
2160 ctx->text.left_column : count;
2168 right += ctx->text.lastPos - len;
2172 ipos = ctx->text.insertPos;
2173 done = ipos - left > ctx->text.right_column;
2176 if ((paragraph || done) && right - left > ctx->text.right_column) {
2178 XawTextSourceRead(ctx->text.source, position - 1, &block, 1);
2185 while (position - left > ctx->text.right_column) {
2187 position = SrcScan(ctx->text.source, position,
2190 if (position <= left + ctx->text.left_column)
2192 if (position > left && position - left > ctx->text.left_column
2194 text.ptr = (char*)"\n";
2195 text.length = 1;
2197 if (_XawTextReplace(ctx, position, position + 1, &text))
2206 if (ctx->text.justify == XawjustifyCenter)
2207 count = ctx->text.right_column - (count - ctx->text.left_column);
2209 count = ctx->text.right_column;
2218 switch (ctx->text.justify) {
2223 if (ctx->text.justify == XawjustifyCenter) {
2227 XawTextSourceRead(ctx->text.source, right, &block, 1);
2236 text.ptr = XawStackAlloc((unsigned)count, buf);
2237 text.length = count;
2239 text.ptr[i] = ' ';
2241 if (_XawTextReplace(ctx, left, left, &text)) {
2242 XawStackFree(text.ptr, buf);
2245 XawStackFree(text.ptr, buf);
2260 tmp = SrcScan(ctx->text.source, tmp, XawstWhiteSpace,
2275 text.ptr = XawStackAlloc((unsigned)steps, buf);
2277 text.ptr[i] = ' ';
2286 tmp = SrcScan(ctx->text.source, tmp, XawstWhiteSpace,
2289 text.length = (int)inc;
2291 text.length = bytes;
2292 bytes -= text.length;
2293 if (_XawTextReplace(ctx, tmp, tmp, &text)) {
2294 XawStackFree(text.ptr, buf);
2300 pos[cpos] += text.length;
2303 ipos += text.length;
2308 XawStackFree(text.ptr, buf);
2315 ctx->text.insertPos = XawMin(ipos, ctx->text.lastPos);
2318 ctx->text.justify != XawjustifyFull
2330 TextSrcObject src = (TextSrcObject)ctx->text.source;
2332 XawTextBlock text;
2337 Bool format = ctx->text.auto_fill
2338 && ctx->text.left_column < ctx->text.right_column;
2340 text.firstPos = 0;
2341 text.format = XawFmt8Bit;
2342 text.ptr = (char*)"";
2348 pos[i] = ((TextWidget)src->textSrc.text[i])->text.insertPos;
2358 end = ctx->text.lastPos;
2363 tmp = ctx->text.lastPos;
2374 to += ctx->text.lastPos - tmp;
2381 text.ptr = XawStackAlloc((unsigned)spaces, buf);
2383 text.ptr[i] = ' ';
2385 text.length = spaces;
2387 _XawTextReplace(ctx, tmp, tmp, &text);
2394 tmp = SrcScan(ctx->text.source, tmp, XawstEOL, XawsdRight, 1, True);
2396 XawStackFree(text.ptr, buf);
2401 text.length = 0;
2409 tmp = SrcScan(ctx->text.source, tmp, XawstEOL, XawsdRight, 1, True);
2416 _XawTextReplace(ctx, tmp, tmp + spaces, &text);
2427 tmp = SrcScan(ctx->text.source, tmp, XawstEOL, XawsdRight, 1, True);
2435 unsigned rlen = (unsigned)(llen + (ctx->text.lastPos - end));
2440 text.format = (unsigned long)_XawTextFormat(ctx);
2443 text.ptr = lbuf;
2444 text.length = (int)llen;
2445 _XawTextReplace(ctx, from, from + rlen, &text);
2448 text.ptr = rbuf;
2449 text.length = (int)rlen;
2450 _XawTextReplace(ctx, from, from + llen, &text);
2459 TextWidget tw = (TextWidget)src->textSrc.text[i];
2461 tw->text.insertPos = XawMin(XawMax(0, pos[i]), tw->text.lastPos);
2464 ctx->text.showposition = True;
2475 ctx->text.overwrite = !ctx->text.overwrite;
2492 XawTextBlock text;
2496 ctx->text.mult = 1;
2500 text.format = (unsigned long)_XawTextFormat(ctx);
2501 text.length = mult;
2502 text.firstPos = 0;
2504 if (text.format == XawFmtWide) {
2507 text.ptr = (XawStackAlloc(sizeof(wchar_t) * (size_t)mult, buf));
2508 wptr = (wchar_t *)text.ptr;
2513 text.ptr = (XawStackAlloc(sizeof(char) * (size_t)mult, buf));
2515 text.ptr[count] = XawLF;
2519 position = SrcScan(ctx->text.source, ctx->text.insertPos,
2522 if (_XawTextReplace(ctx, ctx->text.insertPos, ctx->text.insertPos, &text)) {
2527 ctx->text.showposition = TRUE;
2528 ctx->text.insertPos += text.length;
2531 XawStackFree(text.ptr, buf);
2534 if (ctx->text.auto_fill && error == XawEditDone)
2535 (void)FormatText(ctx, position, ctx->text.justify != XawjustifyFull,
2547 XawTextPosition insertPos = ctx->text.insertPos;
2551 ctx->text.insertPos = SrcScan(ctx->text.source, insertPos, XawstEOL,
2563 ctx->text.from_left = -1;
2580 XawTextBlock text;
2587 pos1 = SrcScan(ctx->text.source, ctx->text.insertPos,
2590 line_to_ip = _XawTextGetText(ctx, pos1, ctx->text.insertPos);
2592 text.format = (unsigned long)_XawTextFormat(ctx);
2593 text.firstPos = 0;
2595 if (text.format == XawFmtWide) {
2598 text.ptr = XtMalloc((Cardinal)((2 + wcslen((wchar_t*)line_to_ip))
2600 ptr = (wchar_t*)text.ptr;
2604 length = (int)wcslen((wchar_t*)text.ptr);
2608 text.length = (int)wcslen((wchar_t*)text.ptr);
2614 text.ptr = XtMalloc((Cardinal)((size_t)(2 + length) * sizeof(char)));
2615 ptr = text.ptr;
2623 text.length = (int)strlen(text.ptr);
2627 if (_XawTextReplace(ctx,ctx->text.insertPos, ctx->text.insertPos, &text)) {
2629 XtFree(text.ptr);
2634 XtFree(text.ptr);
2635 ctx->text.from_left = -1;
2636 ctx->text.insertPos = SrcScan(ctx->text.source, ctx->text.old_insert,
2637 XawstPositions, XawsdRight, text.length, True);
2651 l = SrcScan(ctx->text.source, ctx->text.insertPos,
2653 r = SrcScan(ctx->text.source, l, XawstWhiteSpace, XawsdRight, 1, False);
2664 _XawTextSetSelection(ctx,zeroPosition,ctx->text.lastPos,params,*num_params);
2675 int old_y = ctx->text.ev_y;
2683 if (ctx->text.ev_y <= ctx->text.margin.top) {
2684 if (old_y >= ctx->text.ev_y)
2687 else if (ctx->text.ev_y >= XtHeight(ctx) - ctx->text.margin.bottom) {
2688 if (old_y <= ctx->text.ev_y
2689 && !IsPositionVisible(ctx, ctx->text.lastPos))
2694 ctx->text.from_left = -1;
2706 if (!ctx->text.selection_state) {
2707 ctx->text.selection_state = True;
2722 if (ctx->text.selection_state)
2734 if (ctx->text.selection_state) {
2735 ctx->text.selection_state = False;
2750 if (!ctx->text.selection_state) {
2751 ctx->text.selection_state = True;
2766 if (ctx->text.selection_state)
2778 if (ctx->text.selection_state) {
2779 ctx->text.selection_state = False;
2833 /* This is kind of a hack, but, only one text widget can have focus at
2835 * text widget, the scrollbars can not be addressed via editres, since they
2837 * The focus variable is required to make sure only one text window will
2859 Bool display_caret = ctx->text.display_caret;
2870 if (ctx->text.hasfocus)
2885 ctx->text.hasfocus = TRUE;
2919 Bool display_caret = ctx->text.display_caret;
2951 ctx->text.hasfocus = FALSE;
2963 && !ctx->text.hasfocus)
2974 && !ctx->text.hasfocus)
2981 * Arguments: ctx - The text widget.
2992 XawTextBlock text;
2996 for (line_num = 0; line_num < ctx->text.lt.lines ; line_num++)
2997 if (ctx->text.lt.info[line_num].position >= ctx->text.insertPos)
3002 XawTextSinkGetCursorBounds(ctx->text.sink, &cursor);
3005 x = ctx->text.r_margin.left;
3006 XawTextSinkFindPosition(ctx->text.sink, ctx->text.lt.info[line_num].position,
3010 if (ret_pos <= ctx->text.lt.info[line_num].position
3011 || ret_pos >= ctx->text.insertPos || ret_pos < 1)
3014 XawTextSourceRead(ctx->text.source, ret_pos - 1, &text, 1);
3017 wc_buf[0] = *(wchar_t *)text.ptr;
3022 text.format = XawFmtWide;
3023 text.ptr = (char *)wc_buf;
3028 if (text.ptr[0] != XawSP && text.ptr[0] != XawTAB)
3032 text.format = XawFmt8Bit;
3033 text.ptr = (char*)"\n";
3035 text.length = 1;
3036 text.firstPos = 0;
3038 if (_XawTextReplace(ctx, ret_pos - 1, ret_pos, &text))
3041 if (++ctx->text.insertPos > ctx->text.lastPos)
3042 ctx->text.insertPos = ctx->text.lastPos;
3053 XawTextBlock text;
3059 if (XtIsSubclass (ctx->text.source, (WidgetClass) multiSrcObjectClass))
3060 text.length = _XawImWcLookupString(w, &event->xkey, (wchar_t*)strbuf,
3063 text.length = _XawLookupString(w, (XKeyEvent*)event, strbuf,
3066 if (text.length == 0)
3070 ctx->text.mult = 1;
3074 text.format = (unsigned long)_XawTextFormat(ctx);
3075 if (text.format == XawFmtWide) {
3076 text.ptr = ptr = XawStackAlloc(sizeof(wchar_t) * (size_t)text.length
3079 memcpy((char*)ptr, (char *)strbuf, sizeof(wchar_t) * (size_t)text.length);
3080 ptr += sizeof(wchar_t) * (size_t)text.length;
3084 format = ctx->text.left_column < ctx->text.right_column;
3088 text.ptr = ptr = XawStackAlloc((unsigned)(text.length * mult), ptrbuf);
3090 strncpy(ptr, strbuf, (size_t)text.length);
3091 ptr += text.length;
3095 format = ctx->text.left_column < ctx->text.right_column;
3099 text.length = text.length * mult;
3100 text.firstPos = 0;
3105 _XawSourceSetUndoMerge((TextSrcObject)ctx->text.source, True);
3108 from = ctx->text.insertPos;
3110 if (ctx->text.overwrite) {
3114 tmp = SrcScan(ctx->text.source, from, XawstEOL, XawsdRight, 1, False);
3122 error = _XawTextReplace(ctx, from , to, &text);
3125 ctx->text.from_left = -1;
3126 ctx->text.insertPos = SrcScan(ctx->text.source, ctx->text.old_insert,
3128 text.length, True);
3129 if (ctx->text.auto_fill) {
3132 (void)FormatText(ctx, SrcScan(ctx->text.source,
3133 ctx->text.insertPos, XawstEOL,
3144 XawStackFree(text.ptr, ptrbuf);
3147 if (error == XawEditDone && text.format == XawFmt8Bit && text.length == 1
3148 && (text.ptr[0] == ')' || text.ptr[0] == ']' || text.ptr[0] == '}')
3149 && ctx->text.display_caret) {
3152 Widget source = ctx->text.source;
3153 XawTextPosition insertPos = ctx->text.insertPos, pos, tmp, last;
3154 char left, right = text.ptr[0];
3162 text.ptr[0] = left;
3163 pos = XawTextSourceSearch(source, last, XawsdLeft, &text);
3166 text.ptr[0] = right;
3169 tmp = XawTextSourceSearch(source, tmp, XawsdRight, &text);
3181 _XawSourceSetUndoMerge((TextSrcObject)ctx->text.source, True);
3183 ctx->text.insertPos = pos;
3203 _XawSourceSetUndoMerge((TextSrcObject)ctx->text.source, True);
3205 ctx->text.insertPos = insertPos;
3298 XawTextBlock text;
3301 text.firstPos = 0;
3302 text.format = (unsigned long)_XawTextFormat(ctx);
3306 text.ptr = IfHexConvertHexElseReturnParam((char*) *params, &text.length);
3308 if (text.length == 0)
3314 text.ptr = (char*)_XawTextMBToWC(XtDisplay(w), text.ptr,
3315 &text.length);
3317 if (text.ptr == NULL) { /* conversion error */
3329 temp_len = text.length; /* _XawTextWCToMB's 3rd arg is in_out */
3330 if (_XawTextWCToMB(XtDisplay(w), (wchar_t*)text.ptr, &temp_len)
3342 if (_XawTextReplace(ctx, ctx->text.insertPos,
3343 ctx->text.insertPos, &text)) {
3349 ctx->text.from_left = -1;
3351 ctx->text.insertPos = SrcScan(ctx->text.source, ctx->text.old_insert,
3352 XawstPositions, XawsdRight, text.length,
3386 if (ctx->text.display_caret == display_caret)
3390 ctx->text.display_caret = (Boolean)display_caret;
3400 if (ctx->text.numeric) {
3401 long mult = ctx->text.mult;
3418 ctx->text.numeric = False;
3419 ctx->text.mult = 1;
3423 ctx->text.mult = 32767;
3431 ctx->text.mult = (short)(ctx->text.mult * 10 + (params[0][0] - '0') *
3434 if (mult != ctx->text.mult || mult >= 32767) { /* checks for overflow */
3436 ctx->text.mult = 1;
3437 ctx->text.numeric = False;
3451 ctx->text.numeric = False;
3452 ctx->text.mult = 1;
3454 (void)_XawTextSrcToggleUndo((TextSrcObject)ctx->text.source);
3456 if (ctx->text.kill_ring_ptr) {
3457 --ctx->text.kill_ring_ptr->refcount;
3458 ctx->text.kill_ring_ptr = NULL;
3460 ctx->text.kill_ring = 0;
3471 * Many of the text widget actions will will perform n actions, where n is
3492 ctx->text.numeric = False;
3494 ctx->text.mult = 1;
3500 ctx->text.numeric = True;
3501 ctx->text.mult = 0;
3517 ctx->text.mult = (short)(ctx->text.mult * mult);
3531 Widget src = ctx->text.source;
3532 XawTextBlock text;
3537 text.firstPos = 0;
3538 text.format = (unsigned long)_XawTextFormat(ctx);
3539 if (text.format == XawFmt8Bit) {
3540 text.ptr= (char*)" ";
3547 text.ptr = (char*)wc_two_spaces;
3586 text.length = 1;
3588 if (text.format == XawFmtWide) {
3590 text.length++;
3594 text.length++; /* Put in two spaces. */
3600 if (text.format == XawFmtWide) {
3609 to -= (i - text.length - 1);
3612 if (_XawTextReplace(ctx, endPos, startPos, &text) != XawEditDone)
3621 pos[idx] += text.length;
3625 startPos -= i - text.length;
3640 XawTextBlock text;
3643 text.firstPos = 0;
3644 text.length = 1;
3645 text.format = (unsigned long)_XawTextFormat(ctx);
3647 if (text.format == XawFmt8Bit) {
3648 text.ptr = (char*)"\n";
3654 text.ptr = (char*)wide_CR;
3660 if (ctx->text.wrap != XawtextWrapNever) {
3663 XawTextSinkGetCursorBounds(ctx->text.sink, &cursor);
3674 XawTextSinkFindPosition(ctx->text.sink, startPos,
3675 (int)ctx->text.r_margin.left, wwidth,
3682 eol = SrcScan(ctx->text.source, eol, XawstPositions,
3684 space = SrcScan(ctx->text.source, eol, XawstWhiteSpace,
3694 if (text.format == XawFmtWide) {
3702 endPos = SrcScan(ctx->text.source, endPos,
3706 if (_XawTextReplace(ctx, startPos, endPos, &text))
3715 pos[idx] += text.length;
3719 startPos = SrcScan(ctx->text.source, startPos,
3736 Bool format = ctx->text.auto_fill
3737 && ctx->text.left_column < ctx->text.right_column;
3745 XawTextPosition len = ctx->text.lastPos;
3748 if (ctx->text.justify == XawjustifyLeft ||
3749 ctx->text.justify == XawjustifyFull) {
3751 to += ctx->text.lastPos - len;
3759 FormatText(ctx, from, ctx->text.justify != XawjustifyFull, pos, num_pos);
3769 ctx->text.from_left = -1;
3820 if (ctx->text.auto_fill && ctx->text.left_column < ctx->text.right_column) {
3821 if (ctx->text.s.left != ctx->text.s.right) {
3822 from = SrcScan(ctx->text.source,
3823 XawMin(ctx->text.s.left, ctx->text.s.right),
3825 to = SrcScan(ctx->text.source,
3826 XawMax(ctx->text.s.left, ctx->text.s.right),
3834 from = to = ctx->text.insertPos;
3840 from = SrcScan(ctx->text.source, from, XawstEOL, XawsdLeft,
3842 XawTextSourceRead(ctx->text.source, from, &block, 1);
3867 to = SrcScan(ctx->text.source, to, XawstEOL, XawsdRight,
3869 XawTextSourceRead(ctx->text.source, to + (to < ctx->text.lastPos),
3889 from = SrcScan(ctx->text.source, ctx->text.insertPos, XawstEOL,
3893 from = SrcScan(ctx->text.source, from, XawstParagraph,
3896 from = SrcScan(ctx->text.source, from, XawstEOL,
3898 to = SrcScan(ctx->text.source, from, XawstParagraph,
3924 TextSrcObject src = (TextSrcObject)ctx->text.source;
3934 pos[i] = ((TextWidget)src->textSrc.text[i])->text.old_insert;
3937 *pos = ctx->text.old_insert;
3950 endPos = ctx->text.lastPos;
3957 from = SrcScan(ctx->text.source, ctx->text.insertPos,
3959 to = SrcScan(ctx->text.source, from,
3979 rlen = (unsigned)(llen + (ctx->text.lastPos - endPos));
4004 TextWidget tw = (TextWidget)src->textSrc.text[i];
4006 tw->text.old_insert = tw->text.insertPos = pos[i];
4007 _XawTextBuildLineTable(tw, SrcScan((Widget)src, tw->text.lt.top, XawstEOL,
4009 tw->text.clear_to_eol = True;
4013 ctx->text.old_insert = ctx->text.insertPos = *pos;
4014 _XawTextBuildLineTable(ctx, SrcScan(ctx->text.source, ctx->text.lt.top,
4016 ctx->text.clear_to_eol = True;
4018 ctx->text.showposition = True;
4034 XawTextBlock text;
4039 ctx->text.mult = 1;
4047 start = SrcScan(ctx->text.source, ctx->text.insertPos, XawstPositions,
4049 end = SrcScan(ctx->text.source, ctx->text.insertPos, XawstPositions,
4054 if (start == ctx->text.insertPos || end == ctx->text.insertPos) {
4060 ctx->text.from_left = -1;
4061 ctx->text.insertPos = end;
4063 text.firstPos = 0;
4064 text.format = (unsigned long)_XawTextFormat(ctx);
4066 /* Retrieve text and swap the characters. */
4067 if (text.format == XawFmtWide) {
4072 text.length = (int)wcslen(wbuf);
4074 for (i = 1; i < text.length; i++)
4079 else { /* thus text.format == XawFmt8Bit */
4083 text.length = (int)strlen(buf);
4085 for (i = 1; i < text.length; i++)
4090 text.ptr = buf;
4092 /* Store new text in source. */
4094 if (_XawTextReplace (ctx, start, end, &text))
4111 _XawTextSrcToggleUndo((TextSrcObject)ctx->text.source);
4112 ctx->text.mult = (short)(mul = -mul);
4117 if (!_XawTextSrcUndo((TextSrcObject)ctx->text.source, &ctx->text.insertPos))
4119 ctx->text.showposition = True;
4122 _XawTextSrcToggleUndo((TextSrcObject)ctx->text.source);
4241 right = SrcScan(ctx->text.source, left = ctx->text.insertPos,
4244 left = SrcScan(ctx->text.source, right = ctx->text.insertPos,
4293 ctx->text.insertPos = right;
4404 /* action to bind translations for text dialogs */