From 8be80558c7bb52632c08d58af89823faff9789fe Mon Sep 17 00:00:00 2001 From: Patrick Fong Date: Thu, 28 Sep 2023 10:27:15 -0700 Subject: [PATCH 01/10] lint all Md files --- README.md | 56 ++++++++++++++++++------------------- README_TESTERS.md | 20 ++++++------- TODO.md | 18 ++++++------ docs/sequences.md | 65 +++++++++++++++++++++---------------------- docs/sequences/bel.md | 20 ++++++------- docs/sequences/bs.md | 12 ++++---- docs/sequences/can.md | 8 +++--- docs/sequences/cr.md | 10 +++---- docs/sequences/enq.md | 12 ++++---- docs/sequences/ff.md | 6 ++-- docs/sequences/hts.md | 4 +-- docs/sequences/ind.md | 12 ++++---- docs/sequences/lf.md | 8 +++--- docs/sequences/nel.md | 4 +-- docs/sequences/ri.md | 12 ++++---- docs/sequences/tab.md | 10 +++---- docs/sequences/vt.md | 6 ++-- test/README.md | 1 - 18 files changed, 141 insertions(+), 143 deletions(-) diff --git a/README.md b/README.md index e5eb79827..cabdafe19 100644 --- a/README.md +++ b/README.md @@ -44,11 +44,11 @@ things, but I've been using it full time since April 2022. ## Download -| Platform / Package | Links | Notes | -| ----------| ----- | ----- | -| macOS | [Tip ("Nightly")](https://github.com/mitchellh/ghostty/releases/tag/tip) | MacOS 12+ Universal Binary | -| Linux | [Build from Source](#developing-ghostty) | | -| Windows | n/a | Not supported yet | +| Platform / Package | Links | Notes | +| ------------------ | ------------------------------------------------------------------------ | -------------------------- | +| macOS | [Tip ("Nightly")](https://github.com/mitchellh/ghostty/releases/tag/tip) | MacOS 12+ Universal Binary | +| Linux | [Build from Source](#developing-ghostty) | | +| Windows | n/a | Not supported yet | ### Configuration @@ -134,12 +134,12 @@ to support many of the features that The currently support shell integration features in Ghostty: - * We do not confirm close for windows where the cursor is at a prompt. - * New terminals start in the working directory of the previously focused terminal. - * Complex prompts resize correctly by allowing the shell to redraw the prompt line. - * The cursor at the prompt is turned into a bar. - * The `jump_to_prompt` keybinding can be used to scroll the terminal window - forward and back through prompts. +- We do not confirm close for windows where the cursor is at a prompt. +- New terminals start in the working directory of the previously focused terminal. +- Complex prompts resize correctly by allowing the shell to redraw the prompt line. +- The cursor at the prompt is turned into a bar. +- The `jump_to_prompt` keybinding can be used to scroll the terminal window + forward and back through prompts. #### Shell Integration Installation and Verification @@ -208,15 +208,15 @@ goes for any other shell. The high-level ambitious plan for the project, in order: -| # | Step | Status | -|:---:|------|:------:| -| 1 | [Standards-compliant terminal emulation](docs/sequences.md) | ⚠️ | -| 2 | Competitive performance | ✅ | -| 3 | Basic customizability -- fonts, bg colors, etc. | ✅ | -| 4 | Richer windowing features -- multi-window, tabbing, panes | ✅ | -| 5 | Native Platform Experiences (i.e. Mac Preference Panel) | ⚠️ | -| 6 | Windows Terminals (including PowerShell, Cmd, WSL) | ❌ | -| N | Fancy features (to be expanded upon later) | ❌ | +| # | Step | Status | +| :-: | ----------------------------------------------------------- | :----: | +| 1 | [Standards-compliant terminal emulation](docs/sequences.md) | ⚠️ | +| 2 | Competitive performance | ✅ | +| 3 | Basic customizability -- fonts, bg colors, etc. | ✅ | +| 4 | Richer windowing features -- multi-window, tabbing, panes | ✅ | +| 5 | Native Platform Experiences (i.e. Mac Preference Panel) | ⚠️ | +| 6 | Windows Terminals (including PowerShell, Cmd, WSL) | ❌ | +| N | Fancy features (to be expanded upon later) | ❌ | Additional details for each step in the big roadmap below: @@ -261,10 +261,10 @@ Ghostty is a cross-platform terminal emulator but we don't aim for a least-common-denominator experience. There is a large, shared core written in Zig but we do a lot of platform-native things: -* The macOS app is a true SwiftUI-based application with all the things you +- The macOS app is a true SwiftUI-based application with all the things you would expect such as real windowing, menu bars, a settings GUI, etc. -* macOS uses a true Metal renderer with CoreText for font discovery. -* The Linux app is built with GTK. +- macOS uses a true Metal renderer with CoreText for font discovery. +- The Linux app is built with GTK. There are more improvements to be made. The macOS settings window is still a work-in-progress. Similar improvements will follow with Linux. @@ -310,11 +310,11 @@ tasks. Other useful commands: - * `zig build test` for running unit tests. - * `zig build run -Dconformance=` runs a conformance test case from - the `conformance` directory. The `name` is the name of the file. This runs - in the current running terminal emulator so if you want to check the - behavior of this project, you must run this command in ghostty. +- `zig build test` for running unit tests. +- `zig build run -Dconformance=` runs a conformance test case from + the `conformance` directory. The `name` is the name of the file. This runs + in the current running terminal emulator so if you want to check the + behavior of this project, you must run this command in ghostty. ### Compiling a Release Build diff --git a/README_TESTERS.md b/README_TESTERS.md index 12ceb062a..a69302050 100644 --- a/README_TESTERS.md +++ b/README_TESTERS.md @@ -42,28 +42,28 @@ or even pair (time permitting) if you're interested. This is the priority of bugs: - 1. Crashes. 💥 These are just unacceptable and I'll drop everything to - fix a crash. +1. Crashes. 💥 These are just unacceptable and I'll drop everything to + fix a crash. - 2. Escape sequence logic or rendering issues. These are almost as bad as - crashes because they usually make your workflow unusable. This includes - unsupported escape sequences that impact your workflow. +2. Escape sequence logic or rendering issues. These are almost as bad as + crashes because they usually make your workflow unusable. This includes + unsupported escape sequences that impact your workflow. - 3. Anything else... +3. Anything else... ## Let's Talk! You likely landed in the Discord community first, if for some reason you're not -in there, join [here](https://discord.gg/ghostty). Discord is a great place to +in there, join [here](https://discord.gg/ghostty). Discord is a great place to share feedback, discuss issues, ask questions and talk to other testers. ## Other FAQ ### Can I Invite a Friend? -To the Discord, go for it! [discord.gg/ghostty](https://discord.gg/ghostty). -Initially, they'll land in a public Discord channel. As mentioned, testers -are being added slowly as bugs are fixed. Discord is being used as a sort-of +To the Discord, go for it! [discord.gg/ghostty](https://discord.gg/ghostty). +Initially, they'll land in a public Discord channel. As mentioned, testers +are being added slowly as bugs are fixed. Discord is being used as a sort-of waitlist, and people are added to the project as testers from there, so just send them the link and they will be added at some point. diff --git a/TODO.md b/TODO.md index a2d756f8e..893233dea 100644 --- a/TODO.md +++ b/TODO.md @@ -1,15 +1,15 @@ Performance: -* for scrollback, investigate using segmented list for sufficiently large +- for scrollback, investigate using segmented list for sufficiently large scrollback scenarios. -* Loading fonts on startups should probably happen in multiple threads -* `deleteLines` is very, very slow which makes scroll region benchmarks terrible +- Loading fonts on startups should probably happen in multiple threads +- `deleteLines` is very, very slow which makes scroll region benchmarks terrible Correctness: -* test wrap against wraptest: https://github.com/mattiase/wraptest +- test wrap against wraptest: https://github.com/mattiase/wraptest - automate this in some way -* Charsets: UTF-8 vs. ASCII mode +- Charsets: UTF-8 vs. ASCII mode - we only support UTF-8 input right now - need fallback glyphs if they're not supported - can effect a crash using `vttest` menu `3 10` since it tries to parse @@ -17,13 +17,13 @@ Correctness: Improvements: -* scrollback: configurable +- scrollback: configurable Mac: -* Preferences window +- Preferences window Major Features: -* Bell -* Sixels: https://saitoha.github.io/libsixel/ +- Bell +- Sixels: https://saitoha.github.io/libsixel/ diff --git a/docs/sequences.md b/docs/sequences.md index ea7c162eb..8cdf91ac5 100644 --- a/docs/sequences.md +++ b/docs/sequences.md @@ -1,9 +1,8 @@ # Control and Escape Sequences -⚠️ **This is super out of date. Ghostty's support is much better +⚠️ **This is super out of date. Ghostty's support is much better than this document seems. TODO to update this.** ⚠️ - This is the list of control and escape sequences known in the ecosystem of terminal emulators and their implementation status in ghostty. Note that some control sequences may never be implemented in ghostty. In these scenarios, @@ -11,35 +10,35 @@ it is noted why. Status meanings: - * ✅ - Implementation is complete and considered 100% accurate. - * ⚠️ - Implementation works, but may be missing some functionality. The - details of how well it works or doesn't are in the linked page. In many - cases, the missing functionality is very specific or esoteric. Regardless, - we don't consider a sequence a green checkmark until all known feature - interactions are complete. - * ❌ - Implementation is effectively non-functional, but ghostty continues - in the face of it (probably in some broken state). - * 💥 - Ghostty crashes if this control sequence is sent. +- ✅ - Implementation is complete and considered 100% accurate. +- ⚠️ - Implementation works, but may be missing some functionality. The + details of how well it works or doesn't are in the linked page. In many + cases, the missing functionality is very specific or esoteric. Regardless, + we don't consider a sequence a green checkmark until all known feature + interactions are complete. +- ❌ - Implementation is effectively non-functional, but ghostty continues + in the face of it (probably in some broken state). +- 💥 - Ghostty crashes if this control sequence is sent. -| ID | ASCII | Name | Status | -|:---:|:-----:|:-----|:------:| -| `ENQ` | `0x05` | [Enquiry](sequences/enq.md) | ✅ | -| `BEL` | `0x07` | [Bell](sequences/bel.md) | ❌ | -| `BS` | `0x08` | [Backspace](sequences/bs.md) | ⚠️ | -| `TAB` | `0x09` | [Tab](sequences/tab.md) | ⚠️ | -| `LF` | `0x0A` | [Linefeed](sequences/lf.md) | ⚠️ | -| `VT` | `0x0B` | [Vertical Tab](sequences/vt.md) | ✅ | -| `FF` | `0x0C` | [Form Feed](sequences/ff.md) | ✅ | -| `CR` | `0x0D` | [Carriage Return](sequences/cr.md) | ⚠️ | -| `SO` | `0x0E` | [Shift Out](#) | ❌ | -| `SI` | `0x0F` | [Shift In](#) | ❌ | -| `CAN` | `0x18` | [Cancel Parsing](sequences/can.md) | ✅ | -| `SUB` | `0x1A` | [Cancel Parsing (Alias)](sequences/can.md) | ✅ | -| `IND` | `ESC D` | [Index](sequences/ind.md) | ✅ | -| `NEL` | `ESC E` | [Next Line](sequences/nel.md) | ✅ | -| `HTS` | `ESC H` | [Horizontal Tab Set](sequences/hts.md) | ✅ | -| `RI` | `ESC M` | [Reverse Index](sequences/ri.md) | ⚠️ | -| `SS2` | `ESC N` | [Single Shift 2](#) | ❌ | -| `SS3` | `ESC O` | [Single Shift 3](#) | ❌ | -| `SPA` | `ESC V` | [Start Protected Area](#) | ❌ | -| `EPA` | `ESC W` | [End Protected Area](#) | ❌ | +| ID | ASCII | Name | Status | +| :---: | :-----: | :----------------------------------------- | :----: | +| `ENQ` | `0x05` | [Enquiry](sequences/enq.md) | ✅ | +| `BEL` | `0x07` | [Bell](sequences/bel.md) | ❌ | +| `BS` | `0x08` | [Backspace](sequences/bs.md) | ⚠️ | +| `TAB` | `0x09` | [Tab](sequences/tab.md) | ⚠️ | +| `LF` | `0x0A` | [Linefeed](sequences/lf.md) | ⚠️ | +| `VT` | `0x0B` | [Vertical Tab](sequences/vt.md) | ✅ | +| `FF` | `0x0C` | [Form Feed](sequences/ff.md) | ✅ | +| `CR` | `0x0D` | [Carriage Return](sequences/cr.md) | ⚠️ | +| `SO` | `0x0E` | [Shift Out](#) | ❌ | +| `SI` | `0x0F` | [Shift In](#) | ❌ | +| `CAN` | `0x18` | [Cancel Parsing](sequences/can.md) | ✅ | +| `SUB` | `0x1A` | [Cancel Parsing (Alias)](sequences/can.md) | ✅ | +| `IND` | `ESC D` | [Index](sequences/ind.md) | ✅ | +| `NEL` | `ESC E` | [Next Line](sequences/nel.md) | ✅ | +| `HTS` | `ESC H` | [Horizontal Tab Set](sequences/hts.md) | ✅ | +| `RI` | `ESC M` | [Reverse Index](sequences/ri.md) | ⚠️ | +| `SS2` | `ESC N` | [Single Shift 2](#) | ❌ | +| `SS3` | `ESC O` | [Single Shift 3](#) | ❌ | +| `SPA` | `ESC V` | [Start Protected Area](#) | ❌ | +| `EPA` | `ESC W` | [End Protected Area](#) | ❌ | diff --git a/docs/sequences/bel.md b/docs/sequences/bel.md index 753e93f08..3ee7a4445 100644 --- a/docs/sequences/bel.md +++ b/docs/sequences/bel.md @@ -1,24 +1,24 @@ # Bell -| | | -| --- | --- | +| | | +| ---- | ------ | | Text | | -| Hex | `0x07` | +| Hex | `0x07` | Rings a "bell" to alert the operator to some condition. ## Implementation Details - * ghostty logs "BELL" +- ghostty logs "BELL" ## TODO - * Add a configurable visual bell -- common in most terminal emulators -- - to flash the border. - * Mark the window as requesting attention, most operating systems support - this. For example, Windows windows will flash in the toolbar. - * Support an audible bell. +- Add a configurable visual bell -- common in most terminal emulators -- + to flash the border. +- Mark the window as requesting attention, most operating systems support + this. For example, Windows windows will flash in the toolbar. +- Support an audible bell. ## References - * https://vt100.net/docs/vt100-ug/chapter3.html +- https://vt100.net/docs/vt100-ug/chapter3.html diff --git a/docs/sequences/bs.md b/docs/sequences/bs.md index a0a02c312..80835947e 100644 --- a/docs/sequences/bs.md +++ b/docs/sequences/bs.md @@ -1,9 +1,9 @@ # Backspace -| | | -| --- | --- | +| | | +| ---- | ------ | | Text | | -| Hex | `0x08` | +| Hex | `0x08` | Move the cursor left one cell. @@ -11,9 +11,9 @@ TODO: Details about how this interacts with soft wrapping. ## Implementation Details - * ghostty implements this naively as `cursor.x -|= 1` (`-|=` being a - saturating subtraction). +- ghostty implements this naively as `cursor.x -|= 1` (`-|=` being a + saturating subtraction). ## TODO - * Soft wrap integration +- Soft wrap integration diff --git a/docs/sequences/can.md b/docs/sequences/can.md index d601505a7..d2f5236ba 100644 --- a/docs/sequences/can.md +++ b/docs/sequences/can.md @@ -1,9 +1,9 @@ # Cancel Parsing -| | | -| --- | --- | -| Text | | -| Hex | `0x18` or `0x1A` | +| | | +| ---- | ---------------- | +| Text | | +| Hex | `0x18` or `0x1A` | Cancels sequence parsing. Any partially completed sequence such as `ESC` can send `0x18` and revert back to an unparsed state. The sequence characters diff --git a/docs/sequences/cr.md b/docs/sequences/cr.md index 763b02b1a..e5ba913b7 100644 --- a/docs/sequences/cr.md +++ b/docs/sequences/cr.md @@ -1,13 +1,13 @@ # Carriage Return -| | | -| --- | --- | +| | | +| ---- | ------ | | Text | | -| Hex | `0x0D` | +| Hex | `0x0D` | Moves the cursor to the left-most column and resets any pending wrap flags. ## TODO - * Integration with left/right scrolling margins - * Integration with origin mode +- Integration with left/right scrolling margins +- Integration with origin mode diff --git a/docs/sequences/enq.md b/docs/sequences/enq.md index dae4cbbe6..f6180d72f 100644 --- a/docs/sequences/enq.md +++ b/docs/sequences/enq.md @@ -1,21 +1,21 @@ # Enquiry (Answerback) -| | | -| --- | --- | +| | | +| ---- | ------ | | Text | | -| Hex | `0x05` | +| Hex | `0x05` | Sends an answerback string. In the VT100, this was configurable by the operator. ## Implementation Details - * ghostty always sends `""` +- ghostty always sends `""` ## TODO - * Make the answerback configurable +- Make the answerback configurable ## References - * https://vt100.net/docs/vt100-ug/chapter3.html +- https://vt100.net/docs/vt100-ug/chapter3.html diff --git a/docs/sequences/ff.md b/docs/sequences/ff.md index c5ead80fe..b8a25048d 100644 --- a/docs/sequences/ff.md +++ b/docs/sequences/ff.md @@ -1,8 +1,8 @@ # Form Feed -| | | -| --- | --- | +| | | +| ---- | ------ | | Text | | -| Hex | `0x0C` | +| Hex | `0x0C` | Equivalent to [linefeed](lf.md). diff --git a/docs/sequences/hts.md b/docs/sequences/hts.md index a0f65ad99..451957a9d 100644 --- a/docs/sequences/hts.md +++ b/docs/sequences/hts.md @@ -1,7 +1,7 @@ # Horizontal Tab Set -| | | -| --- | --- | +| | | +| ---- | ----------- | | Text | `ESC H` | | Hex | `0x18 0x48` | diff --git a/docs/sequences/ind.md b/docs/sequences/ind.md index 2d9182e8b..dc1b9c077 100644 --- a/docs/sequences/ind.md +++ b/docs/sequences/ind.md @@ -1,7 +1,7 @@ # Index -| | | -| --- | --- | +| | | +| ---- | ----------- | | Text | `ESC D` | | Hex | `0x18 0x44` | @@ -10,10 +10,10 @@ if necessary. This always unsets the pending wrap state. If the cursor is currently outside the scrolling region: - * move the cursor down one line if it is not on bottom line of the screen. +- move the cursor down one line if it is not on bottom line of the screen. If the cursor is inside the scrolling region: - * If the cursor is on the bottom-most line of the screen: invoke - [scroll up](su.md) with the value `1`. - * Else: move the cursor one line down. +- If the cursor is on the bottom-most line of the screen: invoke + [scroll up](su.md) with the value `1`. +- Else: move the cursor one line down. diff --git a/docs/sequences/lf.md b/docs/sequences/lf.md index 80e11f325..a36472415 100644 --- a/docs/sequences/lf.md +++ b/docs/sequences/lf.md @@ -1,12 +1,12 @@ # Linefeed -| | | -| --- | --- | +| | | +| ---- | ------ | | Text | | -| Hex | `0x0A` | +| Hex | `0x0A` | Invoke [Index](ind.md). ## TODO - * Linefeed mode (mode 20) +- Linefeed mode (mode 20) diff --git a/docs/sequences/nel.md b/docs/sequences/nel.md index 978fcc10a..39691789f 100644 --- a/docs/sequences/nel.md +++ b/docs/sequences/nel.md @@ -1,7 +1,7 @@ # Index -| | | -| --- | --- | +| | | +| ---- | ----------- | | Text | `ESC E` | | Hex | `0x18 0x45` | diff --git a/docs/sequences/ri.md b/docs/sequences/ri.md index 1192ca598..88ba96fe1 100644 --- a/docs/sequences/ri.md +++ b/docs/sequences/ri.md @@ -1,7 +1,7 @@ # Reverse Index -| | | -| --- | --- | +| | | +| ---- | ----------- | | Text | `ESC M` | | Hex | `0x18 0x4D` | @@ -9,13 +9,13 @@ Reverse [index](ind.md). This unsets the pending wrap state. If the cursor is outside of the scrolling region: - * move the cursor one line up unless it is the top-most line of the screen. +- move the cursor one line up unless it is the top-most line of the screen. If the cursor is inside the scrolling region: - * If the cursor is on the top-most line: invoke [scroll down](#) with value `1` - * Else: move the cursor one line up. +- If the cursor is on the top-most line: invoke [scroll down](#) with value `1` +- Else: move the cursor one line up. ## TODO - * Scroll region edge cases +- Scroll region edge cases diff --git a/docs/sequences/tab.md b/docs/sequences/tab.md index 8ba00e4d6..c186289ee 100644 --- a/docs/sequences/tab.md +++ b/docs/sequences/tab.md @@ -1,9 +1,9 @@ # Tab -| | | -| --- | --- | +| | | +| ---- | ------ | | Text | | -| Hex | `0x09` | +| Hex | `0x09` | Move the cursor right to the next tab stop. @@ -17,5 +17,5 @@ Initially, tab stops are set on every 8th column. ## TODO - * Integration with left/right margins of the scrolling region. - * How does horizontal tab interact with the pending wrap state? +- Integration with left/right margins of the scrolling region. +- How does horizontal tab interact with the pending wrap state? diff --git a/docs/sequences/vt.md b/docs/sequences/vt.md index 85e385c38..f721741b3 100644 --- a/docs/sequences/vt.md +++ b/docs/sequences/vt.md @@ -1,8 +1,8 @@ # Vertical Tab -| | | -| --- | --- | +| | | +| ---- | ------ | | Text | | -| Hex | `0x0B` | +| Hex | `0x0B` | Equivalent to [linefeed](lf.md). diff --git a/test/README.md b/test/README.md index ef59fb12e..8b59aa062 100644 --- a/test/README.md +++ b/test/README.md @@ -38,4 +38,3 @@ the full test suite against only a single terminal emulator. This test suite expects the `ghostty` binary to be in _this directory_. You can manually copy it into place. Each time you modify the binary, you must rebuild the Docker image. - From 9d2a85d9cd62918b973a9275158030282217b3a9 Mon Sep 17 00:00:00 2001 From: Patrick Fong Date: Thu, 28 Sep 2023 10:42:38 -0700 Subject: [PATCH 02/10] lint all Yaml files --- .github/workflows/clean-artifacts.yml | 14 +- .github/workflows/release-tip.yml | 232 +++++++++++++------------- .github/workflows/test.yml | 113 +++++++------ com.mitchellh.ghostty.yml | 2 +- vendor/pixman/.gitlab-ci.yml | 28 ++-- 5 files changed, 194 insertions(+), 195 deletions(-) diff --git a/.github/workflows/clean-artifacts.yml b/.github/workflows/clean-artifacts.yml index 5f0d3d782..5337c264a 100644 --- a/.github/workflows/clean-artifacts.yml +++ b/.github/workflows/clean-artifacts.yml @@ -2,16 +2,16 @@ name: Clean Artifacts on: schedule: # Once a day - - cron: '0 0 * * *' + - cron: "0 0 * * *" workflow_dispatch: jobs: remove-old-artifacts: runs-on: ubuntu-latest timeout-minutes: 10 steps: - - name: Remove old artifacts - uses: c-hive/gha-remove-artifacts@v1 - with: - age: '1 week' - skip-tags: true - skip-recent: 5 + - name: Remove old artifacts + uses: c-hive/gha-remove-artifacts@v1 + with: + age: "1 week" + skip-tags: true + skip-recent: 5 diff --git a/.github/workflows/release-tip.yml b/.github/workflows/release-tip.yml index 2a1eea4b0..65229f1bc 100644 --- a/.github/workflows/release-tip.yml +++ b/.github/workflows/release-tip.yml @@ -13,13 +13,13 @@ jobs: runs-on: ubuntu-latest needs: [build-macos] steps: - - uses: actions/checkout@v4 - - name: Tip Tag - run: | - git config user.name "GitHub Actions Bot" - git config user.email "<>" - git tag -fa tip -m "Latest Continuous Release" ${GITHUB_SHA} - git push --force origin tip + - uses: actions/checkout@v4 + - name: Tip Tag + run: | + git config user.name "GitHub Actions Bot" + git config user.email "<>" + git tag -fa tip -m "Latest Continuous Release" ${GITHUB_SHA} + git push --force origin tip build-macos: if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} @@ -29,130 +29,130 @@ jobs: # Needed for macos SDK AGREE: "true" steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - submodules: recursive - fetch-depth: 0 + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 - # Install Nix and use that to run our tests so our environment matches exactly. - - uses: cachix/install-nix-action@v23 - with: - nix_path: nixpkgs=channel:nixos-unstable + # Install Nix and use that to run our tests so our environment matches exactly. + - uses: cachix/install-nix-action@v23 + with: + nix_path: nixpkgs=channel:nixos-unstable - # Setup our S3 client - - name: Setup s3cmd - uses: s3-actions/s3cmd@v1.5.0 - with: - provider: cloudflare - account_id: ${{ secrets.CF_R2_TIP_ACCOUNT_ID }} - access_key: ${{ secrets.CF_R2_TIP_AWS_KEY }} - secreT_key: ${{ secrets.CF_R2_TIP_SECRET_KEY }} + # Setup our S3 client + - name: Setup s3cmd + uses: s3-actions/s3cmd@v1.5.0 + with: + provider: cloudflare + account_id: ${{ secrets.CF_R2_TIP_ACCOUNT_ID }} + access_key: ${{ secrets.CF_R2_TIP_AWS_KEY }} + secreT_key: ${{ secrets.CF_R2_TIP_SECRET_KEY }} - # Load Build Number - - name: Build Number - run: | - echo "GHOSTTY_BUILD=$(git rev-list --count head)" >> $GITHUB_ENV + # Load Build Number + - name: Build Number + run: | + echo "GHOSTTY_BUILD=$(git rev-list --count head)" >> $GITHUB_ENV - # GhosttyKit is the framework that is built from Zig for our native - # Mac app to access. Build this in release mode. - - name: Build GhosttyKit - run: nix develop -c zig build -Dstatic=true -Doptimize=ReleaseFast + # GhosttyKit is the framework that is built from Zig for our native + # Mac app to access. Build this in release mode. + - name: Build GhosttyKit + run: nix develop -c zig build -Dstatic=true -Doptimize=ReleaseFast - # The native app is built with native XCode tooling. This also does - # codesigning. IMPORTANT: this must NOT run in a Nix environment. - # Nix breaks xcodebuild so this has to be run outside. - - name: Build Ghostty.app - run: cd macos && xcodebuild -configuration Release + # The native app is built with native XCode tooling. This also does + # codesigning. IMPORTANT: this must NOT run in a Nix environment. + # Nix breaks xcodebuild so this has to be run outside. + - name: Build Ghostty.app + run: cd macos && xcodebuild -configuration Release - # We inject the "build number" as simply the number of commits since HEAD. - # This will be a monotonically always increasing build number that we use. - - name: Inject Build Number - run: | - echo "Setting build to $GHOSTTY_BUILD" - /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $GHOSTTY_BUILD" "macos/build/Release/Ghostty.app/Contents/Info.plist" + # We inject the "build number" as simply the number of commits since HEAD. + # This will be a monotonically always increasing build number that we use. + - name: Inject Build Number + run: | + echo "Setting build to $GHOSTTY_BUILD" + /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $GHOSTTY_BUILD" "macos/build/Release/Ghostty.app/Contents/Info.plist" - - name: Zip Unsigned App - run: nix develop -c sh -c 'cd macos/build/Release && zip -9 -r --symlinks ../../../ghostty-macos-universal-unsigned.zip Ghostty.app' + - name: Zip Unsigned App + run: nix develop -c sh -c 'cd macos/build/Release && zip -9 -r --symlinks ../../../ghostty-macos-universal-unsigned.zip Ghostty.app' - # Update Release - - name: Release Unsigned - uses: softprops/action-gh-release@v1 - with: - name: "Ghostty Tip (\"Nightly\")" - prerelease: true - tag_name: tip - target_commitish: ${{ github.sha }} - files: ghostty-macos-universal-unsigned.zip - token: ${{ secrets.GH_RELEASE_TOKEN }} + # Update Release + - name: Release Unsigned + uses: softprops/action-gh-release@v1 + with: + name: 'Ghostty Tip ("Nightly")' + prerelease: true + tag_name: tip + target_commitish: ${{ github.sha }} + files: ghostty-macos-universal-unsigned.zip + token: ${{ secrets.GH_RELEASE_TOKEN }} - - name: Codesign app bundle - env: - MACOS_CERTIFICATE: ${{ secrets.PROD_MACOS_CERTIFICATE }} - MACOS_CERTIFICATE_PWD: ${{ secrets.PROD_MACOS_CERTIFICATE_PWD }} - MACOS_CERTIFICATE_NAME: ${{ secrets.PROD_MACOS_CERTIFICATE_NAME }} - MACOS_CI_KEYCHAIN_PWD: ${{ secrets.PROD_MACOS_CI_KEYCHAIN_PWD }} - run: | - # Turn our base64-encoded certificate back to a regular .p12 file - echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12 + - name: Codesign app bundle + env: + MACOS_CERTIFICATE: ${{ secrets.PROD_MACOS_CERTIFICATE }} + MACOS_CERTIFICATE_PWD: ${{ secrets.PROD_MACOS_CERTIFICATE_PWD }} + MACOS_CERTIFICATE_NAME: ${{ secrets.PROD_MACOS_CERTIFICATE_NAME }} + MACOS_CI_KEYCHAIN_PWD: ${{ secrets.PROD_MACOS_CI_KEYCHAIN_PWD }} + run: | + # Turn our base64-encoded certificate back to a regular .p12 file + echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12 - # We need to create a new keychain, otherwise using the certificate will prompt - # with a UI dialog asking for the certificate password, which we can't - # use in a headless CI environment - security create-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain - security default-keychain -s build.keychain - security unlock-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain - security import certificate.p12 -k build.keychain -P "$MACOS_CERTIFICATE_PWD" -T /usr/bin/codesign - security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$MACOS_CI_KEYCHAIN_PWD" build.keychain + # We need to create a new keychain, otherwise using the certificate will prompt + # with a UI dialog asking for the certificate password, which we can't + # use in a headless CI environment + security create-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain + security default-keychain -s build.keychain + security unlock-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain + security import certificate.p12 -k build.keychain -P "$MACOS_CERTIFICATE_PWD" -T /usr/bin/codesign + security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$MACOS_CI_KEYCHAIN_PWD" build.keychain - # We finally codesign our app bundle, specifying the Hardened runtime option - /usr/bin/codesign --force -s "$MACOS_CERTIFICATE_NAME" --options runtime macos/build/Release/Ghostty.app -v + # We finally codesign our app bundle, specifying the Hardened runtime option + /usr/bin/codesign --force -s "$MACOS_CERTIFICATE_NAME" --options runtime macos/build/Release/Ghostty.app -v - - name: "Notarize app bundle" - env: - PROD_MACOS_NOTARIZATION_APPLE_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_APPLE_ID }} - PROD_MACOS_NOTARIZATION_TEAM_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_TEAM_ID }} - PROD_MACOS_NOTARIZATION_PWD: ${{ secrets.PROD_MACOS_NOTARIZATION_PWD }} - run: | - # Store the notarization credentials so that we can prevent a UI password dialog - # from blocking the CI - echo "Create keychain profile" - xcrun notarytool store-credentials "notarytool-profile" --apple-id "$PROD_MACOS_NOTARIZATION_APPLE_ID" --team-id "$PROD_MACOS_NOTARIZATION_TEAM_ID" --password "$PROD_MACOS_NOTARIZATION_PWD" + - name: "Notarize app bundle" + env: + PROD_MACOS_NOTARIZATION_APPLE_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_APPLE_ID }} + PROD_MACOS_NOTARIZATION_TEAM_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_TEAM_ID }} + PROD_MACOS_NOTARIZATION_PWD: ${{ secrets.PROD_MACOS_NOTARIZATION_PWD }} + run: | + # Store the notarization credentials so that we can prevent a UI password dialog + # from blocking the CI + echo "Create keychain profile" + xcrun notarytool store-credentials "notarytool-profile" --apple-id "$PROD_MACOS_NOTARIZATION_APPLE_ID" --team-id "$PROD_MACOS_NOTARIZATION_TEAM_ID" --password "$PROD_MACOS_NOTARIZATION_PWD" - # We can't notarize an app bundle directly, but we need to compress it as an archive. - # Therefore, we create a zip file containing our app bundle, so that we can send it to the - # notarization service - echo "Creating temp notarization archive" - ditto -c -k --keepParent "macos/build/Release/Ghostty.app" "notarization.zip" + # We can't notarize an app bundle directly, but we need to compress it as an archive. + # Therefore, we create a zip file containing our app bundle, so that we can send it to the + # notarization service + echo "Creating temp notarization archive" + ditto -c -k --keepParent "macos/build/Release/Ghostty.app" "notarization.zip" - # Here we send the notarization request to the Apple's Notarization service, waiting for the result. - # This typically takes a few seconds inside a CI environment, but it might take more depending on the App - # characteristics. Visit the Notarization docs for more information and strategies on how to optimize it if - # you're curious - echo "Notarize app" - xcrun notarytool submit "notarization.zip" --keychain-profile "notarytool-profile" --wait + # Here we send the notarization request to the Apple's Notarization service, waiting for the result. + # This typically takes a few seconds inside a CI environment, but it might take more depending on the App + # characteristics. Visit the Notarization docs for more information and strategies on how to optimize it if + # you're curious + echo "Notarize app" + xcrun notarytool submit "notarization.zip" --keychain-profile "notarytool-profile" --wait - # Finally, we need to "attach the staple" to our executable, which will allow our app to be - # validated by macOS even when an internet connection is not available. - echo "Attach staple" - xcrun stapler staple "macos/build/Release/Ghostty.app" + # Finally, we need to "attach the staple" to our executable, which will allow our app to be + # validated by macOS even when an internet connection is not available. + echo "Attach staple" + xcrun stapler staple "macos/build/Release/Ghostty.app" - # Zip up the app - - name: Zip App - run: cd macos/build/Release && zip -9 -r --symlinks ../../../ghostty-macos-universal.zip Ghostty.app + # Zip up the app + - name: Zip App + run: cd macos/build/Release && zip -9 -r --symlinks ../../../ghostty-macos-universal.zip Ghostty.app - # Update Release - - name: Release - uses: softprops/action-gh-release@v1 - with: - name: "Ghostty Tip (\"Nightly\")" - prerelease: true - tag_name: tip - target_commitish: ${{ github.sha }} - files: ghostty-macos-universal.zip - token: ${{ secrets.GH_RELEASE_TOKEN }} + # Update Release + - name: Release + uses: softprops/action-gh-release@v1 + with: + name: 'Ghostty Tip ("Nightly")' + prerelease: true + tag_name: tip + target_commitish: ${{ github.sha }} + files: ghostty-macos-universal.zip + token: ${{ secrets.GH_RELEASE_TOKEN }} - # Update Blob Storage - - name: Upload to Blob Storage - run: | - s3cmd put ghostty-macos-universal.zip s3://ghostty-tip/${GHOSTTY_BUILD}/ghostty-macos-universal.zip + # Update Blob Storage + - name: Upload to Blob Storage + run: | + s3cmd put ghostty-macos-universal.zip s3://ghostty-tip/${GHOSTTY_BUILD}/ghostty-macos-universal.zip diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5bbea409b..5055907c7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,37 +8,36 @@ jobs: os: [ubuntu-latest] target: [ - aarch64-macos, - x86_64-macos, + aarch64-macos, + x86_64-macos, - aarch64-linux-gnu, - x86_64-linux-gnu, - - # No windows support currently. - # i386-windows, - # x86_64-windows-gnu, - ] + aarch64-linux-gnu, + x86_64-linux-gnu, + # No windows support currently. + # i386-windows, + # x86_64-windows-gnu, + ] runs-on: ${{ matrix.os }} needs: test env: # Needed for macos SDK AGREE: "true" steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - submodules: recursive - fetch-depth: 0 + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 - # Install Nix and use that to run our tests so our environment matches exactly. - - uses: cachix/install-nix-action@v23 - with: - nix_path: nixpkgs=channel:nixos-unstable + # Install Nix and use that to run our tests so our environment matches exactly. + - uses: cachix/install-nix-action@v23 + with: + nix_path: nixpkgs=channel:nixos-unstable - # Cross-compile the binary. We always use static building for this - # because its the only way to access the headers. - - name: Test Build - run: nix develop -c zig build -Dstatic=true -Dapp-runtime=glfw -Dtarget=${{ matrix.target }} + # Cross-compile the binary. We always use static building for this + # because its the only way to access the headers. + - name: Test Build + run: nix develop -c zig build -Dstatic=true -Dapp-runtime=glfw -Dtarget=${{ matrix.target }} build-macos: runs-on: macos-12 @@ -47,27 +46,27 @@ jobs: # Needed for macos SDK AGREE: "true" steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - submodules: recursive - fetch-depth: 0 + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 - # Install Nix and use that to run our tests so our environment matches exactly. - - uses: cachix/install-nix-action@v23 - with: - nix_path: nixpkgs=channel:nixos-unstable + # Install Nix and use that to run our tests so our environment matches exactly. + - uses: cachix/install-nix-action@v23 + with: + nix_path: nixpkgs=channel:nixos-unstable - # GhosttyKit is the framework that is built from Zig for our native - # Mac app to access. - - name: Build GhosttyKit - run: nix develop -c zig build -Dstatic=true + # GhosttyKit is the framework that is built from Zig for our native + # Mac app to access. + - name: Build GhosttyKit + run: nix develop -c zig build -Dstatic=true - # The native app is built with native XCode tooling. This also does - # codesigning. IMPORTANT: this must NOT run in a Nix environment. - # Nix breaks xcodebuild so this has to be run outside. - - name: Build Ghostty.app - run: cd macos && xcodebuild + # The native app is built with native XCode tooling. This also does + # codesigning. IMPORTANT: this must NOT run in a Nix environment. + # Nix breaks xcodebuild so this has to be run outside. + - name: Build Ghostty.app + run: cd macos && xcodebuild test: strategy: @@ -75,25 +74,25 @@ jobs: os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - submodules: recursive - fetch-depth: 0 + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 - # Install Nix and use that to run our tests so our environment matches exactly. - - uses: cachix/install-nix-action@v23 - with: - nix_path: nixpkgs=channel:nixos-unstable + # Install Nix and use that to run our tests so our environment matches exactly. + - uses: cachix/install-nix-action@v23 + with: + nix_path: nixpkgs=channel:nixos-unstable - - name: test - run: nix develop -c zig build -Dapp-runtime=none test + - name: test + run: nix develop -c zig build -Dapp-runtime=none test - - name: Test GTK Build - run: nix develop -c zig build -Dapp-runtime=gtk + - name: Test GTK Build + run: nix develop -c zig build -Dapp-runtime=gtk - - name: Test GLFW Build - run: nix develop -c zig build -Dapp-runtime=glfw + - name: Test GLFW Build + run: nix develop -c zig build -Dapp-runtime=glfw - - name: Test Dynamic Build - run: nix develop -c zig build -Dstatic=false + - name: Test Dynamic Build + run: nix develop -c zig build -Dstatic=false diff --git a/com.mitchellh.ghostty.yml b/com.mitchellh.ghostty.yml index f92f4e99e..aa7785b27 100644 --- a/com.mitchellh.ghostty.yml +++ b/com.mitchellh.ghostty.yml @@ -3,7 +3,7 @@ # we want to keep _trying_ but its something with known issues. app-id: com.mitchellh.ghostty runtime: org.gnome.Platform -runtime-version: '43' +runtime-version: "43" sdk: org.gnome.Sdk default-branch: tip command: ghostty diff --git a/vendor/pixman/.gitlab-ci.yml b/vendor/pixman/.gitlab-ci.yml index 25c73df12..2a7b9bcee 100644 --- a/vendor/pixman/.gitlab-ci.yml +++ b/vendor/pixman/.gitlab-ci.yml @@ -1,19 +1,19 @@ image: fedora:28 autotools-build: - script: - - dnf -y install dnf-plugins-core - - dnf -y groupinstall buildsys-build - - dnf -y builddep pixman - - ./autogen.sh - - make -sj4 check + script: + - dnf -y install dnf-plugins-core + - dnf -y groupinstall buildsys-build + - dnf -y builddep pixman + - ./autogen.sh + - make -sj4 check meson-build: - script: - - dnf -y install dnf-plugins-core - - dnf -y groupinstall buildsys-build - - dnf -y builddep pixman - - dnf -y install ninja-build - - python3 -m pip install meson>=0.52.1 - - meson build - - ninja -C build test + script: + - dnf -y install dnf-plugins-core + - dnf -y groupinstall buildsys-build + - dnf -y builddep pixman + - dnf -y install ninja-build + - python3 -m pip install meson>=0.52.1 + - meson build + - ninja -C build test From 1cb6b50331b1ec31148f32f66d7c8a83470f378a Mon Sep 17 00:00:00 2001 From: Patrick Fong Date: Thu, 28 Sep 2023 10:56:53 -0700 Subject: [PATCH 03/10] add Prettier step to check formatting --- .github/workflows/test.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5055907c7..dce25a53e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -96,3 +96,11 @@ jobs: - name: Test Dynamic Build run: nix develop -c zig build -Dstatic=false + + prettier: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 # Check out repo so we can lint it + - uses: actionsx/prettier@v3 + with: + args: --check . From c2ec3f75ad77ef3b4bdeec86315fb573c389e530 Mon Sep 17 00:00:00 2001 From: Patrick Fong Date: Thu, 28 Sep 2023 11:05:54 -0700 Subject: [PATCH 04/10] lint JSON and Typescript as well --- example/app.ts | 292 +++++++++--------- .../AccentColor.colorset/Contents.json | 10 +- .../AppIcon.appiconset/Contents.json | 88 +++--- .../AppIconImage.imageset/Contents.json | 26 +- macos/Assets.xcassets/Contents.json | 6 +- 5 files changed, 219 insertions(+), 203 deletions(-) diff --git a/example/app.ts b/example/app.ts index 7508e95a3..2380d198c 100644 --- a/example/app.ts +++ b/example/app.ts @@ -1,14 +1,18 @@ -import { ZigJS } from 'zig-js'; +import { ZigJS } from "zig-js"; const zjs = new ZigJS(); const importObject = { module: {}, env: { - memory: new WebAssembly.Memory({ initial: 25, maximum: 65536, shared: true }), + memory: new WebAssembly.Memory({ + initial: 25, + maximum: 65536, + shared: true, + }), log: (ptr: number, len: number) => { const arr = new Uint8ClampedArray(zjs.memory.buffer, ptr, len); const data = arr.slice(); - const str = new TextDecoder('utf-8').decode(data); + const str = new TextDecoder("utf-8").decode(data); console.log(str); }, }, @@ -16,158 +20,170 @@ const importObject = { ...zjs.importObject(), }; -const url = new URL('ghostty-wasm.wasm', import.meta.url); -fetch(url.href).then(response => - response.arrayBuffer() -).then(bytes => - WebAssembly.instantiate(bytes, importObject) -).then(results => { - const memory = importObject.env.memory; - const { - malloc, - free, - config_new, - config_free, - config_load_string, - config_finalize, - face_new, - face_free, - face_render_glyph, - face_debug_canvas, - deferred_face_new, - deferred_face_free, - deferred_face_load, - deferred_face_face, - group_new, - group_free, - group_add_face, - group_init_sprite_face, - group_index_for_codepoint, - group_render_glyph, - group_cache_new, - group_cache_free, - group_cache_index_for_codepoint, - group_cache_render_glyph, - group_cache_atlas_greyscale, - group_cache_atlas_color, - atlas_new, - atlas_free, - atlas_debug_canvas, - shaper_new, - shaper_free, - shaper_test, - } = results.instance.exports; - // Give us access to the zjs value for debugging. - globalThis.zjs = zjs; - console.log(zjs); +const url = new URL("ghostty-wasm.wasm", import.meta.url); +fetch(url.href) + .then((response) => response.arrayBuffer()) + .then((bytes) => WebAssembly.instantiate(bytes, importObject)) + .then((results) => { + const memory = importObject.env.memory; + const { + malloc, + free, + config_new, + config_free, + config_load_string, + config_finalize, + face_new, + face_free, + face_render_glyph, + face_debug_canvas, + deferred_face_new, + deferred_face_free, + deferred_face_load, + deferred_face_face, + group_new, + group_free, + group_add_face, + group_init_sprite_face, + group_index_for_codepoint, + group_render_glyph, + group_cache_new, + group_cache_free, + group_cache_index_for_codepoint, + group_cache_render_glyph, + group_cache_atlas_greyscale, + group_cache_atlas_color, + atlas_new, + atlas_free, + atlas_debug_canvas, + shaper_new, + shaper_free, + shaper_test, + } = results.instance.exports; + // Give us access to the zjs value for debugging. + globalThis.zjs = zjs; + console.log(zjs); - // Initialize our zig-js memory - zjs.memory = memory; + // Initialize our zig-js memory + zjs.memory = memory; - // Helpers - const makeStr = (str) => { - const utf8 = new TextEncoder().encode(str); - const ptr = malloc(utf8.byteLength); - new Uint8Array(memory.buffer, ptr).set(utf8); - return { ptr: ptr, len: utf8.byteLength }; - }; + // Helpers + const makeStr = (str) => { + const utf8 = new TextEncoder().encode(str); + const ptr = malloc(utf8.byteLength); + new Uint8Array(memory.buffer, ptr).set(utf8); + return { ptr: ptr, len: utf8.byteLength }; + }; - // Create our config - const config = config_new(); - const config_str = makeStr("font-family = monospace"); - config_load_string(config, config_str.ptr, config_str.len); - config_finalize(config); - free(config_str.ptr); + // Create our config + const config = config_new(); + const config_str = makeStr("font-family = monospace"); + config_load_string(config, config_str.ptr, config_str.len); + config_finalize(config); + free(config_str.ptr); - // Create our atlas - // const atlas = atlas_new(512, 0 /* greyscale */); + // Create our atlas + // const atlas = atlas_new(512, 0 /* greyscale */); - // Create some memory for our string - const font_name = makeStr("monospace"); + // Create some memory for our string + const font_name = makeStr("monospace"); - // Initialize our deferred face - // const df = deferred_face_new(font_ptr, font.byteLength, 0 /* text */); - //deferred_face_load(df, 72 /* size */); - //const face = deferred_face_face(df); + // Initialize our deferred face + // const df = deferred_face_new(font_ptr, font.byteLength, 0 /* text */); + //deferred_face_load(df, 72 /* size */); + //const face = deferred_face_face(df); - // Initialize our font face - //const face = face_new(font_ptr, font.byteLength, 72 /* size in px */); - //free(font_ptr); + // Initialize our font face + //const face = face_new(font_ptr, font.byteLength, 72 /* size in px */); + //free(font_ptr); - // Create our group - const group = group_new(32 /* size */); - group_add_face(group, 0 /* regular */, deferred_face_new(font_name.ptr, font_name.len, 0 /* text */)); - group_add_face(group, 0 /* regular */, deferred_face_new(font_name.ptr, font_name.len, 1 /* emoji */)); + // Create our group + const group = group_new(32 /* size */); + group_add_face( + group, + 0 /* regular */, + deferred_face_new(font_name.ptr, font_name.len, 0 /* text */), + ); + group_add_face( + group, + 0 /* regular */, + deferred_face_new(font_name.ptr, font_name.len, 1 /* emoji */), + ); - // Initialize our sprite font, without this we just use the browser. - group_init_sprite_face(group); + // Initialize our sprite font, without this we just use the browser. + group_init_sprite_face(group); - // Create our group cache - const group_cache = group_cache_new(group); + // Create our group cache + const group_cache = group_cache_new(group); - // Render a glyph - // for (let i = 33; i <= 126; i++) { - // const font_idx = group_cache_index_for_codepoint(group_cache, i, 0, -1); - // group_cache_render_glyph(group_cache, font_idx, i, 0); - // //face_render_glyph(face, atlas, i); - // } - // - // const emoji = ["🐏","🌞","🌚","🍱","💿","🐈","📃","📀","🕡","🙃"]; - // for (let i = 0; i < emoji.length; i++) { - // const cp = emoji[i].codePointAt(0); - // const font_idx = group_cache_index_for_codepoint(group_cache, cp, 0, -1 /* best choice */); - // group_cache_render_glyph(group_cache, font_idx, cp, 0); - // } + // Render a glyph + // for (let i = 33; i <= 126; i++) { + // const font_idx = group_cache_index_for_codepoint(group_cache, i, 0, -1); + // group_cache_render_glyph(group_cache, font_idx, i, 0); + // //face_render_glyph(face, atlas, i); + // } + // + // const emoji = ["🐏","🌞","🌚","🍱","💿","🐈","📃","📀","🕡","🙃"]; + // for (let i = 0; i < emoji.length; i++) { + // const cp = emoji[i].codePointAt(0); + // const font_idx = group_cache_index_for_codepoint(group_cache, cp, 0, -1 /* best choice */); + // group_cache_render_glyph(group_cache, font_idx, cp, 0); + // } - for (let i = 0x2500; i <= 0x257F; i++) { - const font_idx = group_cache_index_for_codepoint(group_cache, i, 0, -1); - group_cache_render_glyph(group_cache, font_idx, i, 0); - } - for (let i = 0x2580; i <= 0x259f; i++) { - const font_idx = group_cache_index_for_codepoint(group_cache, i, 0, -1); - group_cache_render_glyph(group_cache, font_idx, i, 0); - } - for (let i = 0x2800; i <= 0x28FF; i++) { - const font_idx = group_cache_index_for_codepoint(group_cache, i, 0, -1); - group_cache_render_glyph(group_cache, font_idx, i, 0); - } - for (let i = 0x1FB00; i <= 0x1FB3B; i++) { - const font_idx = group_cache_index_for_codepoint(group_cache, i, 0, -1); - group_cache_render_glyph(group_cache, font_idx, i, 0); - } - for (let i = 0x1FB3C; i <= 0x1FB6B; i++) { - const font_idx = group_cache_index_for_codepoint(group_cache, i, 0, -1); - group_cache_render_glyph(group_cache, font_idx, i, 0); - } + for (let i = 0x2500; i <= 0x257f; i++) { + const font_idx = group_cache_index_for_codepoint(group_cache, i, 0, -1); + group_cache_render_glyph(group_cache, font_idx, i, 0); + } + for (let i = 0x2580; i <= 0x259f; i++) { + const font_idx = group_cache_index_for_codepoint(group_cache, i, 0, -1); + group_cache_render_glyph(group_cache, font_idx, i, 0); + } + for (let i = 0x2800; i <= 0x28ff; i++) { + const font_idx = group_cache_index_for_codepoint(group_cache, i, 0, -1); + group_cache_render_glyph(group_cache, font_idx, i, 0); + } + for (let i = 0x1fb00; i <= 0x1fb3b; i++) { + const font_idx = group_cache_index_for_codepoint(group_cache, i, 0, -1); + group_cache_render_glyph(group_cache, font_idx, i, 0); + } + for (let i = 0x1fb3c; i <= 0x1fb6b; i++) { + const font_idx = group_cache_index_for_codepoint(group_cache, i, 0, -1); + group_cache_render_glyph(group_cache, font_idx, i, 0); + } - //face_render_glyph(face, atlas, "橋".codePointAt(0)); - //face_render_glyph(face, atlas, "p".codePointAt(0)); + //face_render_glyph(face, atlas, "橋".codePointAt(0)); + //face_render_glyph(face, atlas, "p".codePointAt(0)); - // Debug our canvas - //face_debug_canvas(face); + // Debug our canvas + //face_debug_canvas(face); - // Let's try shaping - const shaper = shaper_new(120); - //const input = makeStr("hello🐏"); - const input = makeStr("hello🐏👍🏽"); - shaper_test(shaper, group_cache, input.ptr, input.len); + // Let's try shaping + const shaper = shaper_new(120); + //const input = makeStr("hello🐏"); + const input = makeStr("hello🐏👍🏽"); + shaper_test(shaper, group_cache, input.ptr, input.len); - const cp = 1114112; - const font_idx = group_cache_index_for_codepoint(group_cache, cp, 0, -1 /* best choice */); - group_cache_render_glyph(group_cache, font_idx, cp, -1); + const cp = 1114112; + const font_idx = group_cache_index_for_codepoint( + group_cache, + cp, + 0, + -1 /* best choice */, + ); + group_cache_render_glyph(group_cache, font_idx, cp, -1); - // Debug our atlas canvas - { - const atlas = group_cache_atlas_greyscale(group_cache); - const id = atlas_debug_canvas(atlas); - document.getElementById("atlas-canvas").append(zjs.deleteValue(id)); - } + // Debug our atlas canvas + { + const atlas = group_cache_atlas_greyscale(group_cache); + const id = atlas_debug_canvas(atlas); + document.getElementById("atlas-canvas").append(zjs.deleteValue(id)); + } - { - const atlas = group_cache_atlas_color(group_cache); - const id = atlas_debug_canvas(atlas); - document.getElementById("atlas-color-canvas").append(zjs.deleteValue(id)); - } + { + const atlas = group_cache_atlas_color(group_cache); + const id = atlas_debug_canvas(atlas); + document.getElementById("atlas-color-canvas").append(zjs.deleteValue(id)); + } //face_free(face); -}); + }); diff --git a/macos/Assets.xcassets/AccentColor.colorset/Contents.json b/macos/Assets.xcassets/AccentColor.colorset/Contents.json index eb8789700..0afb3cf0e 100644 --- a/macos/Assets.xcassets/AccentColor.colorset/Contents.json +++ b/macos/Assets.xcassets/AccentColor.colorset/Contents.json @@ -1,11 +1,11 @@ { - "colors" : [ + "colors": [ { - "idiom" : "universal" + "idiom": "universal" } ], - "info" : { - "author" : "xcode", - "version" : 1 + "info": { + "author": "xcode", + "version": 1 } } diff --git a/macos/Assets.xcassets/AppIcon.appiconset/Contents.json b/macos/Assets.xcassets/AppIcon.appiconset/Contents.json index 0425f20d1..3bd7016fd 100644 --- a/macos/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/macos/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1,68 +1,68 @@ { - "images" : [ + "images": [ { - "filename" : "Ghostty_256x256x32 6.png", - "idiom" : "mac", - "scale" : "1x", - "size" : "16x16" + "filename": "Ghostty_256x256x32 6.png", + "idiom": "mac", + "scale": "1x", + "size": "16x16" }, { - "filename" : "Ghostty_256x256x32 5.png", - "idiom" : "mac", - "scale" : "2x", - "size" : "16x16" + "filename": "Ghostty_256x256x32 5.png", + "idiom": "mac", + "scale": "2x", + "size": "16x16" }, { - "filename" : "Ghostty_256x256x32 4.png", - "idiom" : "mac", - "scale" : "1x", - "size" : "32x32" + "filename": "Ghostty_256x256x32 4.png", + "idiom": "mac", + "scale": "1x", + "size": "32x32" }, { - "filename" : "Ghostty_256x256x32 3.png", - "idiom" : "mac", - "scale" : "2x", - "size" : "32x32" + "filename": "Ghostty_256x256x32 3.png", + "idiom": "mac", + "scale": "2x", + "size": "32x32" }, { - "filename" : "Ghostty_256x256x32 2.png", - "idiom" : "mac", - "scale" : "1x", - "size" : "128x128" + "filename": "Ghostty_256x256x32 2.png", + "idiom": "mac", + "scale": "1x", + "size": "128x128" }, { - "filename" : "Ghostty_256x256x32 1.png", - "idiom" : "mac", - "scale" : "2x", - "size" : "128x128" + "filename": "Ghostty_256x256x32 1.png", + "idiom": "mac", + "scale": "2x", + "size": "128x128" }, { - "filename" : "Ghostty_256x256x32.png", - "idiom" : "mac", - "scale" : "1x", - "size" : "256x256" + "filename": "Ghostty_256x256x32.png", + "idiom": "mac", + "scale": "1x", + "size": "256x256" }, { - "filename" : "Ghostty_512x512x32.png", - "idiom" : "mac", - "scale" : "2x", - "size" : "256x256" + "filename": "Ghostty_512x512x32.png", + "idiom": "mac", + "scale": "2x", + "size": "256x256" }, { - "filename" : "Ghostty_512x512x32 1.png", - "idiom" : "mac", - "scale" : "1x", - "size" : "512x512" + "filename": "Ghostty_512x512x32 1.png", + "idiom": "mac", + "scale": "1x", + "size": "512x512" }, { - "filename" : "Ghostty_512x512x32 2.png", - "idiom" : "mac", - "scale" : "2x", - "size" : "512x512" + "filename": "Ghostty_512x512x32 2.png", + "idiom": "mac", + "scale": "2x", + "size": "512x512" } ], - "info" : { - "author" : "xcode", - "version" : 1 + "info": { + "author": "xcode", + "version": 1 } } diff --git a/macos/Assets.xcassets/AppIconImage.imageset/Contents.json b/macos/Assets.xcassets/AppIconImage.imageset/Contents.json index 8a7f27f4f..6891b1c3a 100644 --- a/macos/Assets.xcassets/AppIconImage.imageset/Contents.json +++ b/macos/Assets.xcassets/AppIconImage.imageset/Contents.json @@ -1,23 +1,23 @@ { - "images" : [ + "images": [ { - "filename" : "199110421-9ff5fc30-a244-441e-9882-26070662adf9.png", - "idiom" : "universal", - "scale" : "1x" + "filename": "199110421-9ff5fc30-a244-441e-9882-26070662adf9.png", + "idiom": "universal", + "scale": "1x" }, { - "filename" : "199110421-9ff5fc30-a244-441e-9882-26070662adf9 1.png", - "idiom" : "universal", - "scale" : "2x" + "filename": "199110421-9ff5fc30-a244-441e-9882-26070662adf9 1.png", + "idiom": "universal", + "scale": "2x" }, { - "filename" : "199110421-9ff5fc30-a244-441e-9882-26070662adf9 2.png", - "idiom" : "universal", - "scale" : "3x" + "filename": "199110421-9ff5fc30-a244-441e-9882-26070662adf9 2.png", + "idiom": "universal", + "scale": "3x" } ], - "info" : { - "author" : "xcode", - "version" : 1 + "info": { + "author": "xcode", + "version": 1 } } diff --git a/macos/Assets.xcassets/Contents.json b/macos/Assets.xcassets/Contents.json index 73c00596a..74d6a722c 100644 --- a/macos/Assets.xcassets/Contents.json +++ b/macos/Assets.xcassets/Contents.json @@ -1,6 +1,6 @@ { - "info" : { - "author" : "xcode", - "version" : 1 + "info": { + "author": "xcode", + "version": 1 } } From 09bafd753afdb22e5ea174ea9397e147974a2073 Mon Sep 17 00:00:00 2001 From: Patrick Fong Date: Thu, 28 Sep 2023 11:06:04 -0700 Subject: [PATCH 05/10] ignore some other stuff --- .prettierignore | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .prettierignore diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..6996b274a --- /dev/null +++ b/.prettierignore @@ -0,0 +1,5 @@ +# Docs: https://prettier.io/docs/en/ignore.html +vendor/ +**/*.html +flake.lock + From 3c44c08ffde7f1b10983070a1983050810605510 Mon Sep 17 00:00:00 2001 From: Patrick Fong Date: Thu, 28 Sep 2023 11:14:31 -0700 Subject: [PATCH 06/10] add linting doc --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index cabdafe19..4f10c72b1 100644 --- a/README.md +++ b/README.md @@ -392,3 +392,13 @@ as `Console.app`. The easiest way I've found to view these is to just use the CL $ sudo log stream --level debug --predicate 'subsystem=="com.mitchellh.ghostty"' ... ``` + +### Linting + +Ghostty's docs are linted using [Prettier](https://prettier.io). There is also a CI check that will fail if the formatting is off. Therefore, if you are modifying the docs, you may want to install it locally and run this from the repo root + +``` +prettier --write . +``` + +before you commit. Or simply install one of the many Prettier extensions out there for your editor of choice. From 6bceea898b462fab7efb7f957a55ae9c4a03060a Mon Sep 17 00:00:00 2001 From: Patrick Fong Date: Thu, 28 Sep 2023 11:18:58 -0700 Subject: [PATCH 07/10] update linting doc --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4f10c72b1..623d28734 100644 --- a/README.md +++ b/README.md @@ -395,9 +395,10 @@ $ sudo log stream --level debug --predicate 'subsystem=="com.mitchellh.ghostty"' ### Linting -Ghostty's docs are linted using [Prettier](https://prettier.io). There is also a CI check that will fail if the formatting is off. Therefore, if you are modifying the docs, you may want to install it locally and run this from the repo root +Ghostty's docs and resources (not including Zig code) are linted using [Prettier](https://prettier.io) with out-of-the-box settings. A Prettier CI check will fail builds with improper formatting. Therefore, if you are modifying anything Prettier will lint, you may want to install it locally and run this from the repo root ``` +npm install -g prettier prettier --write . ``` From 4f6401e81535ca97ddc76f69ee7a90ac09458aaa Mon Sep 17 00:00:00 2001 From: Patrick Fong Date: Thu, 28 Sep 2023 11:20:48 -0700 Subject: [PATCH 08/10] update linting doc --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 623d28734..e5d379c98 100644 --- a/README.md +++ b/README.md @@ -395,11 +395,11 @@ $ sudo log stream --level debug --predicate 'subsystem=="com.mitchellh.ghostty"' ### Linting -Ghostty's docs and resources (not including Zig code) are linted using [Prettier](https://prettier.io) with out-of-the-box settings. A Prettier CI check will fail builds with improper formatting. Therefore, if you are modifying anything Prettier will lint, you may want to install it locally and run this from the repo root +Ghostty's docs and resources (not including Zig code) are linted using [Prettier](https://prettier.io) with out-of-the-box settings. A Prettier CI check will fail builds with improper formatting. Therefore, if you are modifying anything Prettier will lint, you may want to install it locally and run this from the repo root before you commit: ``` npm install -g prettier prettier --write . ``` -before you commit. Or simply install one of the many Prettier extensions out there for your editor of choice. +Or simply install one of the many Prettier extensions out there for your editor of choice. From 8eb042968c3796fd6acc0bd70d7d646eca8fb08a Mon Sep 17 00:00:00 2001 From: Patrick Fong Date: Thu, 28 Sep 2023 11:22:28 -0700 Subject: [PATCH 09/10] undo changes to vendor --- vendor/pixman/.gitlab-ci.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/vendor/pixman/.gitlab-ci.yml b/vendor/pixman/.gitlab-ci.yml index 2a7b9bcee..25c73df12 100644 --- a/vendor/pixman/.gitlab-ci.yml +++ b/vendor/pixman/.gitlab-ci.yml @@ -1,19 +1,19 @@ image: fedora:28 autotools-build: - script: - - dnf -y install dnf-plugins-core - - dnf -y groupinstall buildsys-build - - dnf -y builddep pixman - - ./autogen.sh - - make -sj4 check + script: + - dnf -y install dnf-plugins-core + - dnf -y groupinstall buildsys-build + - dnf -y builddep pixman + - ./autogen.sh + - make -sj4 check meson-build: - script: - - dnf -y install dnf-plugins-core - - dnf -y groupinstall buildsys-build - - dnf -y builddep pixman - - dnf -y install ninja-build - - python3 -m pip install meson>=0.52.1 - - meson build - - ninja -C build test + script: + - dnf -y install dnf-plugins-core + - dnf -y groupinstall buildsys-build + - dnf -y builddep pixman + - dnf -y install ninja-build + - python3 -m pip install meson>=0.52.1 + - meson build + - ninja -C build test From caf134401f44f1a33c122958c591fccd7f2ace93 Mon Sep 17 00:00:00 2001 From: Patrick Fong Date: Thu, 28 Sep 2023 11:53:31 -0700 Subject: [PATCH 10/10] don't lint macos/, undo macos/ changes --- .prettierignore | 2 + .../AccentColor.colorset/Contents.json | 10 +-- .../AppIcon.appiconset/Contents.json | 88 +++++++++---------- .../AppIconImage.imageset/Contents.json | 26 +++--- macos/Assets.xcassets/Contents.json | 6 +- 5 files changed, 67 insertions(+), 65 deletions(-) diff --git a/.prettierignore b/.prettierignore index 6996b274a..920ef4386 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,5 +1,7 @@ # Docs: https://prettier.io/docs/en/ignore.html vendor/ +# macos is managed by XCode GUI +macos/ **/*.html flake.lock diff --git a/macos/Assets.xcassets/AccentColor.colorset/Contents.json b/macos/Assets.xcassets/AccentColor.colorset/Contents.json index 0afb3cf0e..eb8789700 100644 --- a/macos/Assets.xcassets/AccentColor.colorset/Contents.json +++ b/macos/Assets.xcassets/AccentColor.colorset/Contents.json @@ -1,11 +1,11 @@ { - "colors": [ + "colors" : [ { - "idiom": "universal" + "idiom" : "universal" } ], - "info": { - "author": "xcode", - "version": 1 + "info" : { + "author" : "xcode", + "version" : 1 } } diff --git a/macos/Assets.xcassets/AppIcon.appiconset/Contents.json b/macos/Assets.xcassets/AppIcon.appiconset/Contents.json index 3bd7016fd..0425f20d1 100644 --- a/macos/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/macos/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1,68 +1,68 @@ { - "images": [ + "images" : [ { - "filename": "Ghostty_256x256x32 6.png", - "idiom": "mac", - "scale": "1x", - "size": "16x16" + "filename" : "Ghostty_256x256x32 6.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "16x16" }, { - "filename": "Ghostty_256x256x32 5.png", - "idiom": "mac", - "scale": "2x", - "size": "16x16" + "filename" : "Ghostty_256x256x32 5.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "16x16" }, { - "filename": "Ghostty_256x256x32 4.png", - "idiom": "mac", - "scale": "1x", - "size": "32x32" + "filename" : "Ghostty_256x256x32 4.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "32x32" }, { - "filename": "Ghostty_256x256x32 3.png", - "idiom": "mac", - "scale": "2x", - "size": "32x32" + "filename" : "Ghostty_256x256x32 3.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "32x32" }, { - "filename": "Ghostty_256x256x32 2.png", - "idiom": "mac", - "scale": "1x", - "size": "128x128" + "filename" : "Ghostty_256x256x32 2.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "128x128" }, { - "filename": "Ghostty_256x256x32 1.png", - "idiom": "mac", - "scale": "2x", - "size": "128x128" + "filename" : "Ghostty_256x256x32 1.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "128x128" }, { - "filename": "Ghostty_256x256x32.png", - "idiom": "mac", - "scale": "1x", - "size": "256x256" + "filename" : "Ghostty_256x256x32.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "256x256" }, { - "filename": "Ghostty_512x512x32.png", - "idiom": "mac", - "scale": "2x", - "size": "256x256" + "filename" : "Ghostty_512x512x32.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "256x256" }, { - "filename": "Ghostty_512x512x32 1.png", - "idiom": "mac", - "scale": "1x", - "size": "512x512" + "filename" : "Ghostty_512x512x32 1.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "512x512" }, { - "filename": "Ghostty_512x512x32 2.png", - "idiom": "mac", - "scale": "2x", - "size": "512x512" + "filename" : "Ghostty_512x512x32 2.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "512x512" } ], - "info": { - "author": "xcode", - "version": 1 + "info" : { + "author" : "xcode", + "version" : 1 } } diff --git a/macos/Assets.xcassets/AppIconImage.imageset/Contents.json b/macos/Assets.xcassets/AppIconImage.imageset/Contents.json index 6891b1c3a..8a7f27f4f 100644 --- a/macos/Assets.xcassets/AppIconImage.imageset/Contents.json +++ b/macos/Assets.xcassets/AppIconImage.imageset/Contents.json @@ -1,23 +1,23 @@ { - "images": [ + "images" : [ { - "filename": "199110421-9ff5fc30-a244-441e-9882-26070662adf9.png", - "idiom": "universal", - "scale": "1x" + "filename" : "199110421-9ff5fc30-a244-441e-9882-26070662adf9.png", + "idiom" : "universal", + "scale" : "1x" }, { - "filename": "199110421-9ff5fc30-a244-441e-9882-26070662adf9 1.png", - "idiom": "universal", - "scale": "2x" + "filename" : "199110421-9ff5fc30-a244-441e-9882-26070662adf9 1.png", + "idiom" : "universal", + "scale" : "2x" }, { - "filename": "199110421-9ff5fc30-a244-441e-9882-26070662adf9 2.png", - "idiom": "universal", - "scale": "3x" + "filename" : "199110421-9ff5fc30-a244-441e-9882-26070662adf9 2.png", + "idiom" : "universal", + "scale" : "3x" } ], - "info": { - "author": "xcode", - "version": 1 + "info" : { + "author" : "xcode", + "version" : 1 } } diff --git a/macos/Assets.xcassets/Contents.json b/macos/Assets.xcassets/Contents.json index 74d6a722c..73c00596a 100644 --- a/macos/Assets.xcassets/Contents.json +++ b/macos/Assets.xcassets/Contents.json @@ -1,6 +1,6 @@ { - "info": { - "author": "xcode", - "version": 1 + "info" : { + "author" : "xcode", + "version" : 1 } }