mafintosh / mafintosh/ansi-diff
Add support for windows (No, not the operating system ;-) )
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 56
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
In terminals, a window is a sub-region of the screen, similar to boxes in [blessed](https://www.npmjs.com/package/blessed). I've review the code and it's focused on generating ANSI diffs to be directly printed in the screen, but seems everything is in place to add support for windows. To do so, seems the only missing parts are:
- [ ] `top` and `left` options in addition to `width` and `height`. By default they can be set to zero, but if set, all the newlines and clear screen moves should be set to their values instead of zero, so it's easy.
- [ ] add `right` and `bottom` options, or replace `width` and `height` with them, because if a windows have non-zero `top` and `left` values, then its `width` and `height` are not anymore the window `right` and `bottom` ones.
- [x] hard wrapping. At this moment, if a line is longer than screen `width`, it's left to the terminal itself to do the wrapping to the new line, but with non-zero `left` value, then it would print at the left side of the screen instead of the window. Hard wrapping would be done just by inserting `moveTo()` calls when the end of a window is reached.
- [ ] windows inception, allowing to have windows relatives to another parent windows :-) Although maybe this could be done in another module, but having a test for that would not hurt...
If you don't have the time to work on that, maybe I could be able to start a pull-request and start discussing it... :-)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the ANSI diff generation and existing width/height handling described in the issue, then trace where newlines, clear-screen moves, and moveTo() calls are emitted. Decide how top/left and right/bottom should interact, including nested windows, and add tests covering offsets, hard wrapping, and relative windows.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100