-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make
tb_print*
functions a little kinder
* handle newlines. previously they would mess up rendering. * replace other non-printable codepoints with U+FFFD. * skip over cells that would go out of bounds instead of erroring.
- Loading branch information
Showing
3 changed files
with
102 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#5[0m line1[0m | ||
#5[0m line2[0m | ||
#5[0m line3[0m | ||
#5[0mescape=[�][0m | ||
#5[0mtab=[�][0m | ||
#5[0moob_rv1=-9[0m | ||
#5[0moob_rv2=-9[0m | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
#5[0m 01234[0m | ||
#5[0m 01234[0m | ||
#5[0m 01234[0m | ||
#5[0m 01234[0m | ||
#5[0m 01234[0m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
$test->ffi->tb_init(); | ||
|
||
$w = $test->ffi->tb_width(); | ||
$h = $test->ffi->tb_height(); | ||
|
||
$y = 0; | ||
$test->ffi->tb_print(1, $y++, 0, 0, "line1\nline2\nline3"); | ||
$y += 2; | ||
|
||
$test->ffi->tb_print(0, $y++, 0, 0, "escape=[\x1b]"); | ||
$test->ffi->tb_print(0, $y++, 0, 0, "tab=[\t]"); | ||
|
||
$oob_rv1 = $test->ffi->tb_print($w, $h, 0, 0, "oob1"); | ||
$oob_rv2 = $test->ffi->tb_print(-1, -1, 0, 0, "oob2"); | ||
$test->ffi->tb_printf(0, $y++, 0, 0, "oob_rv1=%d", $oob_rv1); | ||
$test->ffi->tb_printf(0, $y++, 0, 0, "oob_rv2=%d", $oob_rv2); | ||
|
||
$test->ffi->tb_print($w - 5, $h - 5, 0, 0, str_repeat("0123456789\n", 10)); | ||
|
||
$test->ffi->tb_present(); | ||
|
||
$test->screencap(); |