-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8ca7c70
commit 9445b91
Showing
16 changed files
with
199 additions
and
165 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,3 @@ | ||
# 0.1.3 | ||
|
||
* Enhanced version of `ipaint()` for interactively scrollable painted output. It no longer fills the terminal with junk. It's a nice terminal-only competitor to `View()` |
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,46 @@ | ||
OUTPUT_TO_BUFFER <- FALSE | ||
OUTPUT_BUFFER <- NULL | ||
|
||
output <- function(...) { | ||
if (!OUTPUT_TO_BUFFER) { | ||
cat(..., sep = "") | ||
} else { | ||
append_to_output_buffer(...) | ||
} | ||
} | ||
|
||
append_to_output_buffer <- function(...) { | ||
OUTPUT_BUFFER <<- | ||
c( | ||
OUTPUT_BUFFER, | ||
unlist(list(...)) | ||
) | ||
} | ||
|
||
reset_output_buffer <- function() { | ||
OUTPUT_BUFFER <<- NULL | ||
} | ||
|
||
get_output_buffer <- function() { | ||
OUTPUT_BUFFER | ||
} | ||
|
||
get_output_buffer_rows <- function() { | ||
newlines <- | ||
lapply( | ||
gregexpr("(?<!\\\\)\n", get_output_buffer(), perl = TRUE), | ||
function(match) { | ||
if (length(match) == 1 && match == -1) 0 else length(match) | ||
} | ||
) |> | ||
unlist() |> | ||
sum() | ||
|
||
newlines + 1 | ||
} | ||
|
||
paint_to_output_buffer <- function(...) { | ||
OUTPUT_TO_BUFFER <<- TRUE | ||
on.exit(OUTPUT_TO_BUFFER <<- FALSE) | ||
paint(...) | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Oops, something went wrong.