Skip to content
This repository

Updates for ST3 #23

Merged
merged 1 commit into from over 1 year ago

3 participants

jinschoi mindlube Martin Grund
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().

mindlube

Awesome- thanks

Martin Grund

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

Martin Grund grundprinzip commented on the diff
sbp_kill_ring.py
@@ -27,7 +27,7 @@ def atEOL(cls, view, point):
27 27 @classmethod
28 28 def atEOF(cls, view, point):
29 29 nextChar = view.substr(point)
30   - return ord(nextChar) == 0
  30 + return nextChar == ""
4
Martin Grund 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.

Martin Grund 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
Martin Grund grundprinzip merged commit 7a6b06e into from
Martin Grund

Thanks by the way!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Feb 20, 2013
jinschoi jinschoi Small fixes to sbp_kill_ring.py for ST3/Python3. 7a6b06e
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 3 additions and 3 deletions. Show diff stats Hide diff stats

  1. +3 3 sbp_kill_ring.py
6 sbp_kill_ring.py
@@ -27,7 +27,7 @@ def atEOL(cls, view, point):
27 27 @classmethod
28 28 def atEOF(cls, view, point):
29 29 nextChar = view.substr(point)
30   - return ord(nextChar) == 0
  30 + return nextChar == ""
31 31
32 32 @classmethod
33 33 def add_to_kill_ring(cls, view):
@@ -59,7 +59,7 @@ def push(self, text):
59 59 However, we do need some kind of sanitation to make sure
60 60 we don't push too many white spaces."""
61 61
62   - sanitized = string.strip(text)
  62 + sanitized = text.strip()
63 63 if len(sanitized) == 0:
64 64 return
65 65
@@ -266,7 +266,7 @@ def isEnabled(self, edit, args):
266 266 # if we are at the end of the file, we can't kill.
267 267 s = self.view.sel()[0]
268 268 charAfterPoint = self.view.substr(s.end())
269   - if ord(charAfterPoint) == 0:
  269 + if charAfterPoint == "":
270 270 # EOF
271 271 return False
272 272

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.