-
Notifications
You must be signed in to change notification settings - Fork 5
Implement terminal_pager for log subcommand #46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
97cf63b
Implement terminal_pager for log subcommand
ianthomas23 e083e48
Include cstdint
ianthomas23 44c04be
Use stringbuf instead of ostringstream
ianthomas23 f7e4643
Remove m_grabbed
ianthomas23 0edd017
Pass by value to process_input
ianthomas23 afd276a
Separate namespace for ANSI code sequences to avoid magic strings
ianthomas23 b77eb87
alternative_buffer scope object
ianthomas23 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Separate namespace for ANSI code sequences to avoid magic strings
- Loading branch information
commit afd276a2ed07453069bec1c1d6329c3631a096b7
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 @@ | ||
| #include "ansi_code.hpp" | ||
|
|
||
| namespace ansi_code | ||
| { | ||
| std::string cursor_to_row(size_t row) | ||
| { | ||
| return "\e[" + std::to_string(row) + "H"; | ||
| } | ||
|
|
||
| bool is_down_arrow(std::string str) | ||
| { | ||
| return str == "\e[B" || str == "\e[1B]"; | ||
| } | ||
|
|
||
| bool is_escape_char(char ch) | ||
| { | ||
| return ch == '\e'; | ||
| } | ||
|
|
||
| bool is_up_arrow(std::string str) | ||
| { | ||
| return str == "\e[A" || str == "\e[1A]"; | ||
| } | ||
| } |
This file contains hidden or 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,29 @@ | ||
| #pragma once | ||
|
|
||
| #include <string> | ||
|
|
||
| /** | ||
| * ANSI escape codes. | ||
| * Use `termcolor` for colours. | ||
| */ | ||
| namespace ansi_code | ||
| { | ||
| // Constants. | ||
| const std::string bel = "\a"; // ASCII 7, used for audio/visual feedback. | ||
| const std::string cursor_to_top = "\e[H"; | ||
| const std::string erase_screen = "\e[2J"; | ||
|
|
||
| const std::string enable_alternative_buffer = "\e[?1049h"; | ||
| const std::string disable_alternative_buffer = "\e[?1049l"; | ||
|
|
||
| const std::string hide_cursor = "\e[?25l"; | ||
| const std::string show_cursor = "\e[?25h"; | ||
|
|
||
| // Functions. | ||
| std::string cursor_to_row(size_t row); | ||
|
|
||
| bool is_escape_char(char ch); | ||
|
|
||
| bool is_down_arrow(std::string str); | ||
| bool is_up_arrow(std::string str); | ||
| } |
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.