/[antiright]/antiright/lib/edit.c
ViewVC logotype

Diff of /antiright/lib/edit.c

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

revision 1.1 by jefbed, Thu Jul 8 18:58:03 2004 UTC revision 1.2 by jefbed, Wed Aug 25 23:50:18 2004 UTC
# Line 68  antiright_paste_cb(Widget parent, Line 68  antiright_paste_cb(Widget parent,
68    parent=NULL;    parent=NULL;
69    call_data=(XtPointer)NULL;    call_data=(XtPointer)NULL;
70  }  }
71    
72    void
73    antiright_comment_selection(Widget widget,
74                                XtPointer client_data, XtPointer call_data)
75    {
76      XmTextPosition left, right;
77      XmTextGetSelectionPosition((Widget)client_data, &left, &right);
78      XmTextInsert((Widget)client_data, left, "/* ");
79      XmTextInsert((Widget)client_data, right+3, "  */");
80    }
81    void
82    antiright_uncomment_selection(Widget widget,
83                                  XtPointer client_data, XtPointer call_data)
84    {
85      char *selection;
86      XmTextPosition left, right;
87      unsigned int counter=0;
88      unsigned int length;
89      XmTextGetSelectionPosition((Widget)client_data, &left, &right);
90      selection=XmTextGetSelection((Widget)client_data);
91      for(length=right-left; counter < length; counter++)
92        {
93          if(selection[counter]=='/')
94            {
95              if((counter+1)<length)
96                {
97                  if(selection[counter+1]=='*')
98                    {
99                      selection[counter]=' ';
100                      selection[counter+1]=' ';
101                    }
102                }
103            }
104          else if(selection[counter]=='*')
105            {
106              if((counter+1)<length)
107                {
108                  if(selection[counter+1]=='/')
109                    {
110                      selection[counter]=' ';
111                      selection[counter+1]=' ';
112                    }
113                }
114            }
115        }
116      XmTextReplace((Widget)client_data, left, right, selection);
117      XtFree(selection);
118    }
119    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

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