diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 72d570a..aa7d517 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -329,6 +329,32 @@ jobs: # half-written target directory into the next release. cache-on-failure: false + # The bundler's own tools: NSIS, nsis_tauri_utils.dll and WiX on Windows, linuxdeploy, + # its plugins and AppRun on Linux. tauri-bundler downloads each from GitHub into + # `/tauri` and skips any that is already there, so restoring that directory + # takes GitHub out of the bundle step. v1.11.5's first attempt lost both x86_64 legs to + # it: a 504 on nsis_tauri_utils.dll, and linuxdeploy failing after a download in the + # same two minutes - with the binaries already built and every other leg green. + # + # Keyed on the exact @tauri-apps/cli version, which is what decides the tool versions. + # No `restore-keys`: the bundler only checks that a tool's folder exists, not which + # version is in it, so a cache from an older CLI would bundle with its old NSIS without + # a word. A new CLI version is one cold download per leg, then cached again. + - name: Read the Tauri CLI version + id: tauri_cli + shell: bash + run: | + echo "version=$(node -p "require('./package-lock.json').packages['node_modules/@tauri-apps/cli'].version")" >> "$GITHUB_OUTPUT" + + - name: Cache Tauri bundler tools + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: | + ~/.cache/tauri + ~/Library/Caches/tauri + ~/AppData/Local/tauri + key: tauri-tools-${{ matrix.cache_key }}-cli-${{ steps.tauri_cli.outputs.version }} + # Same widening as above, and it matters more here: skipping this step does not fail # the leg, it fails the build twenty minutes later with a missing webkit2gtk. - name: install dependencies (ubuntu only) @@ -459,7 +485,10 @@ jobs: printf '%s\n' "$delim" } >> "$GITHUB_ENV" - - uses: tauri-apps/tauri-action@1deb371b0cd8bd54025b384f1cd735e725c4060f # action-v1.0.0 + # Allowed to fail once - see "Build, second attempt" below. + - id: build + continue-on-error: true + uses: tauri-apps/tauri-action@1deb371b0cd8bd54025b384f1cd735e725c4060f # action-v1.0.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -506,6 +535,36 @@ jobs: args: ${{ matrix.args }} + # One retry, for the network rather than the code. A leg that fails here costs the whole + # release - `cleanup` deletes the draft - and the failures seen so far were GitHub + # answering 504 to a download in the middle of bundling, after a clean compile. The + # second attempt reuses the compiled target directory, so it only re-bundles: about a + # minute, against twenty for a re-run of the release. A real build error fails both + # attempts the same way and the leg still goes red. + # + # Safe after a partial first attempt: tauri-action deletes an asset of the same name + # before uploading it again, and latest.json is rewritten whole. The inputs must stay + # identical to the step above. + - name: Wait before the second attempt + if: steps.build.outcome == 'failure' + shell: bash + run: | + echo "::warning::The first build attempt failed; retrying once in 60 seconds." + sleep 60 + + - name: Build, second attempt + if: steps.build.outcome == 'failure' + uses: tauri-apps/tauri-action@1deb371b0cd8bd54025b384f1cd735e725c4060f # action-v1.0.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + releaseId: ${{ needs.draft.outputs.release_id }} + releaseBody: ${{ env.RELEASE_BODY }} + uploadUpdaterJson: true + releaseDraft: true + prerelease: ${{ needs.prepare.outputs.prerelease }} + args: ${{ matrix.args }} + # The signing keys went into $GITHUB_ENV above, conditionally, because an exported # empty value makes the bundler try to sign with nothing and fail - so they cannot # simply be scoped to the tauri-action step with `env:`. That leaves them visible to diff --git a/CHANGELOG.md b/CHANGELOG.md index 2eccd69..4a1a981 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,15 @@ popover, not for the person who wrote the commit. ## [Unreleased] +## [1.11.6] - 2026-11-05 + +### Fixed + +- **The list and heading shortcuts work on an empty line again.** Pressing Ctrl+Shift+8, + Ctrl+Shift+7 or Ctrl+Alt+3 (Cmd on macOS) on an empty line did nothing, so you had to type + something first and add the marker afterwards. They now start the bullet, numbered item or + heading right there, with the cursor after the marker + ## [1.11.5] - 2026-11-05 ### Fixed diff --git a/package.json b/package.json index 5ab999a..48f20f9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "stashpad", - "version": "1.11.5", + "version": "1.11.6", "description": "The staging area for your AI context.", "author": { "name": "Nico Wiedemann", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 466d8b4..a427db6 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -5557,7 +5557,7 @@ checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] name = "stashpad" -version = "1.11.5" +version = "1.11.6" dependencies = [ "active-win-pos-rs", "aes-gcm", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 50cd097..13ba185 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "stashpad" -version = "1.11.5" +version = "1.11.6" description = "The staging area for your AI context." authors = ["Nico Wiedemann "] repository = "https://github.com/EarMaster/stashpad" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index f93ad44..f24213b 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "../node_modules/@tauri-apps/cli/config.schema.json", "productName": "stashpad", - "version": "1.11.5", + "version": "1.11.6", "identifier": "org.stashpad", "build": { "frontendDist": "../dist", diff --git a/src/lib/utils/__tests__/markdown-format.test.ts b/src/lib/utils/__tests__/markdown-format.test.ts index 93a2ff5..cd3aa8d 100644 --- a/src/lib/utils/__tests__/markdown-format.test.ts +++ b/src/lib/utils/__tests__/markdown-format.test.ts @@ -180,6 +180,19 @@ describe('applyLinePrefix', () => { expect(result.content).toBe('- one\n\n- two'); }); + it('starts an item on an empty line, with the caret after the marker', () => { + // Treating the line like any other blank one made the shortcut do nothing there, + // which is exactly where a list is usually started. + expect(marked(applyLinePrefix('one\n\ntwo', 4, 4, '- '))).toBe('one\n- ||\ntwo'); + expect(marked(applyLinePrefix('', 0, 0, '1. '))).toBe('1. ||'); + expect(marked(applyLinePrefix('one\n ', 6, 6, '### '))).toBe('one\n### ||'); + }); + + it('toggles an item just started on an empty line back off', () => { + expect(applyLinePrefix('- ', 2, 2, '- ').content).toBe(''); + expect(applyLinePrefix('1. ', 3, 3, '1. ').content).toBe(''); + }); + it('toggles off even when the selection contains a blank line', () => { // Counting the blank line as "not prefixed" meant a selection like this never // read as fully prefixed, so it kept adding instead of removing. diff --git a/src/lib/utils/markdown-format.ts b/src/lib/utils/markdown-format.ts index 5f17d5d..5baa94e 100644 --- a/src/lib/utils/markdown-format.ts +++ b/src/lib/utils/markdown-format.ts @@ -205,6 +205,19 @@ export function applyLinePrefix( // bare `###`, and counting it would stop a mixed selection ever reading as "all // prefixed" and so make the button impossible to toggle off. const filled = lines.filter((line) => line.trim()); + + // An empty line on its own is the one place an empty item is wanted: it is how a list + // or heading is started before anything is typed. Skipping it like any other blank line + // made the shortcut do nothing there. + if (filled.length === 0 && lines.length === 1) { + const caret = lineStart + prefix.length; + return { + content: content.slice(0, lineStart) + prefix + content.slice(lineEnd), + selectionStart: caret, + selectionEnd: caret, + }; + } + const allPrefixed = filled.length > 0 && filled.every(has); let counter = 0;