-
Notifications
You must be signed in to change notification settings - Fork 329
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
sixel preview #1210
Closed
Closed
sixel preview #1210
Conversation
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
* new struct type sixel * add sixel detection logic in printReg * new ShowSixels that prints sixels to the screen * placeholder function UnshowSixels * run `ui.ShowSixels` after `ui.screen.Sync` * fix sixel placed on wrong coordinates * change sixel termination sequence to prevent other escape sequence being run inside it * process multi-line sixel sequence * fixed bug where string before sixel image is not printed * add sixelDimPx and pxToCells * add getTermPixels for unix * remove unused method UnshowSixels * fix: remove unneeded ShowSixels * add new fields sixel.wPx,hPx and reg.sixels * modify sixel processing logic detecting sixels in preview script now fills corresponding area with braille blank `\u2800` and saves sixel to reg.sixels * modify sixel processing logic printReg doesn't process sixels directly anymore * reset sixels buffer at the start of `draw` * rename `ui.ShowSixels` to `showSixels` * add constants `gSixelBegin` and `gSixelTerminate` * add check to prevent arbitrary escape code being passed to stdin * fix cursor out of place in command line mode * fix bug where sixel in drawn at old location after horizontal resize * add ui.wPx and ui.hPx * buffer sixel sequences before printing * add check for valid terminal size(px) before previewing sixel * clean up * placeholder function getTermPixels for windows * function sixelDimPx now considers image size given in the optional raster attributes field * change sixel image alignment to emulate behavior of a terminal - images used to always draw on a new line - images is now placed where it starts: ``` printf 'abc <sixel sequence> xyz' ``` would result in: ``` abc +------+ | img | | here | +------+ xyz ``` old behavior: ``` abc +------+ | img | | here | +------+ xyz ``` * fix bug where raster attributes are wrongly parsed in sixelDimPx * prevent drawing sixels while menu is active * introduce sixelScreen struct and refactor screen width,height in px to use new struct * fix prevent nested sixel sequences * fix bug where rejected sixels cause indexing error * add "alternating filler" to trick tcell into redrawing when switching between different images * fix filler string wrongly indented * add comment * replace pxToCells() with sixelScreen.pxToCells() * add trim sixel height during preview * add tests for trimSixelHeight * prevent sixel redrawing during input prompts * change sixel filler to braille space * clean up * use strings.Index instead of regex for simple search
oops wrong branch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
follow up to: #840
still in the middle of refactoring. Some things have changed in this PR since the last one: