From e4310619ea838dec3bf51f0ffc83686c1c0f2a05 Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 1 Feb 2017 21:48:03 +0100 Subject: [PATCH 01/11] Fixed urb.util.isURL to allow multiple successive hyphens in URLs. --- web/lib/js/urb.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/lib/js/urb.js b/web/lib/js/urb.js index 5cba26ac94..9631e0996d 100644 --- a/web/lib/js/urb.js +++ b/web/lib/js/urb.js @@ -284,7 +284,7 @@ window.urb.unsubscribe = function(params,cb) { // legacy intreface window.urb.util = { isURL: function(s) { - r = new RegExp('^(?!mailto:)(?:(?:http|https|ftp)://)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$', 'i'); + r = new RegExp('^(?!mailto:)(?:(?:http|https|ftp)://)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$', 'i'); return s.length < 2083 && r.test(s); }, numDot: function(n) { From 08d1e49c8a7292768b82ccd20a9f69806288bca5 Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Mon, 13 Feb 2017 16:44:49 -0800 Subject: [PATCH 02/11] fix up remaining marks --- lib/httr-to-json.hoon | 2 +- mar/talk/command.hoon | 3 +- mar/talk/telegrams.hoon | 65 ++++++++++++++++++----------------------- mar/twit/feed.hoon | 1 + mar/write/tree.hoon | 6 ++-- 5 files changed, 34 insertions(+), 43 deletions(-) diff --git a/lib/httr-to-json.hoon b/lib/httr-to-json.hoon index d3d8ab05a7..9bc8e6cd23 100644 --- a/lib/httr-to-json.hoon +++ b/lib/httr-to-json.hoon @@ -1,4 +1,4 @@ /+ old-zuse =, old-zuse -=, format +=, html |=(hit/httr ~|(hit ?>(?=($2 (div p.hit 100)) (need (de-json q:(need r.hit)))))) diff --git a/mar/talk/command.hoon b/mar/talk/command.hoon index 700fe3b960..9265fe5edb 100644 --- a/mar/talk/command.hoon +++ b/mar/talk/command.hoon @@ -26,8 +26,9 @@ %+ cu malt %+ ci |= a/(map cord _(need *wit)) + =, unity ^- (unit (list _[(wonk *fel) (need *wit)])) - (zl (turn (~(tap by a)) (head-rush fel))) + (drop-list (turn (~(tap by a)) (head-rush fel))) (om wit) :: ++ ke :: callbacks diff --git a/mar/talk/telegrams.hoon b/mar/talk/telegrams.hoon index a5e1e4dc64..75b4c41393 100644 --- a/mar/talk/telegrams.hoon +++ b/mar/talk/telegrams.hoon @@ -3,7 +3,7 @@ :: /? 310 /- talk -/+ talk,map-to-json, old-zuse +/+ talk, map-to-json, old-zuse :: =, talk =, mimes:html @@ -17,46 +17,37 @@ ++ noun (list telegram) ++ mime |=(^mime (json (rash q.q apex:de-json))) ++ json - => [jo ..telegram] + => [dejs talk old-zuse] |= a/json ^- (list telegram) - =- (need ((ar (ot ship+(su fed:ag) thought+thot ~)) a)) - |% - ++ of - |* a/(pole {@tas fist}) - |= b/json - %. ((of:jo a) b) - %- slog - ?+ b ~ - {$o *} - %+ murn `(list {@tas fist})`a - |= {c/term d/fist} ^- (unit tank) - =+ (~(get by p.b) c) - ?~ - ~ - =+ (d u) - ?~ - (some >[c u]<) - ~ - == - ++ op :: parse keys of map - |* {fel/rule wit/fist} - %+ cu malt - %+ ci - |= a/(map cord _(need *wit)) - ^- (unit (list _[(wonk *fel) (need *wit)])) - (zl (turn (~(tap by a)) (head-rush fel))) - (om wit) + %. a + |^ (ar (ot ship+(su fed:ag) thought+thot ~)) +:: ++ of +:: |* a/(pole {@tas fist}) +:: |= b/json +:: %. ((of:jo a) b) +:: %- slog +:: ?+ b ~ +:: {$o *} +:: %+ murn `(list {@tas fist})`a +:: |= {c/term d/fist} ^- (unit tank) +:: =+ (~(get by p.b) c) +:: ?~ - ~ +:: =+ (d u) +:: ?~ - (some >[c u]<) +:: ~ +:: == :: ++ as :: array as set |* a/fist - (cu ~(gas in *(set _(need *a))) (ar a)) + (cu ~(gas in *(set _*a)) (ar a)) :: ++ ke :: callbacks |* {gar/* sef/_|.(fist)} |= jon/json - ^- (unit _gar) + ^+ gar =- ~! gar ~! (need -) - ((sef) jon) :: - ++ lake |*(a/_* $-(json (unit a))) ++ head-rush |* a/rule |* {cord *} @@ -65,17 +56,17 @@ (some [u.nit +>->]) :: ++ thot - ^- $-(json (unit thought)) + ^- $-(json thought) %- ot :~ - serial+`$-(json (unit serial))`(ci (slat %uv) so) - audience+`$-(json (unit audience))`audi - statement+`$-(json (unit statement))`stam + serial+`$-(json serial)`(ci (slat %uv) so) + audience+`$-(json audience)`audi + statement+`$-(json statement)`stam == :: - ++ audi `$-(json (unit audience))`(op parn memb) + ++ audi `$-(json audience)`(op parn memb) ++ auri (op parn (ci (soft presence) so)) - ++ memb ^- $-(json (unit (pair envelope delivery))) - (ot envelope+lope delivery+(ci (soft delivery) so) ~) + ++ memb ^- $-(json (pair envelope delivery)) + (ot envelope+lope delivery+(cu (hard delivery) so) ~) ++ lope (ot visible+bo sender+(mu (su parn)) ~) :: ++ parn diff --git a/mar/twit/feed.hoon b/mar/twit/feed.hoon index a3e2f99449..a2c5edf27a 100644 --- a/mar/twit/feed.hoon +++ b/mar/twit/feed.hoon @@ -5,6 +5,7 @@ /- talk /+ twitter, httr-to-json, old-zuse =, old-zuse +=, format |_ fed/(list post:twitter) ++ grab |% diff --git a/mar/write/tree.hoon b/mar/write/tree.hoon index bdf819fe37..3de086e86e 100644 --- a/mar/write/tree.hoon +++ b/mar/write/tree.hoon @@ -2,16 +2,14 @@ :::: /hoon/tree/write/mar :: /? 310 -/+ old-zuse :: =, mimes:html -=, old-zuse +=, format |_ {sup/spur mim/mime} ++ grab |% ++ noun {spur mime} ++ json - %+ corl need :: XX {pax, mite, octs} - =>(jo (ot sup+(su fel:stab) mime+(cu |=(a/@t [/ (as-octs a)]) so) ~)) + =,(dejs (ot sup+(su fel:stab) mime+(cu |=(a/@t [/ (as-octs a)]) so) ~)) -- -- From 36300e8a1e49e9da1a073dab993b1f70b48f6618 Mon Sep 17 00:00:00 2001 From: Elliot Glaysher Date: Mon, 20 Feb 2017 13:41:53 -0800 Subject: [PATCH 03/11] Fix +help by specifying namespaces. --- gen/help.hoon | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gen/help.hoon b/gen/help.hoon index da4964f1a1..3d34afd95f 100644 --- a/gen/help.hoon +++ b/gen/help.hoon @@ -1,5 +1,5 @@ :: Describe available comands: +help, +help %tree, +help %hood -:: +:: :::: /hoon/help/gen :: /? 310 @@ -25,7 +25,7 @@ {$hood ^} "|{(path-heps t.b)}" ^ "+{(path-heps b)}" :: XX deal with :talk|foo == - =/ c (to-wain a) + =/ c (to-wain:format a) ?~ c "~" ?. =(':: ' (end 3 4 i.c)) "" @@ -35,9 +35,9 @@ |= {len/@u pax/path} |= {nam/@t ark/arch} ^- (unit {@t path}) ?. (~(has by dir.ark) %hoon) ~ - %+ bind (file (welp pax /[nam]/hoon)) + %+ bind (file:space:userlib (welp pax /[nam]/hoon)) |= a/* ^- {cord path} - [;;(@t a) (welp (slag len pax) /[nam])] + [;;(@t a) (welp (slag len pax) /[nam])] -- :: :- %say From 23966fe45b13a6e019a8667e6f84a31178d59dba Mon Sep 17 00:00:00 2001 From: Joseph Bryan Date: Sun, 26 Feb 2017 23:39:21 -0500 Subject: [PATCH 04/11] switches drum to a sticky prompt, scrolling input only --- lib/drum.hoon | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/drum.hoon b/lib/drum.hoon index 098c2c7074..d71ef9d36e 100644 --- a/lib/drum.hoon +++ b/lib/drum.hoon @@ -401,10 +401,14 @@ +>(mir lin) :: ++ se-just :: adjusted buffer - |= lin/(pair @ud stub:dill) + |= {pom/stub:dill lin/(pair @ud (list @c))} ^+ +> - =. off ?:((lth p.lin edg) 0 (sub p.lin edg)) - (se-show (sub p.lin off) (scag:klr edg (slag:klr off q.lin))) + =/ pol (lent-char:klr pom) + =/ end (sub edg pol) + =. off ?:((lte p.lin end) 0 (sub p.lin end)) + %+ se-show + (sub (add pol p.lin) off) + (welp pom [*stye:dill (swag [off end] q.lin)]~) :: ++ se-view :: flush buffer ^+ . @@ -826,11 +830,9 @@ (ta-hom (cat:edit pos.inp txt)) :: ++ ta-vew :: computed prompt - ^- (pair @ud stub:dill) + ^- {pom/stub:dill lin/(pair @ud (list @c))} =; vew/(pair (list @c) styx:dill) - =+ lin=(make:klr q.vew) - :_ (welp lin [*stye:dill p.vew]~) - (add pos.inp (lent-char:klr lin)) + [(make:klr q.vew) pos.inp p.vew] ?: vis.pom :- buf.say.inp :: default prompt ?~ ris From 4363b76957151a1515dcc1b9e035476bf3939398 Mon Sep 17 00:00:00 2001 From: Joseph Bryan Date: Mon, 27 Feb 2017 23:59:13 -0500 Subject: [PATCH 05/11] updates drum input scroller to be sticky --- lib/drum.hoon | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/drum.hoon b/lib/drum.hoon index d71ef9d36e..32361fcdf3 100644 --- a/lib/drum.hoon +++ b/lib/drum.hoon @@ -405,7 +405,11 @@ ^+ +> =/ pol (lent-char:klr pom) =/ end (sub edg pol) - =. off ?:((lte p.lin end) 0 (sub p.lin end)) + =. off ?: (gth p.lin (add end off)) + (sub p.lin end) + ?: (lth p.lin off) + (min p.lin (dec off)) + off %+ se-show (sub (add pol p.lin) off) (welp pom [*stye:dill (swag [off end] q.lin)]~) From da3ccfa23874e7d23f406e86b7e93c7ac60f6b4d Mon Sep 17 00:00:00 2001 From: Joseph Bryan Date: Tue, 28 Feb 2017 15:51:39 -0500 Subject: [PATCH 06/11] resets drum input offset on sole-edit discontinuities ($set) and renames ++ta-off -> ++ta-pos --- lib/drum.hoon | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/lib/drum.hoon b/lib/drum.hoon index 32361fcdf3..9345e7a395 100644 --- a/lib/drum.hoon +++ b/lib/drum.hoon @@ -570,7 +570,7 @@ $v ta-bel $w ?: =(0 pos.inp) ta-bel - =+ sop=(ta-off %l %ace pos.inp) + =+ sop=(ta-pos %l %ace pos.inp) (ta-kil %l [(sub pos.inp sop) sop]) $x +>(..ta se-anon) $y ?: =(0 num.kil) @@ -632,22 +632,31 @@ == == :: + ++ ta-off :: reset buffer offset + |= ted/sole-edit + =. off ?: |- ?. ?=({$mor *} ted) + ?=({$set *} ted) + |- ?~(p.ted | |(^$(ted i.p.ted) $(p.ted t.p.ted))) + 0 + off + +> + :: ++ ta-got :: apply change |= cal/sole-change =^ ted say.inp (~(receive sole say.inp) cal) - (ta-dog ted) + (ta-dog:(ta-off ted.cal) ted) :: ++ ta-hom :: local edit |= ted/sole-edit ^+ +> - =. +> (ta-det ted) + =. +> (ta-det:(ta-off ted) ted) (ta-dog(say.inp (~(commit sole say.inp) ted)) ted) :: ++ ta-jump :: buffer pos |= {dir/?($l $r) til/?($ace $edg $wrd) pos/@ud} ^- @ud %- ?:(?=($l dir) sub add) - [pos (ta-off dir til pos)] + [pos (ta-pos dir til pos)] :: ++ ta-kil :: kill selection |= {dir/?($l $r) sel/{@ @}} @@ -688,7 +697,7 @@ :: $bac ?: =(0 pos.inp) :: kill left-word ta-bel - =+ sop=(ta-off %l %edg pos.inp) + =+ sop=(ta-pos %l %edg pos.inp) (ta-kil %l [(sub pos.inp sop) sop]) :: $b ?: =(0 pos.inp) :: jump left-word @@ -705,7 +714,7 @@ :: $d ?: =(pos.inp (lent buf.say.inp)) :: kill right-word ta-bel - (ta-kil %r [pos.inp (ta-off %r %edg pos.inp)]) + (ta-kil %r [pos.inp (ta-pos %r %edg pos.inp)]) :: $f ?: =(pos.inp (lent buf.say.inp)) :: jump right-word ta-bel @@ -722,7 +731,7 @@ ?: =(b c) ta-bel =+ next=[b (sub a b)] - =+ prev=[c (ta-off %r %edg c)] + =+ prev=[c (ta-pos %r %edg c)] %- ta-hom(pos.inp a) :~ %mor (rep:edit next (swag prev buf.say.inp)) @@ -734,7 +743,7 @@ ta-bel =+ case=?:(?=($u key) cuss cass) =+ sop=(ta-jump %r %wrd pos.inp) - =+ sel=[sop (ta-off %r %edg sop)] + =+ sel=[sop (ta-pos %r %edg sop)] %- ta-hom %+ rep:edit sel ^- (list @c) ^- (list @) :: XX unicode @@ -777,7 +786,7 @@ old.hit [buf.say.inp old.hit] == :: - ++ ta-off :: buffer pos offset + ++ ta-pos :: buffer pos offset |= {dir/?($l $r) til/?($ace $edg $wrd) pos/@ud} ^- @ud %- ?- til $ace ace:offset From 880c11f0559555d90c0c9bf97a903608c4d500ac Mon Sep 17 00:00:00 2001 From: Joseph Bryan Date: Wed, 1 Mar 2017 16:03:41 -0500 Subject: [PATCH 07/11] resets drum input offset on ctrl-x --- lib/drum.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/drum.hoon b/lib/drum.hoon index 9345e7a395..898f326fe1 100644 --- a/lib/drum.hoon +++ b/lib/drum.hoon @@ -302,7 +302,7 @@ =+ wag=se-amor ?~ wag + :: ~& [%se-anon inx+inx wag+wag nex+(mod +(inx) (lent se-amor))] - +(inx (mod +(inx) (lent wag))) + +(off 0, inx (mod +(inx) (lent wag))) :: ++ se-agon :: current gill ^- (unit gill:gall) From 3e321a55678e681b48280bc977d75fbb9b4fbf1e Mon Sep 17 00:00:00 2001 From: Joseph Bryan Date: Sun, 26 Feb 2017 23:44:33 -0500 Subject: [PATCH 08/11] adds back the old-style prompt truncation for really long prompts --- lib/drum.hoon | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/drum.hoon b/lib/drum.hoon index 898f326fe1..d5e6174175 100644 --- a/lib/drum.hoon +++ b/lib/drum.hoon @@ -405,13 +405,19 @@ ^+ +> =/ pol (lent-char:klr pom) =/ end (sub edg pol) + =/ pos (add pol p.lin) + ?: (gte (div (mul pol 100) edg) 35) :: old style (long prompt) + =/ off ?:((lte p.lin end) 0 (sub p.lin end)) + %+ se-show + (sub pos off) + (swag:klr [off edg] (welp pom [*stye:dill q.lin]~)) =. off ?: (gth p.lin (add end off)) (sub p.lin end) ?: (lth p.lin off) (min p.lin (dec off)) off %+ se-show - (sub (add pol p.lin) off) + (sub pos off) (welp pom [*stye:dill (swag [off end] q.lin)]~) :: ++ se-view :: flush buffer @@ -1010,5 +1016,9 @@ =+ n=(snag p.u.i b) :_ ~ :- p.n (^scag (sub (snag p.u.i c) (sub q.u.i a)) q.n) + :: + ++ swag :: swag stub, keep stye + |= {{a/@ b/@} c/stub} + (scag b (slag a c)) -- -- From f8b60ec802f0652af3cfa27413ee9ab6b820056c Mon Sep 17 00:00:00 2001 From: Joseph Bryan Date: Fri, 3 Mar 2017 15:27:32 -0500 Subject: [PATCH 09/11] refactors ++ta-off in drum --- lib/drum.hoon | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/drum.hoon b/lib/drum.hoon index d5e6174175..9a449748ee 100644 --- a/lib/drum.hoon +++ b/lib/drum.hoon @@ -640,11 +640,7 @@ :: ++ ta-off :: reset buffer offset |= ted/sole-edit - =. off ?: |- ?. ?=({$mor *} ted) - ?=({$set *} ted) - |- ?~(p.ted | |(^$(ted i.p.ted) $(p.ted t.p.ted))) - 0 - off + =? off (any:edit ted |=(a/sole-edit ?=($set -.a))) 0 +> :: ++ ta-got :: apply change @@ -891,6 +887,11 @@ (cut pos num) (cat pos txt) == + ++ any :: matches? + |= {a/sole-edit b/$-(sole-edit ?)} + ^- ? + ?. ?=($mor -.a) (b a) + (lien p.a |=(c/sole-edit ^$(a c))) -- ++ offset :: calculate offsets |% From 3d3d4d24380c4799d185abdb2d9bae4ce6059837 Mon Sep 17 00:00:00 2001 From: Joseph Bryan Date: Fri, 3 Mar 2017 21:33:41 -0500 Subject: [PATCH 10/11] prevents unsafe $cork (|^) expansion in the parser --- sys/hoon.hoon | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sys/hoon.hoon b/sys/hoon.hoon index 48c7ab6415..83134d39c6 100644 --- a/sys/hoon.hoon +++ b/sys/hoon.hoon @@ -8954,7 +8954,7 @@ ['.' (rune dot %trap expa)] ['/' (rune fas %door expr)] ['-' (rune hep %loop expa)] - ['^' (rune ket %cork expr)] + ['^' (rune ket %cork expx)] ['~' (rune sig %port expb)] ['*' (rune tar %gill expb)] ['=' (rune tis %gate expb)] @@ -9008,7 +9008,7 @@ (word %trap expa) (word %door expr) (word %loop expa) - (word %cork expr) + (word %cork expx) (word %port expb) (word %gill expb) (word %gate expb) @@ -9341,8 +9341,15 @@ ++ expu |.(;~(gunk rope loaf (butt hank))) :: wing, twig, twigs ++ expv |.((butt rick)) :: just changes ++ expw |.(;~(gunk rope loaf loaf loaf)) :: wing and three twigs + ++ expx |. ;~ gunk loaf :: twig and core tail + %+ sear :: + |= a/(map term foot) :: + ?:((~(has by a) %$) ~ [~ u=a]) :: (with no $ arm) + wisp :: + == :: ++ expz |.(loaf(bug &)) :: twig with tracing :: + :: :: tiki expansion for %wt runes :: ++ tkhp |. %+ cook |= {a/tiki b/(list (pair twig twig))} From 5c61aee6c6051dcedd24a81cde5b58f96eb3940f Mon Sep 17 00:00:00 2001 From: Joseph Bryan Date: Tue, 21 Mar 2017 12:44:13 -0400 Subject: [PATCH 11/11] prevents nest-fail in ;; / :fry --- sys/hoon.hoon | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/hoon.hoon b/sys/hoon.hoon index 13bf7408ac..86ea12f730 100644 --- a/sys/hoon.hoon +++ b/sys/hoon.hoon @@ -6351,7 +6351,11 @@ :+ %pin [%name %b [%per [%limb %v] q.gen]] :: =+ b==>(v {q.gen}) :+ %pin :: =+ c=(a b) [%name %c [%call [%limb %a] [%limb %b] ~]] :: - [%sure [%same [%limb %c] [%limb %b]] [%limb %c]] :: ?>(=(c b) c) + :+ %sure :: ?>(=(`*`c `*`b) c) + :+ %same :: + [%cast [%base %noun] [%limb %c]] :: + [%cast [%base %noun] [%limb %b]] :: + [%limb %c] :: :: {$new *} [%pin ~(bunt al %herb p.gen) q.gen]