Clipboard Preferences Help
Name:Clipboard Preferences
Version:1.4
Last update:2019-10-17 13:28:35





The Clipboard Preferences package provides preferences for additional Clipboard Utilities, such as an optional preference for Cut Copy Whitespace to ensure that the cutting/pasting of a word will adjust the whitespace surrounding it in a context specific way.

Additional Clipboard Utilities

In addition to the automatic indentation of pasted text provided by the package Smart Paste, additional Cut/Copy/Paste functions can be added to Alpha by turning on this feature (via the Features Preferences dialog).
Settings for Reselect After Paste, Cut And Copy Using Pin, and Cut Paste Whitespace can then be changed via the Alpha ↣ Preferences ↣ Global Preferences ↣ Text menu item. Click here to display the Text Preferences panel.

Reselect After Paste

If the Reselect After Paste pref is set then the text string that was just pasted into the window will be highlighted. This can take place after every paste, or only when you're pasting over a selection. The three possible values for this preference are:
This function is ignored for rectangular editing.

Cut And Copy Using Pin

Normally, you must have a region selected in order to use Cut or Copy -- otherwise there is no text to use for the clipboard. Alpha, however, maintains a Window Pin -- a temporary floating mark for every window -- that can be used to create this region if you have not selected one already. You can set the Cut And Copy Using Pin preference to use this region if desired for all cutting/copying operations.
If there is already a region selected, that selection will always be used by default. When there is no selection, both Cut and Copy will essentially be shortcuts for two consecutive operations:
  1. Search ↣ The Pin ↣ Hilite To Pin
  2. Edit ↣ Cut/Copy
Following a Copy operation using the pin, the region copied will be automatically highlighted so that you know exactly what was placed into the clipboard.
You can set the Window Pin by selecting Search ↣ The Pin ↣ Set Pin, move to some different position in the window, and then Copy the region between the pin and the cursor. If you have any experience with emacs, then you are probably familiar with such window mark in cut/copy operations
Note that some AlphaTcl functions reset the Window Pin silently, such as selecting text and some text insertion operations, so in general you should set the pin manually and then cut/copy the text relatively soon to ensure that you are manipulating the region that you actually want. Experiment with the The Pin ↣ Hilite To Pin menu item and binding for a while to get used to the setting of the pin and learn what the region looks like.

Cut Paste Whitespace

This preference will adjust the whitespace surrounding cut/pasted text to ensure that there is not too much or too little. For example, if the text string in the window looks like
This is a test of |whitespace| adjustments
                   ^^^^^^^^^^
and the whitespace string is highlighted, performing a Cut will remove one of the surrounding spaces, resulting in
This is a test of| adjustments
(where '|' indicates the cursor) rather than
This is a test of | adjustments
This may seem trivial, but once you begin using it you'll realize how many times a cut must be followed by a combination of arrow key navigation and delete keys. When pasting, whitespace is added if one and only one side of the current position has whitespace.
This is a somewhat conservative feature, in that we tend to error on the side of leaving whitespace as is in ambiguous situations. For example, if the text to be cut/pasted has any whitespace at its own borders then we make no adjustment. It does, however, make an attempt to look at the surrounding text so that pasting next to a double quote (e.g.) will add whitespace as necessary, so the pasting here:
This is another "|test of this feature"
will result in
This is another "interesting test of this feature"
The whitespace is always adjusted after the Cut|Paste operation takes places, so it will be the first Undo item available.
This function is ignored for rectangular editing.

Mode Preference Over-rides

The three preferences in the Text Preferences panel (those specific to Cut Copy Paste utilities) are global in the sense that they apply to every mode for which this package is activated. It is possible, however, to turn them on/off for any mode. For example, the Cut Paste Whitespace pref might be very useful for TeX mode, but less so for C++ or other computer language syntax modes.
You can define a mode specific preference for any of these items by including a couple line of AlphaTcl code in the prefs.tcl file. For example, to turn off Cut Paste Whitespace feature in Tex mode, add
    newPref flag cutPasteWhitespace 0 TeX
This preference can then be adjusted with the dialog that appears with the Alpha ↣ Text Mode Setup ↣ Mode Preferences… menu item.
Use these lines of code to define such mode preferences for each mode desired, where <mode> is the name of the mode for which you want specific behavior:
newPref flag cutAndCopyUsingPin 0 <mode>

newPref flag cutPasteWhitespace 0 <mode>

newPref var  selectAfterPaste   0 <mode> "" \
  [list "Never" "Only if pasting over selection" "Always"] index
You must do this for each mode -- if the mode of the given window does not have such a preference, then the normal global preferences are used.

Contextual Menu Module

A Contextual Menu module named Clipboard Menu is also made available by this package. Click here to display the Contextual Menu Preferences panel.
In addition to the standard Cut Copy Paste items, you can move the selected region to the target click-position, or place a copy of it at that position. These functions are similar to Drag And Drop.

Known problems

Please report any problem or bug you encounter to Alpha's Bug Tracker.
If you have any additional Clipboard Utilities you'd like to add to this package, please contact the maintainer listed above.

License and Disclaimer

Copyright (c) 2007-2019, Craig Barton Upright and Contributors.
Contributors: Juan Falgueras, Dominique d'Humieres, Vince Darley.
All rights reserved.
The Clipboard Preferences package is free software and distributed under the terms of the new BSD license:
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CRAIG BARTON UPRIGHT OR THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This document has been placed in the public domain.