Merge in PuTTY paste mode (Nemilya, LP#1416682) with some alterations.

This commit is contained in:
Stephen Boddy 2015-09-30 00:00:04 +02:00
commit 195849a1ca
7 changed files with 62 additions and 12 deletions

View File

@ -13,12 +13,16 @@ terminator trunk:
* remotinator now uses argparse for commandline option handling,
vastly improving the option handling
* remotinator help strings are translatable now
* PuTTY paste mode (Nemilya, LP#1416682) with some alterations
(Steve Boddy)
* Bug fixes
* Fix for those not running IBus, where the IBus workaround caused
broken keys in other keymaps set with non-IBus tools (Steve
Boddy, LP#1494606)
* Fix custom commands to use the standard gerr function instead
of the broken local one (Steve Boddy)
* Workaround for intltool not handling Python files without an
extension (Steve Boddy)
terminator 0.98:
* Features

View File

@ -93,6 +93,12 @@ Behaviour
receive keystrokes.
- *None* - Only the current terminal receives keystrokes.
**PuTTY style paste** (default: off)
Make the right mouse button operate like in PuTTY, so ``right-click``
will paste the Primary selection, and ``middle-click`` will open
the :ref:`Context Menu <context-menu>`. (For ex-PuTTY users).
**Re-use profiles for new terminals** (default: off)
When creating a new terminal with splitting or new tabs, if this is

View File

@ -136,6 +136,10 @@ Controls whether splits/tabs will continue to use the profile of their peer term
the default profile.
Default value: \fBFalse\fR
.TP
.B putty_paste_style \fR(boolean)
If set to True, right-click will paste the Primary selection, middle-click will popup the context menu.
Default value: \fBFalse\fR
.TP
.B enabled_plugins
A list of plugins which should be loaded by default. All other plugin classes will be ignored. The default value includes two
plugins related to Launchpad, which are enabled by default to provide continuity with earlier releases where these were the

View File

@ -121,6 +121,7 @@ DEFAULTS = {
'always_split_with_profile': False,
'title_use_system_font' : True,
'title_font' : 'Sans 9',
'putty_paste_style' : False,
},
'keybindings': {
'zoom_in' : '<Control>plus',

View File

@ -547,7 +547,7 @@
<object class="GtkTable" id="table9">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="n_rows">6</property>
<property name="n_rows">7</property>
<property name="n_columns">2</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
@ -620,6 +620,22 @@
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="putty_paste_style">
<property name="label" translatable="yes">Putty style paste</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_putty_paste_style_toggled" swapped="no"/>
</object>
<packing>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="always_split_with_profile">
<property name="label" translatable="yes">Re-use profiles for new terminals</property>
@ -633,8 +649,8 @@
</object>
<packing>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
@ -651,8 +667,8 @@
</object>
<packing>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
@ -703,8 +719,8 @@
</object>
<packing>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
@ -722,8 +738,8 @@
</object>
<packing>
<property name="right_attach">2</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>

View File

@ -425,6 +425,9 @@ class PrefsEditor:
# Copy on selection
widget = guiget('copy_on_selection')
widget.set_active(self.config['copy_on_selection'])
# Putty paste style
widget = guiget('putty_paste_style')
widget.set_active(self.config['putty_paste_style'])
# Word chars
widget = guiget('word_chars_entry')
widget.set_text(self.config['word_chars'])
@ -722,6 +725,11 @@ class PrefsEditor:
self.config['copy_on_selection'] = widget.get_active()
self.config.save()
def on_putty_paste_style_toggled(self, widget):
"""Putty paste style setting changed"""
self.config['putty_paste_style'] = widget.get_active()
self.config.save()
def on_cursor_blink_toggled(self, widget):
"""Cursor blink setting changed"""
self.config['cursor_blink'] = widget.get_active()

View File

@ -77,6 +77,10 @@ class Terminal(gtk.VBox):
TARGET_TYPE_VTE = 8
MOUSEBUTTON_LEFT = 1
MOUSEBUTTON_MIDDLE = 2
MOUSEBUTTON_RIGHT = 3
terminator = None
vte = None
terminalbox = None
@ -895,17 +899,24 @@ class Terminal(gtk.VBox):
# Suppress double-click behavior
return True
if event.button == 1:
if self.config['putty_paste_style']:
btn_to_paste = self.MOUSEBUTTON_RIGHT
btn_to_context_menu = self.MOUSEBUTTON_MIDDLE
else:
btn_to_paste = self.MOUSEBUTTON_MIDDLE
btn_to_context_menu = self.MOUSEBUTTON_RIGHT
if event.button == self.MOUSEBUTTON_LEFT:
# Ctrl+leftclick on a URL should open it
if event.state & gtk.gdk.CONTROL_MASK == gtk.gdk.CONTROL_MASK:
url = self.check_for_url(event)
if url:
self.open_url(url, prepare=True)
elif event.button == 2:
elif event.button == btn_to_paste:
# middleclick should paste the clipboard
self.paste_clipboard(True)
return(True)
elif event.button == 3:
elif event.button == btn_to_context_menu:
# rightclick should display a context menu if Ctrl is not pressed
if event.state & gtk.gdk.CONTROL_MASK == 0:
self.popup_menu(widget, event)