Commit 76bef7b7 authored by claes's avatar claes

Bugfix, command input larger than maxsize caused segfault

parent a99e8ed9
......@@ -208,6 +208,8 @@ int mrm_TextInput( Widget w, XEvent *event, char *recall, int line_size,
case XK_Right:
XmTextClearSelection( w, CurrentTime);
pos = XmTextGetCursorPosition( w);
if ( pos >= line_size - 1)
break;
pos++;
if ( pos > strlen(text))
break;
......@@ -241,6 +243,7 @@ int mrm_TextInput( Widget w, XEvent *event, char *recall, int line_size,
return 0;
if ( keysym > 256)
return 0;
if ( XmTextGetSelectionPosition( w, &left, &right)) {
for ( s = text + left, t = text + right; *t; s++,t++)
*s = *t;
......@@ -248,6 +251,8 @@ int mrm_TextInput( Widget w, XEvent *event, char *recall, int line_size,
XmTextSetCursorPosition( w, left);
}
pos = XmTextGetCursorPosition( w);
if ( pos >= line_size - 1)
break;
if ( pos == 0)
strcpy( newtext, "");
else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment