Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Updates for ST3 #23

Merged
merged 1 commit into from

3 participants

@jinschoi

I had to make a few changes to get it to run on ST3. The EOF checks return a null string, not a zero char now. And string.strip(s) is gone, need to use s.strip().

@guidorice

Awesome- thanks

@grundprinzip

Unfortunately this breaks my ST2 setup. I will try to dive into this and see where the problem comes from.

@grundprinzip grundprinzip commented on the diff
sbp_kill_ring.py
@@ -27,7 +27,7 @@ def atEOL(cls, view, point):
@classmethod
def atEOF(cls, view, point):
nextChar = view.substr(point)
- return ord(nextChar) == 0
+ return nextChar == ""
@grundprinzip Owner

This line leas to a crash in ST2 for me, can you confirm?

Yes, it appears to cause a hang. view.substr() appears to return u'\x00' on ST2, '' on ST3. So using
return nextChar == '\0' or nextChar == ''
appears to work for both cases.

@grundprinzip Owner

Shouldn't the ordinal value of both be 0? independent of unicode or not?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@grundprinzip grundprinzip merged commit 7a6b06e into grundprinzip:master
@grundprinzip

Thanks by the way!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 20, 2013
  1. @jinschoi
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 3 deletions.
  1. +3 −3 sbp_kill_ring.py
View
6 sbp_kill_ring.py
@@ -27,7 +27,7 @@ def atEOL(cls, view, point):
@classmethod
def atEOF(cls, view, point):
nextChar = view.substr(point)
- return ord(nextChar) == 0
+ return nextChar == ""
@grundprinzip Owner

This line leas to a crash in ST2 for me, can you confirm?

Yes, it appears to cause a hang. view.substr() appears to return u'\x00' on ST2, '' on ST3. So using
return nextChar == '\0' or nextChar == ''
appears to work for both cases.

@grundprinzip Owner

Shouldn't the ordinal value of both be 0? independent of unicode or not?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@classmethod
def add_to_kill_ring(cls, view):
@@ -59,7 +59,7 @@ def push(self, text):
However, we do need some kind of sanitation to make sure
we don't push too many white spaces."""
- sanitized = string.strip(text)
+ sanitized = text.strip()
if len(sanitized) == 0:
return
@@ -266,7 +266,7 @@ def isEnabled(self, edit, args):
# if we are at the end of the file, we can't kill.
s = self.view.sel()[0]
charAfterPoint = self.view.substr(s.end())
- if ord(charAfterPoint) == 0:
+ if charAfterPoint == "":
# EOF
return False
Something went wrong with that request. Please try again.