mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 01:32:19 +00:00
Keep panels, compound names and signed coordinates apart when reading a line
- "hide flights near Left Bank, Paris" closed the left panel: a side is closed only when the clause names nothing but the side. - "flights near Trinidad and Tobago" looked up Trinidad alone, and "take me to New York City NY" nothing (the command's words counted against the name): the whole place is looked up, and the limit counts its words. - "flights near 30.27, +97.74" and "30.27; -97.74" were split at the sign or semicolon; both stay coordinates. - "hide flights, show ships" listed "No layers are on": several requests in a line are read as one plan, as with "and". Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
1 parent
8dae95e4da
commit
36264005a8
3 files changed
+64
-8
No files matched your search
@@ -109,9 +109,10 @@ function panelStep(clause) {
|
||||
(/\beverything\b/.test(clause) && onlyNames(clause, /\beverything\b/))
|
||||
)
|
||||
return { kind: 'panel', action: 'close', side: 'all' };
|
||||
if (/\bleft\b/.test(clause))
|
||||
// "hide the left panel", never "hide flights near Left Bank".
|
||||
if (/\bleft\b/.test(clause) && onlyNames(clause, /\b(left|side)\b/g))
|
||||
return { kind: 'panel', action: 'close', side: 'left' };
|
||||
if (/\bright\b/.test(clause))
|
||||
if (/\bright\b/.test(clause) && onlyNames(clause, /\b(right|side)\b/g))
|
||||
return { kind: 'panel', action: 'close', side: 'right' };
|
||||
for (const [pattern, side, item, name] of PANEL_NAMES)
|
||||
if (pattern.test(clause) && /panel/.test(clause))
|
||||
@@ -359,7 +360,7 @@ const GO_TAIL =
|
||||
|
||||
/** Clause separators; "black and white" is joined first so it survives. */
|
||||
const SEPARATORS =
|
||||
/(\s*(?:,|;|\+|&|\band then\b|\bthen\b|\band\b|\balso\b)\s*)/;
|
||||
/(\s*(?:,|;(?!\s*[-+]?\d)|\+(?!\d)|&|\band then\b|\bthen\b|\band\b|\balso\b)\s*)/;
|
||||
|
||||
function tidy(text) {
|
||||
return text.replace(/\s+/g, ' ').trim();
|
||||
|
||||
Reference in new issue
Block a user