@@ -1150,3 +1150,43 @@ This change can be made incrementally as follows:
1150
1150
- update the command to use the new implementation
1151
1151
- Once all commands are updated, the XDocumentPuterShell class will
1152
1152
be dormant and can safely be removed.
1153
+
1154
+ ## 2024-09-04
1155
+
1156
+ ### Terminal I/O
1157
+
1158
+ Prior to recent changes it was not possible to run phoenix shell inside
1159
+ another instance of phoenix shell. The following had to be resolved for
1160
+ this to work:
1161
+ - Phoenix was waiting for a configuration object from the parent app,
1162
+ under the assumption that this parent app is a terminal. Phoenix now
1163
+ does not require this configuration object.
1164
+ - Initial terminal size had to be requested for by Phoenix after some
1165
+ initialization to avoid a race condition.
1166
+ - Apps called by an application under a terminal were not able to control
1167
+ ` echo ` behavior.
1168
+
1169
+ The new IO functionality follows the
1170
+ [ Selective Layer Implementation Pattern] ( https://puter.com/@ed/documentation/glossary.md##Selective-Layer-Implementation-Pattern )
1171
+ with the following implemented:
1172
+ - IOCTL: ` TIOCGWINSZ ` , sent via postMessage
1173
+ - signal: ` ioctl.set ` event to simulate "SIGWINCH",
1174
+ but this should be merged with existing code that
1175
+ implements the concept of signals.
1176
+ - ptt.termios: a high-level mimic of termios
1177
+ (currently only echo control is implemented)
1178
+
1179
+ XDocumentPTT now implements ` TIOCGWINSZ ` (named after the POSIX equivalent)
1180
+ which requests the window size. This function calls ` postMessage ` on the
1181
+ AppConnection with the following
1182
+ [ type-tagged object] ( ../../../doc/api/type-tagged.md ) :
1183
+ ` { $: 'ioctl.request', requestCode: 104 } ` .
1184
+
1185
+ The window size information is still provided
1186
+ by the badly-named ` ioctl.set ` event, which should later be changed to
1187
+ a similar convention, like ` { $: 'signal', code: 28 } ` .
1188
+
1189
+ The termios implementation is a high-level mimic and does not actually
1190
+ use the underlying IOCTL implementation. Instead it sends a type-tagged
1191
+ object that looks like ` { $: 'chtermios', termios: { echo: false } } ` ,
1192
+ where ` echo ` can be ` true ` or ` false ` .
0 commit comments