[Eric] ANN: Smart Paste Plugin for eric4-4.4.0

Larry Shaffer larrys at dakotacarto.com
Sun Jan 24 11:30:17 GMT 2010


Hi,

I made a plugin for eric4 that helps with pasting indented multi-line text.
It's not a replacement for Paste, but helps when working with large pastes
of indented lines. It works well for me, but no doubt needs more testing.
English only so far, but would like to add translations. Only tested on Mac,
but 'should' work on any platform that runs eric4.

http://dl.dropbox.com/u/4058089/eric4/PluginSmartPaste.zip
  (8.8 KB)

Larry


>From the README:

###############################################################
Smart Paste Plugin 1.0 for eric4-4.4.0   01-24-2010
###############################################################

Not 'smart' so much as helpful. Tested only with Python editing,
with standard 4-space indention setting, and with auto-indention ON.

This plugin implements helpful multiline pasting. Excess left
whitespace is trimmed from all lines on clipboard and matched
with possibly ambiguous first line. First line is highlighted and
subsequent lines are selected to aid in fixing indention.

It adds a Smart Paste menu item under the application's Edit menu
and to the editor's contextual menu. It also adds an available toolbar
item to the Edit group.

Usage:
After the text is pasted and the first line highlighted, the
user then chooses to indent or uindent the currently selected
text, which is more handy than pasting text and hunting around
to select exactly what needs to have its indention fixed, since
only the first line of a selection is considered to have ambiguous
relative indention.

I recommend assigning a key shortcut to 'Remove all Highlights'
command to make clearing the highlight from paste entry line quick.


###############################################################
Editor.py.diff (optional)
###############################################################

About the eric4/QScintilla/Editor.py diff patch file,
located in SmartPaste/Editor_diff:

When there are multiple lines selected in the
editor, and that selection extends beyond the view
of the window, any indent or unindent of selection
will cause the editor to auto-scroll to a point
where the end of the selection is visible within
the bottom of the view. This causes problems when
trying to align large blocks of selected text to
match a target indention with the line just before
the selection. This adds 4 lines of code to the

__indentSelection() private method

to keep the scrolling from taking place.


Apply using 'patch' program on command line (Unix/Mac):

  patch path/to/site/packages/eric4/QScintilla/Editor.py Editor.py.diff

from within the SmartPaste/Editor_diff directory.


The plugin will be installed in ~/.eric4/eric4plugins by default.




More information about the Eric mailing list