Repository navigation
feat(tools): type ? for examples, and fix copied text from the launcher - #68
Merged
Merged
Conversation
upper, lower, title, plain, one line and count as plain functions: text in, text or a count out, no Electron and no clipboard. Refuses blank input, input over 200,000 characters and unknown fixers instead of throwing. Title Case treats an apostrophe and a combining accent as inside a word. plain turns no-break spaces into spaces, drops zero-width characters and trims trailing whitespace on each line. count does not treat a trailing line break as one more line.
plain stripped trailing spaces with a regex that looked ahead for the line end. Inside one long run of spaces that rescans the run from every position, so 80,000 spaces took about 16 seconds, and a fixer runs in the main process, where that freezes the pet, the tray and every timer. It now trims line by line with trimEnd. A test runs every fixer on the largest allowed input, shaped as the worst case for a backtracking regex, and fails past 1.5 seconds.
Every tool in the launcher was a typed command you had to read the docs to learn. Typing ? or help now lists an example of each. Enter on an example puts its start in the box (a new fill action that main answers with a fixed string and that runs nothing), and a command word followed by a space shows that command's example while you type the rest. The empty list ends with What can I type?. upper, lower, title, plain, one line and count are wired in as launcher commands; text lists all six. Main reads the clipboard only when one is run. The row is a label, not a preview, the pet never repeats the text, and the write is flagged as ours so clipboard history does not record it. Help and the fixers match on whole-word starts only. Their long titles let the scattered-letter matcher swallow ordinary searches: weather fits inside lowercase the copied text. 39 new sentences in each of the eight languages, and a text icon.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
CI for d237a89: all jobs passed
Tests: 501 passed, 0 failed, 0 skipped, 501 total. This comment updates itself on every push. Full run. |
…ity fixes A help example was one weight, so todo call the dentist did not say which word is the command. Main now sends how many leading characters are the command and the launcher sets them in mono at full strength, with the words that are yours quieter. The launcher still decides nothing by reading a title: it gets a length. - Section headers, the footer and placeholders used a grey that measured 3.86:1 on the dark panel and 2.97:1 on the light one. Now 5.33:1 and 4.88:1. - A row with nothing to run (the todo hint, a bad sum) was drawn as selected. It is now a plain hint with an outlined tile. - The text icon had no colour of its own.
This branch was successfully deployed
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
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.
What this does
Two additions to Quick Tools, aimed at people who will never read the docs.
Type
?to see what you can type. Every tool in the launcher is a typed command, so none of them is visible until you already know it.?(orhelp, or "What can I type?" at the bottom of the empty list) shows an example of each tool. Enter on an example puts its start in the box (todo,10m,g) for you to finish. A command word followed by a space shows that command's example while you type the rest.Fix the text you just copied.
upper,lower,title,plain,one line,count. Typingtextlists all six.plainone lineupper,lower,titlecountAll eight languages.
How it stays inside the launcher's rules
fillis a new action type that runs nothing. Main answerslauncher:runwith a fixed string from its own table; the launcher still sends only a query and an index.src/tools/textfix.jsis pure: no Electron, no clipboard.Found while verifying
weatherfits inside "lowercase the copied text". Help and the fixers now match on whole-word starts only. Compared againstmainon about 35 queries;weather,news,hello,excelfall back to search again.plain(second commit). 80,000 spaces took about 16 seconds in the main process. Now linear, with a test that runs every fixer on the largest allowed input.countdoes not count a trailing line break as a line.Test plan
npm test: 496 pass, 0 fail, 4 skipped (the POSIX-only iPad terminal tests, skipped on Windows)npx eslint .cleannpm run test:bootOKlauncher.html, renderer, icons and router driven in a throwaway Electron window (English, Japanese, Hindi):?lists 8 rows with icons, Enter on the to-do row fillstodoand shows its example,textlists the 6 fixers,upper+ Enter produces{ type: 'textfix', op: 'upper' }, no console errorsplainon text copied from a web page into Word or Mail. The harness stubs the OS side, so the real clipboard round trip has unit tests with a stubbed clipboard but no live run.Notes for review
title,count,lineandtexttyped alone now find a fixer first instead of offering a web search.g titlestill searches.