Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .hgignore

This file was deleted.

1 change: 0 additions & 1 deletion .no-sublime-package
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

23 changes: 7 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
SublimeREPL for SublimeText (2 and 3)
=====================================

IMPORTANT NOTE - DISCLAIMER
---------------------------

Due to and uncertain future of SublimeText and its current **abandonware** status (no new releases for several months, no communication with the community, non-existent technical support on disintegrating forums) all of my SublimeText plugins including SublimeREPL are currently **ON HOLD**. I'll reconsider support and development **if and only if** *SublimeHQ* resumes operation that can be considered acceptable for a company licensing a paid software. Until then I'm limiting time spent supporting my ST plugins to the absolute minimum.



[![Stories in Ready](https://badge.waffle.io/wuub/SublimeREPL.png?label=ready)](http://waffle.io/wuub/SublimeREPL)

If you would like to donate to support SublimeREPL development, you can do so using [GitTip](https://www.gittip.com/wuub/) or [PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=4DGEPH7QAVHH6&lc=GB&item_name=SublimeREPL&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted). Someone willing to take care of documentation would also be very welcome :-)
SublimeREPL
-----------

Picks up the torch where wuub left off.

Features
--------

#### Common
* Run an interpreter (REPL) inside SublimeText2 view/tab.
* Run an interpreter (REPL) inside SublimeText view/tab.
* Per-language persistent REPL history.
* Easily evaluate code in the running REPL
* Replace your current build system, and use stdin in your programs.
Expand All @@ -26,7 +19,7 @@ Features
#### Python
* Launch python in local or remote(1) virtualenv.
* Quickly run selected script or launch PDB.
* Use SublimeText2 Python console with history and multiline input.
* Use SublimeText Python console with history and multiline input.

(1) - (ssh, linux/osx only)

Expand All @@ -50,7 +43,7 @@ Installation
2. Install SublimeREPL
1. `Preferences | Package Control | Package Control: Install Package`
2. Choose `SublimeREPL`
3. Restart SublimeText2
3. Restart SublimeText
4. Configure `SublimeREPL` (default settings in `Preferences | Package Settings | SublimeREPL | Settings - Default` should be modified in `Preferences | Package Settings | SublimeREPL | Settings - User`, this way they will survive package upgrades!

Documentation
Expand Down Expand Up @@ -82,14 +75,12 @@ then type "SublimeREPL" and select the approperiate language.
Note: <kbd>ctrl+,</kbd>, <kbd>f</kbd> means: press Ctrl and Comma, release all, press F.


License and Price
License
=================

Since version 1.2.0 SublimeREPL is licensed under GPL. Previous versions were licensed under BSD.
If you're using SublimeREPL in commercial environment a donation is strongly encouraged ;-)

Compatibility
================

SublimeREPL is developed against the latest dev build of SublimeText3.
Ubuntu 13.04 is main
15 changes: 7 additions & 8 deletions config/NodeJS/repl.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
(function () {
/* global require, process */

var repl = require('repl');

var rep = repl.start({
prompt: null, //'> ',
source: null, //process.stdin,
eval: null, //require('vm').runInThisContext,
useGlobal: true, //false
input: process.stdin,
output: process.stdout,
useGlobal: true,
useColors: false
});


var net = require('net');
var ac_port = process.env.SUBLIMEREPL_AC_PORT;
var client = new net.Socket();
Expand All @@ -19,7 +18,7 @@
client.on('data', function(data) {
var strData = data.toString();
var index = strData.indexOf(":");
var json = strData.slice(index+1, strData.length - 1)
var json = strData.slice(index+1, strData.length - 1);
var inData = JSON.parse(json);
var wordIndex = inData.line.slice(inData.cursor_pos).search(/\b/);
if(wordIndex !== 0){
Expand All @@ -30,8 +29,8 @@
var comps = completions[0];
var msg = JSON.stringify([inData.line, comps]);
var payload = msg.length + ":" + msg + ",";
client.write(payload)
}
client.write(payload);
};
rep.rli.completer(inData.line, send);
});

Expand Down
Empty file removed foo.html
Empty file.
36 changes: 25 additions & 11 deletions repls/subprocess_repl.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,26 +208,40 @@ def name(self):
def is_alive(self):
return self.popen.poll() is None

def read_bytes(self):
def read_bytes(self, buffer_size=4096):
out = self.popen.stdout
if POSIX:
while True:
i, _, _ = select.select([out], [], [])
if i:
return out.read(4096)
return out.read(buffer_size)
else:
# this is windows specific problem, that you cannot tell if there
# are more bytes ready, so we read only 1 at a times
import ctypes
import msvcrt
kernel32 = ctypes.windll.kernel32

while True:
byte = self.popen.stdout.read(1)
if byte == b'\r':
# f'in HACK, for \r\n -> \n translation on windows
# I tried universal_endlines but it was pain and misery! :'(
continue
return byte
buffer_size = 1
bytes_read = bytearray()

#wait for some output synchronously, to not cause infinite loop
bytes_read.extend(out.read(buffer_size))

#read until end of current output
kernel32.SetNamedPipeHandleState(ctypes.c_void_p(msvcrt.get_osfhandle(out.fileno())), ctypes.byref(ctypes.c_int(1)), None, None)
#'Invalid Argument' means that there are no more bytes left to read
while True:
try:
cur_bytes_read=out.read(buffer_size)
if not cur_bytes_read:
break
bytes_read.extend(cur_bytes_read)
except (OSError, IOError):
break
kernel32.SetNamedPipeHandleState(ctypes.c_void_p(msvcrt.get_osfhandle(out.fileno())), ctypes.byref(ctypes.c_int(0)), None, None)

# f'in HACK, for \r\n -> \n translation on windows
# I tried universal_endlines but it was pain and misery! :'(
return bytes_read.replace(b'\r\n', b'\n')

def write_bytes(self, bytes):
si = self.popen.stdin
Expand Down