summary refs log tree commit diff stats
path: root/README
blob: f978daf4750ed45416dbaf6a6dae2d59c7c473f3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
== Ranger v.1

Ranger is a filemanager that integrates well into the linux shell and
gives you a quick way of doing operations that would otherwise require
a lot of typing, without starting up a bloated environment.

Ranger is written in Python and uses ncurses for the user interface.

The version 1 is a rewrite from scratch and offers very limited
functionality as of now.
nt-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
import strutils, os, osproc, streams

const
  DummyEof = "!EOF!"

proc getPosition(s: string): (int, int) =
  result = (1, 1)
  var col = 0
  for i in 0..<s.len:
    if s[i] == '\L':
      inc result[0]
      col = 0
    else:
      inc col
  result[1] = col+1

proc callNimsuggest() =
  let cl = parseCmdLine("nimsuggest --tester temp000.nim")
  var p = startProcess(command=cl[0], args=cl[1 .. ^1],
                       options={poStdErrToStdOut, poUsePath,
                       poInteractive, poDemon})
  let outp = p.outputStream
  let inp = p.inputStream
  var report = ""
  var a = newStringOfCap(120)
  let contents = readFile("tools/nimsuggest/crashtester.nim")
  try:
    # read and ignore anything nimsuggest says at startup:
    while outp.readLine(a):
      if a == DummyEof: break

    var line = 0
    for i in 0..< contents.len:
      let slic = contents[0..i]
      writeFile("temp000.nim", slic)
      let (line, col) = getPosition(slic)
      inp.writeLine("sug temp000.nim:$#:$#" % [$line, $col])
      inp.flush()
      var answer = ""
      while outp.readLine(a):
        if a == DummyEof: break
        answer.add a
        answer.add '\L'
      echo answer
  finally:
    inp.writeLine("quit")
    inp.flush()
    close(p)

callNimsuggest()