[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MiNT] Highwire coding question



Can someone help me with this because I am going around
in circles.

I am trying to add Ctrl-Left and Ctrl-Right to the text area
editing in Highwire forms. Sounds simple but the data structure
and C pointers are defeating me.

Here are some code snippets:

  else if (ctrl)  /* control left */
  {
    WORD     start, end, length;
    WORD *   position;
    CHAR *   strChunk;
    /* move cursor one word to the left */
    start = edit_rowln (input, form->TextCursrY);
    end   = edit_rowln (input, form->TextCursrY) + form->TextCursrX;

'input' holds the text we are editing

#define        __edit_len(inp,a,b)   ((inp)->TextArray[b]-(inp)->TextArray[a]-1)
#define        edit_rowln(inp,row)   __edit_len (inp, row, row +1)

'start' and 'end' give the positions of the start of the line and the
current cursor position in that line.

I want to search this portion of the text to find a non-alpha numeric
character, I was going to use something like this:

where strChunk is just the relevant portion of the 'input' string

   /* Find the next space to the left of the cursor */
   while (start < end
          && isalnum(strChunk[end]))
   {
      end--;
      scrl--;
   }

I would like to either search 'input' directly or copy a chunk of
'input' into strChunk and search that.

Any suggestions ?

Regards,

Peter