Merge lp:~nemilya/terminator/putty_paste_style into lp:terminator/trunk

Proposed by Nemilya
Status: Merged
Merged at revision: 1663
Proposed branch: lp:~nemilya/terminator/putty_paste_style
Merge into: lp:terminator/trunk
Diff against target: 155 lines (+54/-3)
7 files modified
doc/manual/_build/html/_sources/preferences.txt (+5/-0)
doc/manual/source/preferences.rst (+5/-0)
doc/terminator_config.5 (+4/-0)
terminatorlib/config.py (+1/-0)
terminatorlib/preferences.glade (+16/-0)
terminatorlib/prefseditor.py (+8/-0)
terminatorlib/terminal.py (+15/-3)
To merge this branch: bzr merge lp:~nemilya/terminator/putty_paste_style
Reviewer Review Type Date Requested Status
Stephen Boddy Approve
Review via email: mp+271993@code.launchpad.net

Description of the change

Solution for this:
https://bugs.launchpad.net/terminator/+bug/1416682

Option 'Putty paste style' to make ex-putty (ex-windows) users little happy :)

May be make some text corrections?

Thanks!

To post a comment you must log in.
Revision history for this message
Stephen Boddy (stephen-j-boddy) wrote :

Other than the one in-line comment below, it's a nice clean simple patch. I'll apply it as is.

I do have one thing I'm undecided on, and that is whether this should be per profile, or global. I can't imagine someone would need this to be per profile, because it would be *very* confusing switching between two terminals operating different ways. It may be that I'll consider moving the setting into the global section. Or perhaps you have some counter-argument?

Anyhow, thanks for the contribution.

review: Approve
Revision history for this message
Nemilya (nemilya) wrote :

Thanks for merging!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'doc/manual/_build/html/_sources/preferences.txt'
2--- doc/manual/_build/html/_sources/preferences.txt 2015-08-21 00:11:31 +0000
3+++ doc/manual/_build/html/_sources/preferences.txt 2015-09-22 14:53:14 +0000
4@@ -256,6 +256,11 @@
5 This puts the selection into the copy/paste buffer, as well as being
6 available on middle-click.
7
8+**Putty paste style** (default: off)
9+
10+ Make right mouse button in Putty-style: right button - paste from
11+ clipboard, middle - open popup (for ex-Putty users).
12+
13 **Select-by-word characters** (default: ``-A-Za-z0-9,./?%&#:_``)
14
15 Using double-click to select text will use this pattern to define
16
17=== modified file 'doc/manual/source/preferences.rst'
18--- doc/manual/source/preferences.rst 2015-08-21 00:11:31 +0000
19+++ doc/manual/source/preferences.rst 2015-09-22 14:53:14 +0000
20@@ -256,6 +256,11 @@
21 This puts the selection into the copy/paste buffer, as well as being
22 available on middle-click.
23
24+**Putty paste style** (default: off)
25+
26+ Make right mouse button in Putty-style: right button - paste from
27+ clipboard, middle - open popup (for ex-Putty users).
28+
29 **Select-by-word characters** (default: ``-A-Za-z0-9,./?%&#:_``)
30
31 Using double-click to select text will use this pattern to define
32
33=== modified file 'doc/terminator_config.5'
34--- doc/terminator_config.5 2015-07-10 19:36:33 +0000
35+++ doc/terminator_config.5 2015-09-22 14:53:14 +0000
36@@ -489,6 +489,10 @@
37 .B copy_on_selection \fR(boolean)
38 If set to True, text selections will be automatically copied to the clipboard, in addition to being made the Primary selection.
39 Default value: \fBFalse\fR
40+.TP
41+.B putty_paste_style \fR(boolean)
42+If set to True, right mouse click - paste Primary selection, middle mouse click - popup menu.
43+Default value: \fBFalse\fR
44
45 .SH layouts
46
47
48=== modified file 'terminatorlib/config.py'
49--- terminatorlib/config.py 2015-08-08 02:11:30 +0000
50+++ terminatorlib/config.py 2015-09-22 14:53:14 +0000
51@@ -242,6 +242,7 @@
52 'force_no_bell' : False,
53 'cycle_term_tab' : True,
54 'copy_on_selection' : False,
55+ 'putty_paste_style' : False,
56 'alternate_screen_scroll': True,
57 'split_to_group' : False,
58 'autoclean_groups' : True,
59
60=== modified file 'terminatorlib/preferences.glade'
61--- terminatorlib/preferences.glade 2015-08-10 19:45:48 +0000
62+++ terminatorlib/preferences.glade 2015-09-22 14:53:14 +0000
63@@ -1590,6 +1590,22 @@
64 <property name="position">5</property>
65 </packing>
66 </child>
67+ <child>
68+ <object class="GtkCheckButton" id="putty_paste_style">
69+ <property name="label" translatable="yes">Putty paste style</property>
70+ <property name="visible">True</property>
71+ <property name="can_focus">True</property>
72+ <property name="receives_default">False</property>
73+ <property name="use_action_appearance">False</property>
74+ <property name="draw_indicator">True</property>
75+ <signal name="toggled" handler="on_putty_paste_style_toggled" swapped="no"/>
76+ </object>
77+ <packing>
78+ <property name="expand">False</property>
79+ <property name="fill">False</property>
80+ <property name="position">6</property>
81+ </packing>
82+ </child>
83 </object>
84 <packing>
85 <property name="expand">False</property>
86
87=== modified file 'terminatorlib/prefseditor.py'
88--- terminatorlib/prefseditor.py 2015-08-20 22:15:05 +0000
89+++ terminatorlib/prefseditor.py 2015-09-22 14:53:14 +0000
90@@ -425,6 +425,9 @@
91 # Copy on selection
92 widget = guiget('copy_on_selection')
93 widget.set_active(self.config['copy_on_selection'])
94+ # Putty paste style
95+ widget = guiget('putty_paste_style')
96+ widget.set_active(self.config['putty_paste_style'])
97 # Word chars
98 widget = guiget('word_chars_entry')
99 widget.set_text(self.config['word_chars'])
100@@ -722,6 +725,11 @@
101 self.config['copy_on_selection'] = widget.get_active()
102 self.config.save()
103
104+ def on_putty_paste_style_toggled(self, widget):
105+ """Putty paste style setting changed"""
106+ self.config['putty_paste_style'] = widget.get_active()
107+ self.config.save()
108+
109 def on_cursor_blink_toggled(self, widget):
110 """Cursor blink setting changed"""
111 self.config['cursor_blink'] = widget.get_active()
112
113=== modified file 'terminatorlib/terminal.py'
114--- terminatorlib/terminal.py 2015-09-19 03:21:36 +0000
115+++ terminatorlib/terminal.py 2015-09-22 14:53:14 +0000
116@@ -77,6 +77,10 @@
117
118 TARGET_TYPE_VTE = 8
119
120+ LEFT_CLICK = 1
121+ MIDDLE_CLICK = 2
122+ RIGHT_CLICK = 3
123+
124 terminator = None
125 vte = None
126 terminalbox = None
127@@ -895,17 +899,25 @@
128 # Suppress double-click behavior
129 return True
130
131- if event.button == 1:
132+ if self.config['putty_paste_style']:
133+ btn_to_paste = self.RIGHT_CLICK
134+ btn_to_context_menu = self.MIDDLE_CLICK
135+ else:
136+ btn_to_paste = self.MIDDLE_CLICK
137+ btn_to_context_menu = self.RIGHT_CLICK
138+
139+
140+ if event.button == self.LEFT_CLICK:
141 # Ctrl+leftclick on a URL should open it
142 if event.state & gtk.gdk.CONTROL_MASK == gtk.gdk.CONTROL_MASK:
143 url = self.check_for_url(event)
144 if url:
145 self.open_url(url, prepare=True)
146- elif event.button == 2:
147+ elif event.button == btn_to_paste:
148 # middleclick should paste the clipboard
149 self.paste_clipboard(True)
150 return(True)
151- elif event.button == 3:
152+ elif event.button == btn_to_context_menu:
153 # rightclick should display a context menu if Ctrl is not pressed
154 if event.state & gtk.gdk.CONTROL_MASK == 0:
155 self.popup_menu(widget, event)