From b69768f6e814c293ffd8cf0793f996c826c1450e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Mon, 31 Oct 2022 08:55:18 +0100 Subject: [PATCH] Initial implementation of the terminal resize support * It may or may not be overkill, but it's a starting point. --- gprompt.pl | 43 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/gprompt.pl b/gprompt.pl index 1379a8c..b664e76 100644 --- a/gprompt.pl +++ b/gprompt.pl @@ -390,7 +390,6 @@ sub term_feed sub get_cursor_pos { - local $| = 1; my $term = term_open; my $oTerm = term_set_raw($term); @@ -899,12 +898,21 @@ _gprompt_clear() { echo -ne "\${PS1\@P}\\r" _gprompt_set_return "\${_GPROMPT_PREV_STATUS:-0}" } +_gprompt_inject() { + perl -e 'ioctl(STDIN, 0x5412, pack("C", \$ARGV[0]))' \$1 >/tmp/debugthefuck"); + print $f "linePos $linePos ill $ill nec $nExtraChars nLines $nLines iLine $iLine toLine $toLine iCol $iCol\n"; + close($f); + } + } } main;