On 13.12.23 03:47, [email protected] wrote:
+ const int timeout = 150;
+ bool row_cols_swapped = false;
memset(&buf[0], 0, sizeof(buf));
+ /*
+ *https://github.com/tmux/tmux/issues/3457
+ *
+ * Tmux has a bug where the lines and cols are swapped. There is a lag
+ * in the time it takes to get the fix into code so see if tmux is
+ * running and which version and work around the bug.
+ *
+ * CSI > Ps q
+ * Ps = 0 => DCS > | text ST
+ */
+ fputs("\033[>0q", stdout);
+ fflush(stdout);
+ if (rtems_shell_term_wait_for(fd, "\033P>|", timeout)) {
+ int len = rtems_shell_term_buffer_until(fd, buf, sizeof(buf),
"\033\\", timeout);
+ if (len > 0) {
+ if (memcmp(buf, "tmux ", 5) == 0) {
+ static const char* bad_versions[] = {
+ "3.2", "3.2a", "3.3", "3.3a"
+ };
+ #define bad_versions_num (sizeof(bad_versions) /
sizeof(bad_versions[0]))
+ size_t i;
+ for (i = 0; i < bad_versions_num; ++i) {
+ if (strcmp(bad_versions[i], buf + 5) == 0) {
+ row_cols_swapped = true;
+ break;
+ }
+ }
+ }
+ }
+ }
I think the above new code block could be moved to a helper function
which returns the value of row_cols_swapped.
--
embedded brains GmbH & Co. KG
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: [email protected]
phone: +49-89-18 94 741 - 16
fax: +49-89-18 94 741 - 08
Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
_______________________________________________
devel mailing list
[email protected]
http://lists.rtems.org/mailman/listinfo/devel