Read a spaced filter condition as one condition, and clear the box from one x - #21
Merged
Merged
Conversation
A space split the label, so `Data Type:double` parsed as the bare word `Data` ANDed with `Type:double` — a stray condition the user never typed, with a chip that looked correct. The tokenizer now recognizes a header label containing a space when an operator follows it, so the prefix can be typed the way the header spells it. Quoting it still works, and the same words with no operator after them are still two words to search for.
`data type: double` split on whitespace into `data`, `type:` and `double`, so the query silently ANDed two words the user never meant to search for onto a condition that had lost its value. `Value > 5` had the same fault. Whitespace inside a condition is now insignificant: one scanner reads <column> <op> <value> across the seams, and a condition's chip spans the whole thing so its `x` removes every part of it. This only applies once the prefix resolves to a real column of the table, which is what keeps `a > b` and `Name gain` ordinary text. The cost, pinned in a test: `Unit= abc` now means Unit equals abc rather than "no Unit, and abc somewhere". Asking for empty cells still works -- leave nothing after the operator.
Escape clears the box, but only for someone who knows that; with a mouse, emptying a search meant removing each chip in turn. A x at the right end of the bar now drops the applied filter and whatever was half-typed in one press, and hands focus back to the input so the next search can just be typed. It is absent while the box is empty -- a x with nothing to clear sits exactly where the eye looks for one that does something. Clearing a pending tail alone proposes nothing, so "abandon what I was typing" stays a local edit no consumer hears about, the way Escape's first press already worked.
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.
Four follow-ups to the filter-chip work in #20, all in the search box.
A condition that contains whitespace is one condition. The tokenizer split on whitespace before it looked for an operator, so a condition written the way a person writes one fragmented:
Data Type:doubleDataANDType:doubleData Typeconditiondata type: doubleData Type:(empty) AND baredoubleData TypeconditionValue > 5Value > 5conditionOne scanner now reads
<column> <op> <value>across the seams, and the token's span covers the whole condition, so its chip'sxremoves every part of it. This engages only once the prefix resolves to a real column of that table, which is what keepsa > bandName gainordinary text; a following condition is never swallowed as a value, soUnit= Value>5still parses as two.The cost, pinned in a test:
Unit= abcnow means Unit equals abc rather than "no Unit, and abc somewhere". Asking for empty cells still works -- leave nothing after the operator.A clear-all
xat the right end of the box. Escape already cleared the box, but only for someone who knows that; with a mouse, emptying a search meant removing each chip in turn. One press drops the applied filter and whatever was half-typed, and hands focus back to the input. It is absent while the box is empty, and clearing a pending tail alone proposes nothing -- abandoning a half-typed word stays a local edit, as Escape's first press already worked.Styling. Smaller chip and bar border radius, tighter bar padding.
There are now two code paths that can read a condition (the scanner, and the per-chunk one that still handles a quoted prefix like
"Data Type":double). A test pins the invariant between them:Data Type=double,Data Type = double,Data Type =doubleand"Data Type"=doubleall parse to the same column, operator and value.Testing
npm run typecheckclean;npm test2476 tests / 140 files pass (16 new, intest/rowFilter.test.tsandtest/filterBar.test.ts);npm run buildandnpm run build:webclean.dist/webview/table.jsin Chromium: each row of the table above verified as chips + filtered rows +<mark>highlighting, plusData Type: "fixed point", the legacyValue: > 5, and the clear-all button through all four of its states. Thexwas checked under emulated forced-colors, where it renders in the system text colour.