Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 12801 - AsciiText widget moves insertion point inappropriately after text replacement while redisplay is disabled
AsciiText widget moves insertion point inappropriately after text replacement...
Product: Red Hat Raw Hide
Classification: Retired
Component: XFree86 (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Mike A. Harris
: 121805 (view as bug list)
Depends On:
  Show dependency treegraph
Reported: 2000-06-22 00:02 EDT by Jonathan Kamens
Modified: 2008-05-01 11:37 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2002-05-03 22:20:28 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Jonathan Kamens 2000-06-22 00:02:14 EDT
See the comment in the test program below (which you should compile on a
machine with XFree86 4.0 installed with "-L/usr/X11R6/lib -lXaw"); it
explains the bug.

I want to emphasize yet again that XFree86 4.0 is not ready for prime time
and really shouldn't be the default XFree86 version in the next RedHat

I have also submitted a bug report about this to the XFree86 development

  This program illustrates a bug in the Text widget (or perhaps the
  AsciiText widget) in XFree86 4.0.  When you click on the "command1"
  button, two different character replacements are done in the
  displayed text wiget before the insertion point, and redisplay is
  disabled while both replacements are done.  Note that the insertion
  point moves when redisplay is reenabled; it shouldn't (this is the
  bug).  When you click on the "command2" button, redisplay is enabled
  after the first replacement and then disabled again; in this case,
  the insertion point is not incorrectly changed by the two
#include <X11/Intrinsic.h>
#include <X11/Shell.h>
#include <X11/StringDefs.h>
#include <X11/Xaw/AsciiText.h>
#include <X11/Xaw/Box.h>
#include <X11/Xaw/Command.h>
#include <stdio.h>

Widget text;

void callback(Widget widget, XtPointer closure, XtPointer call_data)
  XawTextBlock block;
  int position;
  int mode = (int) closure;

  block.firstPos = 0;
  block.length = 1;
  block.ptr = "F";
  block.format = XawFmt8Bit;

  printf("Setting insertion point\n");
  XtVaSetValues(text, XtNinsertPosition, 8, NULL);

  printf("Disabling redisplay\n");
  XtVaGetValues(text, XtNinsertPosition, &position, NULL);
  printf("position is %d\n", position);
  printf("Replacing character 0\n");
  XawTextReplace(text, 0, 1, &block);
  XtVaGetValues(text, XtNinsertPosition, &position, NULL);
  printf("position is %d\n", position);
  if (mode == 1) {
    printf("Enabling redisplay\n");
    printf("Disabling redisplay\n");
  printf("Replacing character 4\n");
  XawTextReplace(text, 4, 5, &block);
  XtVaGetValues(text, XtNinsertPosition, &position, NULL);
  printf("position is %d\n", position);
  printf("Enabling redisplay\n");


int main(int argc, char *argv[])
  Widget shell, box, command1, command2;
  XtAppContext context;
  XtCallbackRec callback_list[2] = {{0}};

  shell = XtOpenApplication(&context, "Test", NULL, 0, &argc, argv, NULL,
			    sessionShellWidgetClass, NULL, 0);

  box = XtVaCreateManagedWidget("box", boxWidgetClass, shell, NULL);

  text = XtVaCreateManagedWidget("text", asciiTextWidgetClass, box,
				 XtNeditType, XawtextEdit,
				 XtNstring, "foo\nbar\nbaz\nfrelt\n",
				 XtNinsertPosition, 8,
				 XtNheight, 100,

  callback_list[0].callback = callback;

  command1 = XtVaCreateManagedWidget("command1", commandWidgetClass, box,
				     XtNcallback, callback_list,

  callback_list[0].closure = (XtPointer) 1;

  command2 = XtVaCreateManagedWidget("command2", commandWidgetClass, box,
				     XtNcallback, callback_list,



Comment 1 Preston Brown 2000-09-11 14:13:36 EDT
verified problem still exists in xfree86 4.0.1.
Comment 2 Mike A. Harris 2001-03-27 03:13:49 EST
Unfortunately, the XFree86 team has pretty much deprecated Xaw, and other
older X stuff like Xt.  While they accept patches to fix bugs, they do not
actively support the legacy code.  At least that is my understanding from
talking with Keith Packard nd David Dawes at LWE.  Since this stuff is
quite ancient, I won't realistically be able to try to bughunt this one
until I've covered all higher priority bugs.  Since I know you're actively
working on xaw though I'm undefering this bug.  If you can submit me a
patch like you've been doing with all the other xaw related stuff, I'd be
more than glad to add it to X and run it upstream to ensure the fix gets in
the core codebase.

Thanks in advance.
Comment 3 Mike A. Harris 2001-04-09 02:10:17 EDT
Update.. Xaw is not unsupported...  Xt is "discouraged" and considered
obsolete.  At any rate it would be nice to fix any bugs in them nonetheless.
Comment 4 Mike A. Harris 2001-05-04 02:57:26 EDT
Please try XFree86-4.0.3-12 from:  ftp://people.redhat.com/mharris/xfree86
I believe this problem is solved now.

Do you see it working now?
Comment 5 Jonathan Kamens 2001-05-06 16:01:54 EDT
It does not appear to me to be resolved.  Here's what I have installed right


When I compile and run my test program, it behaves as described in the bug
report, i.e., incorrectly.
Comment 6 Mike A. Harris 2001-05-25 11:26:09 EDT
Verified in 4.0.3 as still a bug.  Sending upstream.
Comment 7 Mike A. Harris 2002-05-03 22:20:24 EDT
I don't know if this is fixed in current XFree86 or not (haven't tested),
but perhaps you could comment.  I've sent your various xaw patches
to XFree86.org several times now, and they do not apply them.  No response
back as to why or anything.  I've just re-sent all patches you've sent
us once again, and am hoping that they apply them this time, or provide
acknowledgement of receipt and explain why they're refused, even if that
explanation is simply "low priority".

Just as a suggestion for future bug reporting that might help keep us all
in code sync, and hopefully resulting in the stock XFree86 releases containing
all bugfixes from the wild...  when reporting a bug, particularly if it
has an attached fix, could you also report the bug to xfree86@xfree86.org,
and send patches to fixes@xfree86.org.  (Or just CC both).

I'm going to close this as RAWHIDE for now, hoping it is fixed.  If it
is still broken, feel free to reopen, and please notify the XFree86 team
as well.

I wish they had a bugzilla database too.  ;o(
Comment 8 Jonathan Kamens 2002-05-13 00:28:39 EDT
Wonder of wonders, this appears to be fixed in XFree86 4.2.0.

I have, indeed, sent most of my fixes to the XFree86 folks directly, in addition
to reporting them to you.  Presumably, they're ignoring my stuff because no one
is really maintaining Xaw.  Sigh.
Comment 9 Duncan Laurie 2004-04-27 19:35:35 EDT
*** Bug 121805 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.