diff --git a/arvo/dill.hoon b/arvo/dill.hoon index 40aabb026c..e695fb5dc3 100644 --- a/arvo/dill.hoon +++ b/arvo/dill.hoon @@ -37,9 +37,9 @@ $% [%aro p=?(%d %l %r %u)] :: arrow key [%bac ~] :: true backspace [%cru p=@tas q=(list tank)] :: echo error - [%ctl p=@ud] :: control-key + [%ctl p=@c] :: control-key [%del ~] :: true delete - [%met p=@ud] :: meta-key + [%met p=@c] :: meta-key [%ret ~] :: return [%rez p=@ud q=@ud] :: resize, cols, rows [%txt p=(list ,@c)] :: utf32 text @@ -78,9 +78,9 @@ ++ belt :: raw console input $% [%aro p=?(%d %l %r %u)] :: arrow key [%bac ~] :: true backspace - [%ctl p=@ud] :: control-key + [%ctl p=@c] :: control-key [%del ~] :: true delete - [%met p=@ud] :: meta-key + [%met p=@c] :: meta-key [%ret ~] :: return [%txt p=(list ,@c)] :: utf32 text == :: diff --git a/arvo/eyre.hoon b/arvo/eyre.hoon index cdb2c21a25..69fa795980 100644 --- a/arvo/eyre.hoon +++ b/arvo/eyre.hoon @@ -525,9 +525,12 @@ [?(%on %ay) *] ~|(e/ford/lost/-.tee !!) [%of ^] ?~ q.tee ~|(e/ford/lost/tee !!) + ?: ?=(%| -.q.sih) + (print-tang p.q.sih) %+ get-rush:(ire-ix p.tee) q.tee - ?> ?=([%& %json ^] q.sih) :: XX others - ((hard json) |3.q.sih) + =* cay p.q.sih + ?> ?=(%json p.cay) :: XX others + ((hard json) q.q.cay) :: [%to ^] ?: ?=(%| -.q.sih) @@ -565,6 +568,12 @@ (fail 500 0v0 >%exit< p.mul) :: ++ ire-ix |=(ire=ixor ~(. ix ire (~(got by wix) ire))) + ++ print-tang + |= a=tang ^+ +> + ?~ a +> + ~> %slog.`i.a + $(a t.a) + :: ++ ses-authed |= ses=hole =+ sap=(~(get by sop) ses) diff --git a/main/app/dojo/core.hook b/main/app/dojo/core.hook index 3b425f3e6c..f3ee5d4f9a 100644 --- a/main/app/dojo/core.hook +++ b/main/app/dojo/core.hook @@ -233,7 +233,7 @@ ++ dp-server-cat (stag 0 (stag %cat dp-device)) :: ++dojo-server ++ dp-server-dog (stag 0 (stag %dog dp-device)) :: ++dojo-server ++ dp-server-pig (stag 0 (stag %pig dp-device)) :: ++dojo-server - ++ dp-twig wide:(vang & ~) :: ++twig + ++ dp-twig wide:(vang | ~) :: ++twig ++ dp-device (most fas sym) :: ++dojo-device ++ dp-value :: ++dojo-source %+ cook |=(a=dojo-source a) diff --git a/main/app/helm/core.hook b/main/app/helm/core.hook index 088a225a47..1e381faf2d 100644 --- a/main/app/helm/core.hook +++ b/main/app/helm/core.hook @@ -24,6 +24,7 @@ %verb :: verbose mode == :: $% [%reload p=(list term)] :: reload vanes + [%sync p=@tas q=@p r=@tas ~] :: == :: ++ dill-flog :: sent to %dill $% [%crud p=%hax-init [%leaf p=tape] ~] :: initialize ship @@ -47,8 +48,12 @@ ++ note-dill :: system command $% [%flog p=dill-flog] :: == :: + ++ note-clay :: filesystem command + $% [%font p=@p q=@tas r=@p s=@tas] :: + == :: ++ note :: out request $-> - $% [%d note-dill] :: + $% [%c note-clay] :: + [%d note-dill] :: [%g note-gall] :: == :: -- :: @@ -89,7 +94,7 @@ =+ txt=((hard ,@) .^(%cx (welp pax /hoon))) [ost %pass /reset %d %flog %veer p pax txt] :: - ++ he-wish-reload + ++ he-wish-reload |= all=(list term) %_ +>.$ moz @@ -117,6 +122,14 @@ == == :: + ++ he-wish-sync + |= [syd=@tas her=@p sud=@tas ~] + %_ . + moz + :_ moz + [ost %pass /sync %c %font our.hid syd her sud] + == + :: ++ he-wish-verb %_ . moz @@ -157,6 +170,11 @@ ~& %poke-helm-reload he-abet:(he-wish-reload:(hake ost her) all) :: +++ poke-helm-sync + |= [ost=bone her=ship all=[@tas @p @tas ~]] + ~& %poke-helm-sync + he-abet:(he-wish-sync:(hake ost her) all) +:: ++ poke-helm-begin |= [ost=bone you=ship begs] ~& %poke-helm-begin diff --git a/main/app/matrix/hymn.hook b/main/app/matrix/hymn.hook new file mode 100644 index 0000000000..317482d6b3 --- /dev/null +++ b/main/app/matrix/hymn.hook @@ -0,0 +1,165 @@ +:: Matrix GUI +:: +:::: /hook/hymn/matr/app + :: +/? 310 +|% +++ cdnj |=(a=tape ;script(src "//cdnjs.cloudflare.com/ajax/libs/{a}");) +-- +:: +:::: + :: +^- manx +;html + ;head + ;title: Matrix + ;* %- turn :_ cdnj ^- wall + :~ "jquery/2.1.1/jquery.min.js" + "mousetrap/1.4.6/mousetrap.js" + "react/0.11.0/react.js" + == + ;script(src "/~/at/main/lib/urb.js"); + ;script: urb.appl = 'sole' + ;style:''' + #term { + width: 100%; + } + #term * { + margin: 0px; + } + ''' + == + ;body + ;div#err; + ;div#term:"" + ;script(type "text/coffeescript") ;- %- trip + ''' + [DOM,recl,rend] = [React.DOM, React.createClass, React.renderComponent] + [div, pre] = [DOM.div, DOM.pre] + Matr = recl render: -> + [pro,cur] = [@props.prompt + " ", @props.cursor + 1] + prompt = "#{pro.slice(0,cur)}\u0332#{pro.slice(cur)}" + lines = [prompt, @props.rows...] + div {}, lines.slice().reverse().map (lin)-> + pre {}, lin + + $ -> + termRev = 0 + pressed = [] + deltim = null + + met = $('
').text('m').css(display: 'none').appendTo(term).width()
+        subs = ""
+        # $(window).resize -> 
+        #   window.termWif = ($(term).width() / met).toFixed()
+        #   path =  "/new/#{termWif}"
+        #   if path is subs
+        #     return
+        #   if subs
+        #     urb.unsubscribe {path:subs}
+        #   subs = path
+        #   urb.subscribe {path}, (err,dat)->
+        #       if err or dat.data.ok
+        #         return;
+        #       syncRev = dat.data.rev
+        #       unless termRev > syncRev
+        #         termRev = syncRev
+        #         matr.setProps rows: dat.data.stak
+        #         document.title = "Matrix"  # XX  debug
+        # $(window).resize()
+
+        matr = rend (Matr rows:[], prompt:"", cursor:1), term
+        flash = ($el, background)->
+          $el.css {background}
+          if background
+            setTimeout (()-> flash $el,''), 50
+        
+        peer = (ruh) ->
+          switch false
+            when !ruh.map then ruh.map peer
+            when !ruh.pro then matr.setProps prompt: ruh.pro
+            when !ruh.hop then matr.setProps cursor: ruh.hop
+            when !ruh.out 
+              matr.setProps rows: [ruh.out, matr.props.rows...]
+            when !ruh.act then switch ruh.act
+              when 'clr' then matr.setProps rows:[]
+              when 'bel' then flash ($ 'body'), 'black'
+              else throw "Unknown "+(JSON.stringify ruh)
+            else console.log ruh
+        
+        urb.bind "", (err,d)->
+          if d.data then peer d.data
+
+        #later = (data)->
+        #  if data
+        #    pressed.push data
+        #  clearTimeout deltim
+        #  setTimeout (->
+        #    if urb.reqq.length > 0 
+        #      return deltim = later()
+        #    urb.send data: pressed
+        #    pressed = []
+        #  ), 500
+
+        Mousetrap.handleKey = (char, mod, e)->
+          norm = {
+            capslock:  'caps'
+            pageup:    'pgup'
+            pagedown:  'pgdn'
+            backspace: 'baxp'
+            enter:     'entr'
+          }
+          key = 
+            if char.length is 1
+              if e.type is 'keypress'
+                str: char
+            else if e.type is 'keydown'
+              if char isnt 'space'
+                act: norm[char] ? char
+            else if e.type is 'keyup' and norm[key] is 'caps'
+              act: 'uncap'
+          if key
+            e.preventDefault()
+            urb.send mark: 'dill-belt', data: {mod,key}
+            
+            # amod = (arr)->
+            #   for i in arr
+            #     unless mod.indexOf(i) < 0
+            #       return yes
+            #   no
+            # if key.str or key.act is 'baxp' or key.act is 'entr'
+            #   termRev++
+            #   [bot, rest...] = old = matr.props.rows
+            #   matr.setProps rows:(
+            #     switch  key.act 
+            #       when 'baxp'
+            #         if amod ['ctrl', 'meta']
+            #           ['', rest...]
+            #         else if amod ['alt']
+            #           [(bot.replace /\ *[^ ]*$/, ''), rest...]
+            #         else if bot and bot.length 
+            #           [bot.slice(0, -1), rest...]
+            #         else if rest[0] and rest[0].length
+            #           res = rest.slice()
+            #           res[0] = res[0].slice(0, -1)
+            #           res
+            #         else rest
+            #       when 'entr'
+            #         ['', old...]
+            #       when undefined
+            #         if mod.length > 1 or (mod.length and !amod ['shift'])
+            #           old
+            #         else unless old and bot isnt null
+            #           [key.str]
+            #         #else if bot.length is termWif
+            #         #  [key.str, old...]
+            #         else [bot + key.str, rest...]
+            #   )
+            #   document.title = "Matri"  # XX  debug
+            # later {mod, key}
+
+
+      '''
+    ==
+    ;+  (cdnj "coffee-script/1.7.1/coffee-script.min.js")
+==  ==
diff --git a/main/app/reload/core.hook b/main/app/reload/core.hook
index c12947d80a..3b9cbd7da0 100644
--- a/main/app/reload/core.hook
+++ b/main/app/reload/core.hook
@@ -11,7 +11,7 @@
 ++  poke--args
   %^  add-output  .
     rush/tang/[leaf/"done"]~
-  %+  args-into-resp  . 
+  %+  args-into-resp  .
   |=  all=(list ,@tas)
   %+  turn  all
   =+  ark=(arch .^(%cy /(scot %p our.hid)/arvo/(scot %da lat.hid)))
diff --git a/main/app/sole/core.hook b/main/app/sole/core.hook
index c88c1c723a..39b6ed6223 100644
--- a/main/app/sole/core.hook
+++ b/main/app/sole/core.hook
@@ -356,7 +356,7 @@
       (ta-hom(pos.inp pre) %del pre)
     ::
     ++  ta-ctl                                          ::  hear control
-      |=  key=@ud
+      |=  key=@c
       ^+  +>
       ?+    key  ta-bel
           %a  +>(pos.inp 0)
@@ -477,7 +477,7 @@
       +>
     ::
     ++  ta-met                                          ::  meta key
-      |=  key=@ud
+      |=  key=@c
       ~&  [%ta-met key]
       +>
     ::
diff --git a/main/app/talk/core.hook b/main/app/talk/core.hook
index 1627c2c37c..a91015fafa 100644
--- a/main/app/talk/core.hook
+++ b/main/app/talk/core.hook
@@ -135,6 +135,7 @@
     |_  $:  coz=(list command)                          ::  talk actions
             she=shell
         ==
+    ++  sh-purl  (ifix [gay gay] auri:urlp)             ::  url with spaces
     ++  sh-scad                                         ::  command parser
       =+  vag=(vang | [&1:% &2:% '0' |3:%])
       =<  work
@@ -739,8 +740,8 @@
         (fix inx '?' lit)
       ?:  &((gte i.buf 'A') (lte i.buf 'Z'))
         (fix inx (add 32 i.buf) lit)
-      ::  ?:  &(=('/' i.buf) ?=([47 *] t.buf))
-      ::  (fix inx '\\' lit)
+      ?:  &(=('/' i.buf) ?=([47 *] t.buf))
+       (fix inx '\\' lit)
       lit
     ::
     ++  sh-sane-rule                                    ::  sanitize by rule
@@ -754,10 +755,13 @@
       |=  [inv=sole-edit buf=(list ,@c)]
       ^-  (list sole-edit)
       ?~  buf  ~
-      ?:  =(';' i.buf)
-        ((sh-sane-rule sh-scad) inv (tufa t.buf))
+      =+  txt=(tufa buf)
+      ?:  =(';' -.txt)
+        ((sh-sane-rule sh-scad) inv +.txt)
       ?:  =('@' i.buf)
         (sh-sane-chat +.buf)
+      =+  ryv=(rose txt sh-purl)
+      ?:  -.ryv  ~
       (sh-sane-chat buf)
     ::
     ++  sh-slug                                         ::  edit to sanity
@@ -780,10 +784,13 @@
     ++  sh-pork                                         ::  parse work
       ^-  (unit work)
       ?~  buf.say.she  ~
-      ?:  =(';' -.buf.say.she)
-        (rust (tufa +.buf.say.she) sh-scad)
+      =+  txt=(tufa buf.say.she)
+      ?:  =(';' -.txt)
+        (rust +.txt sh-scad)
       ?:  =('@' -.buf.say.she)
         `[%say %lin | (crip (tufa +.buf.say.she))]
+      =+  rul=(rust txt sh-purl)
+      ?^  rul  `[%say %url u.rul]
       `[%say %lin & (crip (tufa buf.say.she))]
     ::
     ++  sh-lame                                         ::  send error
@@ -821,7 +828,8 @@
       ++  activate                                      ::  from %number
         |=  gam=telegram
         ^+  +>+>+>
-        ~&  [%activate gam]
+        =.  +>+>+>  ?.  ?=(%url -.r.r.q.gam)  +>+>+>
+          (sh-fact %txt (earn p.r.r.q.gam))
         sh-prod(active.she `~(tr-pals tr man.she gam))
       ::
       ++  join                                          ::  %join
@@ -1729,6 +1737,7 @@
     |=  oug=?
     ^-  tape
     ?+    -.sep  ""
+        %url  (weld ": " (scag 62 (earn p.sep)))
         %lin
       =+  txt=(trip q.sep)
       ?:  p.sep
diff --git a/main/cat/helm/sync/gate.hook b/main/cat/helm/sync/gate.hook
new file mode 100644
index 0000000000..078680fcab
--- /dev/null
+++ b/main/cat/helm/sync/gate.hook
@@ -0,0 +1,12 @@
+::
+::::  /hook/gate/sync/helm/cat
+  ::
+/?  314
+::
+::::
+  !:
+|=  $:  [now=@da eny=@uvI bec=beak]
+        [arg=[syd=@tas her=@p sud=@tas ~] ~]
+    ==
+:-  %helm-sync
+arg
diff --git a/main/mar/dill-belt/door.hook b/main/mar/dill-belt/door.hook
new file mode 100644
index 0000000000..b21f81b8bc
--- /dev/null
+++ b/main/mar/dill-belt/door.hook
@@ -0,0 +1,58 @@
+::
+::::  /hook/door/dill-belt/mar
+  ::
+/?    314
+/-    kyev,*sole
+!:
+::::
+  ::
+|_  dill-belt
+::
+++  grab                                                ::  convert from
+  |%
+  ++  json
+    =<  (cork . kyev)
+    |=  jon=^json  ^-  ^kyev
+    %-  need
+    %.  jon  =>  jo  %-  ot
+    :~  mod/(cu ^sa (ar (su (perk ~[%ctrl %shift %alt %meta]))))
+        :-  %key
+        %+  cu  |*(a=$%([%str @t] [%act @]) ?+(-.a a %str +.a))
+        =-  (of str/so act/(su (perk -)) ~)
+        :~  %ctrl  %shift  %alt   %meta   %entr  %esc  %caps  %uncap
+            %pgup  %pgdn   %home  %end    %baxp  %del  %ins
+            %up    %down   %left  %right
+    ==  ==
+  ++  kyev
+    |=  kev=^kyev  ^-  dill-belt
+    ~|  dill-belt-incomplete/kev
+    ?:  ?=([%act ?(%ctrl %shift %alt %meta)] q.kev)
+      [%txt ~]                        ::  ignore
+    =+  mod=(~(del in p.kev) %shift)
+    ?^  mod
+      ?^  q.kev  !!                   ::  only accept strings
+      =.  q.kev
+        ?.  (~(has in p.kev) %ctrl)
+          q.kev
+        (con 96 q.kev)                ::  ctrl key decoding
+      =+  cha=(tuba (trip q.kev))
+      ?>  ?=([@ ~] cha)               ::  of a single character
+      ?+  mod  !!                     ::  modified by one buckykey
+        [%ctrl ~ ~]  [%ctl i.cha]
+        [%alt ~ ~]   [%met i.cha]
+      ==
+    ?@  q.kev
+      [%txt (tuba (trip q.kev))]
+    ?+  +.q.kev  !!
+      %del   [%del ~]
+      %baxp  [%bac ~]
+      %entr  [%ret ~]
+      %up     [%aro %u]
+      %down   [%aro %d]
+      %left   [%aro %l]
+      %right  [%aro %r]
+    ==  ::  %yow, %rez?
+  ::
+  ++  noun  dill-belt                                   ::  clam from %noun
+  --
+--
diff --git a/main/mar/dill-blit/door.hook b/main/mar/dill-blit/door.hook
new file mode 100644
index 0000000000..eecb0e505c
--- /dev/null
+++ b/main/mar/dill-blit/door.hook
@@ -0,0 +1,23 @@
+::
+::::  /hook/door/dill-blit/mar
+  ::
+/?    314
+/-    *sole
+|_  dib=dill-blit
+::
+++  grab                                                ::  convert from
+  |%
+  ++  noun  dill-blit                                       ::  clam from %noun
+  --
+++  grow
+  |%
+  ++  json
+    ^-  ^json
+    ?+  -.dib  ~|(unsupported-blit/-.dib !!)
+      %mor  [%a (turn p.dib |=(a=dill-blit json(dib a)))]
+      %hop  (joba %hop (jone p.dib))
+      ?(%pro %out)  (joba -.dib (jape (tufa p.dib)))
+      ?(%bel %clr)  (joba %act %s -.dib)
+    ==
+  --
+--
diff --git a/main/mar/talk-command/door.hook b/main/mar/talk-command/door.hook
index afdde5288d..da2a3e94a3 100644
--- a/main/mar/talk-command/door.hook
+++ b/main/mar/talk-command/door.hook
@@ -72,6 +72,7 @@
       ^-  $+(json (unit statement))
       =-  (ot date/di bouquet/(as (ar so)) speech/(of -) ~)
       :~  lin/(ot say/bo txt/so ~) 
+          ::  url/(su auri:urlp)
           ::  exp/(cu |=(a=cord [a ~]) so)
           ::  inv/(ot ship/(su fed:ag) party/(su urs:ab) ~)
       ==
diff --git a/main/mar/talk-report/door.hook b/main/mar/talk-report/door.hook
index 0caf6de4bf..bc35013e52 100644
--- a/main/mar/talk-report/door.hook
+++ b/main/mar/talk-report/door.hook
@@ -88,6 +88,7 @@
       %+  joba  -.a
       ?+  -.a  !!
         %lin  (jobe say/[%b p.a] txt/[%s q.a] ~)
+        %url  (jobe url/[%s (crip (earn p.a))] ~)
         %exp  (jobe code/[%s p.a] ~)
         ::  %inv  (jobe ship/(jope p.a) party/[%s q.a] ~)
       ==
diff --git a/main/sur/sole/core.hook b/main/sur/sole/core.hook
index ef1eedbc27..dec63fcec4 100644
--- a/main/sur/sole/core.hook
+++ b/main/sur/sole/core.hook
@@ -93,9 +93,9 @@
   $%  [%aro p=?(%d %l %r %u)]                           ::  arrow key
       [%bac ~]                                          ::  true backspace
       [%cru p=@tas q=(list tank)]                       ::  echo error
-      [%ctl p=@ud]                                      ::  control-key
+      [%ctl p=@c]                                       ::  control-key
       [%del ~]                                          ::  true delete
-      [%met p=@ud]                                      ::  meta-key
+      [%met p=@c]                                       ::  meta-key
       [%ret ~]                                          ::  return
       [%rez p=@ud q=@ud]                                ::  resize, cols, rows
       [%txt p=(list ,@c)]                               ::  utf32 text
diff --git a/main/sur/talk/core.hook b/main/sur/talk/core.hook
index 120855b4a4..987125efb3 100644
--- a/main/sur/talk/core.hook
+++ b/main/sur/talk/core.hook
@@ -59,7 +59,7 @@
       [%ext p=@tas q=*]                                 ::  extended action
       [%fat p=torso q=speech]                           ::  attachment
       ::  [%inv p=station]                              ::  invite to station
-      ::  [%url p=purl]
+      [%url p=purl]                                     ::  parsed url
       [%ire p=serial q=speech]                          ::  in-reply-to
       [%lin p=? q=@t]                                   ::  no=@, text line
       [%mor p=(list speech)]                            ::  multiplex