[wingide-users] duplicate current line extension
Wingware Support
support at wingware.com
Mon Dec 28 11:31:17 MST 2009
Larry Eitel wrote:
> I am new to wingide.
>
> Is there an extension around for duplicating the current line without
> using the clipboard buffer?
Here's an implementation:
def duplicate_line(app=wingapi.kArgApplication):
"""Duplicate the current line on the line that follows it"""
editor = app.GetActiveEditor()
doc = editor.GetDocument()
start, end = editor.GetSelection()
start_lineno = doc.GetLineNumberFromPosition(start)
line_start = doc.GetLineStart(start_lineno)
line_end = doc.GetLineEnd(start_lineno)
line = doc.GetCharRange(line_start, line_end)
doc.InsertChars(line_end, editor.GetEol() + line)
--
Stephan Deibel
Wingware | Python IDE
Advancing Software Development
www.wingware.com
More information about the wingide-users
mailing list