summary refs log tree commit diff stats
path: root/lib/pure/scgi.nim
Commit message (Expand)AuthorAgeFilesLines
* remove deprecated stuff from the stdlib; introduce better deprecation warningsAraq2018-05-051-3/+0
* added a warning that the .deprecate statement is unreliable for routinesAndreas Rumpf2017-11-211-1/+1
* udpated the compiler and tester to use getOrDefaultAraq2015-10-131-5/+6
* lib: Trim .nim files trailing whitespaceAdam Strzelecki2015-09-041-34/+34
* Fixed 'milliseconds' spelling in code and docspdw2015-05-151-1/+1
* Added warning to scgi module.Dominik Picheta2014-12-261-0/+4
* prettified some async modulesAraq2014-08-311-3/+3
* made some tests greenAraq2014-08-311-7/+7
* big renameAraq2014-08-271-66/+70
* made large parts of the stdlib gcsafeAraq2014-04-201-3/+6
* Add checks for invalid socket when creating sockets.Dominik Picheta2014-04-151-0/+1
* Corrected prunesocketset and pruneprocesssetErik O'Leary2014-01-191-1/+1
* Implemented boolean socket options.Dominik Picheta2013-10-301-2/+8
* Send buffer will be respected now when closing async SCGI clients.Dominik Picheta2013-06-211-3/+12
* Improved the performance of the SCGI module when dealing with multipleDominik Picheta2013-05-191-29/+95
* Removes executable bit for text files.Grzegorz Adam Hankiewicz2013-03-161-0/+0
* IRC module is now saner at the expense of a little API breakage.Dominik Picheta2012-12-011-0/+2
* Fixes bug in scgi module: client socket was not initialised properly.Dominik Picheta2012-11-181-1/+2
* Fixes async scgi.Dominik Picheta2012-09-281-16/+17
* Added close() to async versions of scgi and httpserver.Dominik Picheta2012-09-231-0/+4
* Fixes scgi, adds async functionality to httpserver.Dominik Picheta2012-09-091-21/+16
* term rewriting improvementsAraq2012-09-081-1/+1
* Many fixes for asynchronous sockets. Asyncio should now work well with buffer...Dominik Picheta2012-07-221-2/+3
* make tests green againAraq2012-07-171-3/+4
* Scgi module handles socket disconnection properly now.dom962012-05-051-0/+7
* Added asyncio module; irc, scgi and the ftpclient modules work with it. Added...dom962012-01-221-3/+51
* year 2012 for most copyright headersAraq2012-01-021-1/+1
* copy replaced by substrAraq2011-05-141-2/+2
* fixed some redis commands; fixed bindAddr and scgi now doesn't bind to all ad...dom962011-05-141-2/+2
* little repo cleanupAraq2011-05-021-1/+1
* The sockets module supports non-blocking sockets now. Many other fixes in soc...dom962011-04-301-21/+26
* non-nil AST; continue after errors for IDE supportAraq2011-02-121-0/+0
* added install.sh; scgi: does not set system.stackTraceNewLine anymoreAraq2010-10-261-1/+0
* bugfix: typo in SMTP module; SCGI module finishedAraq2010-10-251-0/+140
="p">(self.commandlist) def open(self): self.scroll_begin = 0 self.startx = 0 def close(self): if self.source and self.source_is_stream: self.source.close() def draw(self): line_gen = self._generate_lines( starty=self.scroll_begin, startx=self.startx) for line, i in zip(line_gen, range(self.hei)): try: self.addstr(i, 0, line) except TypeError: pass def move(self, relative=0, absolute=None): i = self.scroll_begin if isinstance(absolute, int): i = absolute if isinstance(relative, int): i += relative length = len(self.lines) - self.hei - 1 if i >= length: self._get_line(i+self.hei) length = len(self.lines) - self.hei - 1 if i >= length: i = length if i < 0: i = 0 self.scroll_begin = i def move_horizontal(self, relative=0, absolute=None): self.startx = move_between( current=self.startx, minimum=0, maximum=999, relative=relative, absolute=absolute) def press(self, key): try: tup = self.env.keybuffer.tuple_without_numbers() if tup: cmd = self.commandlist[tup] else: return except KeyError: self.env.key_clear() else: if hasattr(cmd, 'execute'): cmd.execute_wrap(self) self.env.key_clear() def set_source(self, source, strip=False): if self.source and self.source_is_stream: self.source.close() if isinstance(source, str): self.source_is_stream = False self.lines = source.split('\n') elif hasattr(source, '__getitem__'): self.source_is_stream = False self.lines = source elif hasattr(source, 'readline'): self.source_is_stream = True self.lines = [] else: self.source = None self.source_is_stream = False return False if not self.source_is_stream and strip: self.lines = map(lambda x: x.strip(), self.lines) self.source = source return True def click(self, event): n = event.ctrl() and 1 or 3 if event.pressed(4): self.move(relative = -n) elif event.pressed(2) or event.key_invalid(): self.move(relative = n) return True def _get_line(self, n, attempt_to_read=True): try: return self.lines[n] except (KeyError, IndexError): if attempt_to_read and self.source_is_stream: for l in self.source: self.lines.append(l) if len(self.lines) > n: break return self._get_line(n, attempt_to_read=False) return "" def _generate_lines(self, starty, startx): i = starty if not self.source: raise StopIteration while True: try: line = self._get_line(i).expandtabs(4) line = line[startx:self.wid - 1 + startx].rstrip() yield line except IndexError: raise StopIteration i += 1