PyPN – Defects and Enhancement requests

Discussion Forums discussion PyPN – Defects and Enhancement requests

This topic contains 0 voices and has 4 replies.

Viewing 5 posts - 1 through 5 (of 5 total)
Author Posts
Author Posts
May 27, 2011 at 2:05 pm #5295

CoDEmanX
Member

(This is meant as a collective thread)

  • GetCharAt returns an int instead of a character

    GetCharAt(self, pos) : int Get the character at the given position.

    The PyPN API doc is right, it returns a number, which is basically what you pass to it (pos). Doesn’t make much sense, it should return the character – shouldn’t it?

    Workaround: GetTextRange(pos, pos+1)

  • Stock PyPN textclip contain bad indentation

    PyPN Script File and PyPN Script Method got 4 leading spaces here:

    ${0:pass}

    The above comment line uses tab indent, leading to indentation error.

    Moreover, the $0 placeholder of PyPN Undo Block is at the beginning of the line, followed by a tab. Either the tab is too much or $0 should be behind it.

  • PyPN in textclip – problems with line endings and indentation

    PyPN code only works in textclips, if you set line endings of your document to Unix (LF) issue #1339

    Multi-line PyPN script in textclip doesn’t work if you insert it in a line with leading whitespace via shortcut issue #1346

  • Unfortunately, it’s not possibly to combine PyPN in textclip and the placeholder system. It would be quite useful tho. issue #1345

May 28, 2011 at 3:29 pm #17846

ignac
Member

So changing the defaults to CRLF (as opposed to CR) makes the error go away, but then a recorded script doesn’t really work properly.

1. I open a new document and click record

2. I type in abcd

3. I clock stop

4. I double click on the script to play it back and junk characters appear along with the abcd. ie:

aÐbÐcÐdÐ

May 28, 2011 at 11:59 pm #17847

CoDEmanX
Member

Interesting… i get those extra chars no matter of the line endings. Script looks like this:

import pn, scintilla

@script("New Script", "Recorded")

def RecordedScript():

doc = pn.CurrentDoc()

sci = scintilla.Scintilla(doc)

sci.ReplaceSel('ax01x01bx01x01cx01x01dx01x01')

May 29, 2011 at 2:03 pm #17848

ignac
Member

After trying to record ‘abcd’, my script looks slightly different:

import pn, scintilla

@script(“New Script”, “Recorded”)

def RecordedScript():

doc = pn.CurrentDoc()

sci = scintilla.Scintilla(doc)

sci.ReplaceSel(“a’xcbb’xcbc’xcbd’xcb”)

And playing the script back now results in:

a’Ëb’Ëc’Ëd’Ë

June 2, 2011 at 5:34 pm #17849

simon
Key Master

Uh oh, the recording issue looks like a unicode translation problem. Probably crept in with 2.1 but I didn’t notice. Interestingly the recording functionality is mostly written in Python (pypnrecord.py) so you may be able to fix it if you fancy taking a look before I get to it!

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.