/[antiright]/antiright/src/arshell/textedit.c
ViewVC logotype

Diff of /antiright/src/arshell/textedit.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.13 by jefbed, Mon Aug 23 01:15:56 2004 UTC revision 1.14 by jefbed, Sun Aug 29 22:52:58 2004 UTC
# Line 124  arshell_text_return_cb(Widget parent_wid Line 124  arshell_text_return_cb(Widget parent_wid
124    call_data=(XtPointer)NULL;    call_data=(XtPointer)NULL;
125    exit(0);    exit(0);
126  }  }
127  int  unsigned int
128  arshell_line(XmTextPosition end_position)  arshell_line(XmTextPosition end_position)
129  {  {
130    int lines=1;    int lines=1;
# Line 140  arshell_line(XmTextPosition end_position Line 140  arshell_line(XmTextPosition end_position
140    return(lines);    return(lines);
141  }  }
142  void  void
143    arshell_position(XmTextPosition current_position, unsigned int *total_lines
144                     unsigned int *current_line, unsigned int *current_column)
145    {
146      char *text=XmTextGetString(arshell.gui.widgets.work);
147      XmTextPosition position=0;
148      (*total_lines)=1;
149      while(position < end_position)
150        {
151          if(text[position]=='\n')
152            {
153              (*total_lines)++;
154              (*current_column)=0;
155            }
156          (*current_column)++;
157          if(position==current_position)
158            (*current_line)=(*total_lines);
159          position++;
160        }
161      XtFree(text);
162      return(lines);
163    }
164    void
165  arshell_goto_line(unsigned int line)  arshell_goto_line(unsigned int line)
166  {  {
167    /* Declare a counter for the number of lines counted.  */    /* Declare a counter for the number of lines counted.  */
# Line 179  void Line 201  void
201  arshell_status()  arshell_status()
202  {  {
203    char *status;    char *status;
204    asprintf(&status, "Lines:%d  Current:%d",    unsigned int lines_uint, current_uint;
205             arshell_text_lines(), arshell_current_line());    float percent;
206      lines_uint=arshell_text_lines();
207      current_uint=arshell_current_line();
208      percent=current_uint/lines_uint;
209      asprintf(&status, "Lines:%d, Current:%d, Percent:%f",
210               lines_uint, current_uint, percent*100);
211    antiright_status(status);    antiright_status(status);
212    free(status);    free(status);
213  }  }
# Line 203  void Line 230  void
230  arshell_verified_status(XmTextVerifyCallbackStruct *call_pointer)  arshell_verified_status(XmTextVerifyCallbackStruct *call_pointer)
231  {  {
232    char *status;    char *status;
233    asprintf(&status, "Lines:%d  Current:%d",    XmTextPosition last=XmTextGetLastPosition(arshell.gui.widgets.work);
234             arshell_text_lines(), arshell_line(call_pointer->newInsert));    XmTextPosition current=call_pointer->newInsert;
235      unsigned int lines_uint=arshell_text_lines();
236      unsigned int current_uint=arshell_line(current);
237      float percent=(float)current/(float)last;
238      asprintf(&status, "Lines:%d, Current:%d, Percent:%f",
239               lines_uint, current_uint, percent*100);
240    antiright_status(status);    antiright_status(status);
241    free(status);    free(status);
242  }  }

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26