gboolean idle_readline(gpointer d) {
// GtkBuilder *bld = GTK_BUILDER(d);
- static char buf[128];
- int len;
-
- if ( (len = read(0, &buf, 127)) > 0 ) {
- buf[len] = 0;
+ static size_t s = 128;
+ static char *buf = NULL;
+ static int len = 0; int l;
+ if (!buf) buf = malloc(s);
+
+ l = read(0, buf + len, s - len);
+ while ( l > 0 ) {
+ len += l;
+ if ( buf[len - 1] == '\n' && (len < 2 || buf[len - 2] != '\\') ) break;
+ else if (len >= 2) buf[--len - 1] = '\n';
+ if ( len == s - 1 ) buf = realloc(buf, s+=128);
+ l = read(0, buf + len, s - len);
+ }
+ if ( l > 0 ) {
+ buf[len - 1] = 0;
a_command(buf);
+ len = 0;
}
return 1;
}
<object class="GtkWindow" id="win1">
<property name="visible">True</property>
<property name="can-focus">False</property>
- <property name="modal">True</property>
<property name="window-position">mouse</property>
<property name="icon-name">applications-science</property>
- <property name="skip-taskbar-hint">True</property>
- <property name="skip-pager-hint">True</property>
<signal name="destroy" handler="app_quit" swapped="no"/>
<child>
<object class="GtkBox">