[comp.windows.x] Help with AsciiStringWidget

per@erix.ericsson.se (Per Hedeland) (07/10/89)

Despite the "disappointing" answers to recent queries about the Athena Text
Widget, I thought I'd give it a try too...:-) I'm using an asciiStringWidget as
interface to an (arbitrary) program running e.g. at the other end of a pipe,
and wish to achieve an "emacs shell-mode" style of interaction. (Basically,
allow any editing in the "buffer"; when Return is hit at end of "buffer", send
everything after last output positon as input to the program / when Return is
hit somewhere else, send current line as input.)

The basic solution would be to let the widget take care of the editing, but
change the binding for <Key>Return to an action (supplied by my application)
that sends input to the program. So far so good, but since the user may have
done any amount of editing to the buffer, it seems impossible to know which
part of it he wants to send as input (consider e.g. a trivial case: kill a
piece of previous output, unkill it at end of buffer, hit Return).

There are probably several solutions to this, but I haven't managed to come up
with one that doesn't either severly restrict the functionality of the
interface, or duplicate a lot of the work that the Text Widget already does (or
can do). If there was a possibility to "mark" a position in the buffer, and
have the widget maintain the mark (i.e. decrement/increment on deletions/
insertions before the mark), I think my problem would be essentially solved.

Any and all suggestions would be appreciated. N.b. the "emacs shell-mode" style
isn't a requirement (although obviously the default bindings are well suited
for this), however similar functionality is desired, and "commonly known" is
a plus...

--Per Hedeland
per@erix.ericsson.se  or
per%erix.ericsson.se@uunet.uu.net  or
...!uunet!erix.ericsson.se!per

mhardik@intel.com (Manoj Hardikar ~) (09/14/89)

My application prompts the user for some input using an asciiStringWidget.
I do not want to restrict the size of the string and therefore need to
reallocate the string when the string is full (or about to get full).

Can someone show me the best way to achieve such a thing?

Thanks.


Manoj Hardikar
Intel Corporation