Merge lp:vigedit into lp:~tristil/vigedit/main-method

Proposed by Lauri Niskanen
Status: Merged
Merged at revision: not available
Proposed branch: lp:vigedit
Merge into: lp:~tristil/vigedit/main-method
Diff against target: 738 lines (+363/-81) (has conflicts)
14 files modified
install.py (+161/-0)
src/ViGedit/actions/ex.py (+10/-0)
src/ViGedit/actions/lines.py (+13/-1)
src/ViGedit/actions/others.py (+37/-5)
src/ViGedit/actions/text.py (+18/-10)
src/ViGedit/actions/trace.py (+2/-2)
src/ViGedit/bindings/__init__.py (+2/-1)
src/ViGedit/bindings/base.py (+4/-0)
src/ViGedit/bindings/capture.py (+37/-13)
src/ViGedit/bindings/command.py (+27/-18)
src/ViGedit/bindings/visual.py (+3/-1)
src/ViGedit/static.py (+1/-1)
src/ViGedit/vi.py (+47/-29)
src/ViGedit/vigtk.py (+1/-0)
Text conflict in install.py
To merge this branch: bzr merge lp:vigedit
Reviewer Review Type Date Requested Status
Joseph Method Pending
Review via email: mp+18518@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Lauri Niskanen (ape3000) wrote :

This branch has great commits and I can't see any problems in it. Please merge it to the trunk.

lp:vigedit updated
69. By Stephen Moore <iambob@iambob-laptop>

made it so that if there is already a count underway, 0 won't go to the start of the line and actually add to the count

70. By Stephen Moore <iambob@iambob-laptop>

fixed capture mode

71. By Stephen Moore <iambob@iambob-laptop>

fixed ex mode

72. By Stephen Moore <iambob@iambob-laptop>

made deleting the first line of the document remove the line as well

73. By Stephen Moore <iambob@iambob-laptop>

more fixes to deleting on first line

74. By Stephen <iambob@iambob-desktop>

rewrote install.py to take some arguements specifying where to install plugins and what plugins to install

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'AUTHORS' (properties changed: -x to +x)
=== modified file 'ChangeLog' (properties changed: -x to +x)
=== modified file 'TODO' (properties changed: -x to +x)
=== modified file 'data/autotab.gedit-plugin' (properties changed: -x to +x)
=== modified file 'data/vigedit.gedit-plugin' (properties changed: -x to +x)
=== modified file 'docs/chart.png' (properties changed: -x to +x)
=== modified file 'docs/chart.svg' (properties changed: -x to +x)
=== modified file 'docs/documentation.odt' (properties changed: -x to +x)
=== modified file 'docs/documentation.pdf' (properties changed: -x to +x)
=== modified file 'gpl.txt' (properties changed: -x to +x)
=== modified file 'install.py' (properties changed: -x to +x)
--- install.py 2009-07-10 19:55:25 +0000
+++ install.py 2010-02-05 03:26:13 +0000
@@ -1,6 +1,7 @@
1#!/usr/bin/env python1#!/usr/bin/env python
22
3import os3import os
4<<<<<<< TREE
4from distutils.file_util import *5from distutils.file_util import *
5from distutils.dir_util import *6from distutils.dir_util import *
67
@@ -29,3 +30,163 @@
29# Considering integration with other plugins30# Considering integration with other plugins
30# install_plugin("classbrowser")31# install_plugin("classbrowser")
3132
33=======
34import sys
35import shutil
36from distutils.dir_util import copy_tree
37class Complaint(Exception): pass
38
39class Installer(object):
40 def __init__(self, base=None, plugins=None):
41
42 self.availablePlugins = ['ViGedit', 'autotab']
43
44 try:
45 if not base:
46 self.base = os.sep.join([os.environ['HOME'], '.gnome2', 'gedit'])
47 else:
48 self.flag_base(base)
49
50 if not plugins:
51 self.plugins = [p for p in self.availablePlugins]
52 else:
53 self.flag_plugins(plugins)
54
55 except Complaint, c:
56 self.error(c)
57
58 self.flags = (
59 (['--help', '-h'], "Show help", self.flag_help, False),
60 (['--base', '-b'], "Specify folder that holds plugins folder (default : %s)" % base, self.flag_base, True),
61 (
62 ['--plugins', '-p'],
63 "Comma seperated list of desired plugins to install (available : %s)" % ','.join(self.availablePlugins),
64 self.flag_plugins,
65 True
66 ),
67 )
68
69 self.register = {}
70 for flags, _, func, needsArg in self.flags:
71 for flag in flags:
72 self.register[flag] = (func, needsArg)
73
74 def error(self, error):
75 print "\nERROR : %s\n" % error
76 exit()
77
78 def copy(self, plugin, src, dest):
79 if os.path.exists(src):
80 if os.path.isdir(src):
81 print "Copying directory %s to %s" % (src, dest)
82 pluginFolder = os.sep.join([dest, plugin])
83 if not os.path.exists(pluginFolder):
84 os.mkdir(pluginFolder)
85
86 copy_tree(src, pluginFolder)
87 else:
88 print "Copying file %s to %s" % (src, dest)
89 shutil.copy(src, dest)
90
91 else:
92 raise Complaint("%s doesn't exist" % src)
93
94 ########################
95 ### FLAGS
96 ########################
97
98 def flag_help(self, arg=None):
99 print "Usage : python install.py [options]"
100 print "-----------------------------------"
101 lines = []
102 for flags, message, _, _ in self.flags:
103 lines.append((', '.join(flags), message))
104
105 l1 = max(len(flags) for flags, _ in lines)
106 s = "%%-%ds : %%s" % l1
107 for flags, message in lines:
108 print s % (flags, message)
109
110 exit()
111
112 def flag_base(self, arg):
113 self.base = arg
114
115 def flag_plugins(self, arg):
116 plugins = [p.lstrip().rstrip().lower() for p in arg.split(',')]
117
118 if not plugins:
119 raise Complaint("You need to install atleast one plugin")
120
121 available = dict([(p.lower(), p) for p in self.availablePlugins])
122 matched = []
123
124 #ensuring correct case
125 for plugin in plugins:
126 if plugin in available.keys():
127 matched.append(available[plugin])
128 else:
129 raise Complaint("%s is not an available plugin" % plugin)
130
131 self.plugins = matched
132
133 ########################
134 ### INSTALLER
135 ########################
136
137 def install(self):
138 pluginDir = os.sep.join([self.base, 'plugins'])
139 if not os.path.exists(pluginDir):
140 os.makedirs(pluginDir)
141
142 for plugin in self.plugins:
143 # copy gedit-plugin file
144 geditPluginFile = os.sep.join(['data', '%s.gedit-plugin' % plugin.lower()])
145 self.copy(plugin, geditPluginFile, pluginDir)
146
147 initFile = os.sep.join(['src', plugin, '__init__.py'])
148 singleFile = os.sep.join(['src', plugin, '%s.py' % plugin])
149
150 if not os.path.exists(initFile):
151 # installing a single file
152 self.copy(plugin, singleFile, pluginDir)
153
154 else:
155 #installing directory
156 self.copy(plugin, os.sep.join(['src', plugin]), pluginDir)
157
158 ########################
159 ### MAIN
160 ########################
161
162 def main(self):
163 args = sys.argv[1:]
164 index = 0
165 try:
166 while index < len(args):
167 flag = args[index]
168 if flag.startswith('-'):
169 if flag in self.register:
170 func, needsArg = self.register[flag]
171 if needsArg:
172 index += 1
173 if index >= len(args):
174 raise Complaint("%s flag needs a following arguement" % flag)
175 func(args[index])
176 else:
177 func()
178 else:
179 raise Complaint("%s is an unkown flag" % flag)
180 else:
181 raise Complaint("All arguements must be preceded by a flag. Try --help or -h")
182
183 index += 1
184
185 self.install()
186
187 except Complaint, c:
188 self.error(c)
189
190if __name__ == '__main__':
191 Installer().main()
192>>>>>>> MERGE-SOURCE
32193
=== modified file 'src/ViGedit/__init__.py' (properties changed: -x to +x)
=== modified file 'src/ViGedit/actions/__init__.py' (properties changed: -x to +x)
=== modified file 'src/ViGedit/actions/blocks.py' (properties changed: -x to +x)
=== modified file 'src/ViGedit/actions/ex.py' (properties changed: -x to +x)
--- src/ViGedit/actions/ex.py 2009-07-01 03:43:42 +0000
+++ src/ViGedit/actions/ex.py 2010-02-05 03:26:13 +0000
@@ -123,6 +123,16 @@
123 terminal = act.others.getTerminal(act)123 terminal = act.others.getTerminal(act)
124 terminal._vte.feed_child(terminalCommand + "\n")124 terminal._vte.feed_child(terminalCommand + "\n")
125125
126@regexDec("printall")
127def ex_PrintAll(act, command, result):
128 location = "%s/Desktop" % os.environ['HOME']
129 act.others.printall(act, location)
130
131@regexDec("printall (.+)")
132def ex_PrintAllLoc(act, command, result):
133 location = result.group(1)
134 act.others.printall(act, location)
135
126@regexDec(r's/(?P<search>(?:\\.|(?!/)[^\\])+)(/(?P<replace>(?:\\.|(?!/)[^\\])+)(/(?P<options>.+))?)?')136@regexDec(r's/(?P<search>(?:\\.|(?!/)[^\\])+)(/(?P<replace>(?:\\.|(?!/)[^\\])+)(/(?P<options>.+))?)?')
127def ex_Search(act, command, result):137def ex_Search(act, command, result):
128 search = result.groupdict()['search']138 search = result.groupdict()['search']
129139
=== modified file 'src/ViGedit/actions/fileOperations.py' (properties changed: -x to +x)
=== modified file 'src/ViGedit/actions/insert.py' (properties changed: -x to +x)
=== modified file 'src/ViGedit/actions/lines.py' (properties changed: -x to +x)
--- src/ViGedit/actions/lines.py 2009-06-30 02:54:14 +0000
+++ src/ViGedit/actions/lines.py 2010-02-05 03:26:13 +0000
@@ -16,6 +16,10 @@
16 select_OneLine(act)16 select_OneLine(act)
17 17
18def select_OneLine(act):18def select_OneLine(act):
19
20 if act.mode == act.modes.visual:
21 act.bindings.mode = act.modes.command
22
19 act.pos.move_LineBegin(act) 23 act.pos.move_LineBegin(act)
20 24
21 cursor = act.pos.getIter(act)25 cursor = act.pos.getIter(act)
@@ -27,6 +31,10 @@
27 act.pos.moveInsert(act, cursor, True)31 act.pos.moveInsert(act, cursor, True)
28 32
29def select_ManyLines(act, number):33def select_ManyLines(act, number):
34
35 if act.mode == act.modes.visual:
36 act.bindings.mode = act.modes.command
37
30 if type(number) in (list, tuple):38 if type(number) in (list, tuple):
31 try:39 try:
32 number = int("".join(number))40 number = int("".join(number))
@@ -35,8 +43,12 @@
35 43
36 act.pos.move_LineBegin(act)44 act.pos.move_LineBegin(act)
37 cursor = act.pos.getIter(act)45 cursor = act.pos.getIter(act)
46 l1 = cursor.get_line()
38 cursor.forward_lines(number)47 cursor.forward_lines(number)
39 48 l2 = cursor.get_line()
49 if abs(l1 - l2) == number:
50 cursor.backward_char()
51
40 act.pos.moveInsert(act, cursor, True)52 act.pos.moveInsert(act, cursor, True)
41 53
42def getLinesTillEnd(act):54def getLinesTillEnd(act):
4355
=== modified file 'src/ViGedit/actions/others.py' (properties changed: -x to +x)
--- src/ViGedit/actions/others.py 2009-06-30 02:54:14 +0000
+++ src/ViGedit/actions/others.py 2010-02-05 03:26:13 +0000
@@ -1,8 +1,6 @@
1from gtk import PrintOperation, PageSetup
2import gtksourceview2
1import gobject3import gobject
2
3def nextSearchItem(act):
4 if act.vibase.doc.get_can_search_again():
5 act.menus["searchNext"].activate()
6 4
7def search(act):5def search(act):
8 act.vibase.view.emit("start_interactive_search")6 act.vibase.view.emit("start_interactive_search")
@@ -22,4 +20,38 @@
22 if len(notebook.get_children()) != 0: 20 if len(notebook.get_children()) != 0:
23 terminal = notebook.get_children()[1]21 terminal = notebook.get_children()[1]
24 return terminal22 return terminal
25 return None 23 return None
24
25def redoLastOperation(act):
26 act.vibase.lastOperation(act)
27
28def draw_page(operation, context, page_nr, compositor):
29 compositor.draw_page(context, page_nr)
30
31def begin_print(operation, context, compositor):
32 n_pages = 1
33 while not compositor.paginate(context):
34 pass
35
36 n_pages = compositor.get_n_pages()
37 operation.set_n_pages(n_pages)
38
39def printall(act, location):
40 views = [view for view in act.vigtk.window.get_views()]
41
42 count = 1
43 for view in views:
44
45 po = PrintOperation()
46 setup = PageSetup()
47 po.set_default_page_setup(setup)
48
49 po.set_export_filename("%s/%d.pdf" % (location, count))
50 count += 1
51
52 pc = gtksourceview2.print_compositor_new_from_view(view)
53
54 po.connect("begin_print", begin_print, pc)
55 po.connect("draw_page", draw_page, pc)
56
57 res = po.run(act.gtk.PRINT_OPERATION_ACTION_EXPORT)
2658
=== modified file 'src/ViGedit/actions/text.py' (properties changed: -x to +x)
--- src/ViGedit/actions/text.py 2009-07-08 05:08:29 +0000
+++ src/ViGedit/actions/text.py 2010-02-05 03:26:13 +0000
@@ -4,23 +4,31 @@
4###4###
5########################5########################
66
7def delete_PrevChar(act):7def delete_PrevChar(act, withBackSpace=False):
8 oldMode = act.bindings.mode8 if withBackSpace:
9 act.bindings.mode = act.modes.visual9 act.vibase.doc.backspace(act.pos.getIter(act), False, True)
10 act.pos.move_Backward(act, True)10 else:
11 cut_Selection(act)11 oldMode = act.bindings.mode
12 act.bindings.mode = oldMode12 act.bindings.mode = act.modes.visual
13 #act.vibase.doc.backspace(act.pos.getIter(act), False, True) 13 act.pos.move_Backward(act, True)
14 cut_Selection(act)
15 act.bindings.mode = oldMode
14 16
15def delete_Char(act):17def delete_Char(act, withBackSpace=False):
16 act.pos.move_Forward(act)18 act.pos.move_Forward(act)
17 delete_PrevChar(act)19 delete_PrevChar(act, withBackSpace)
1820
19def delete_WholeLines(act):21def delete_WholeLines(act):
20 number = act.vibase.numLines22 number = act.vibase.numLines
21 act.lines.select_Lines(act, number)23 act.lines.select_Lines(act, number)
22 cut_Selection(act)24 cut_Selection(act)
23 act.text.delete_Char(act)25 cursor = act.pos.getIter(act)
26 line = cursor.get_line()
27 if line > 0:
28 delete_PrevChar(act, withBackSpace=True)
29 act.pos.move_Forward(act)
30 else:
31 delete_Char(act, withBackSpace=True)
24 32
25def delete_ToLineEnd(act):33def delete_ToLineEnd(act):
26 act.lines.select_ToLineEnd(act)34 act.lines.select_ToLineEnd(act)
2735
=== modified file 'src/ViGedit/actions/trace.py' (properties changed: -x to +x)
--- src/ViGedit/actions/trace.py 2009-06-30 02:54:14 +0000
+++ src/ViGedit/actions/trace.py 2010-02-05 03:26:13 +0000
@@ -35,8 +35,8 @@
3535
36def intro(mode=None, message=None, *args):36def intro(mode=None, message=None, *args):
37 if message:37 if message:
38 info(1, message, *args, color=MAGNETA)38 info(1, message, *args, **{'color' : MAGNETA})
39 else:39 else:
40 info(1, "Introducing %s mode", mode.mode, color=MAGNETA)40 info(1, "Introducing %s mode", mode.mode, **{'color' : MAGNETA})
41 41
42 42
4343
=== modified file 'src/ViGedit/bindings/__init__.py' (properties changed: -x to +x)
--- src/ViGedit/bindings/__init__.py 2009-06-30 02:54:14 +0000
+++ src/ViGedit/bindings/__init__.py 2010-02-05 03:26:13 +0000
@@ -31,7 +31,7 @@
31 31
32 def register(self, mode, function, keycode, control=False, meta=False,32 def register(self, mode, function, keycode, control=False, meta=False,
33 final=False, repeat=False, after=None, pos=False, 33 final=False, repeat=False, after=None, pos=False,
34 ignoreStack=False, stack = ""):34 ignoreStack=False, stack = "", recordAction = True):
35 35
36 keycombo = keycode, control, meta, stack36 keycombo = keycode, control, meta, stack
37 try:37 try:
@@ -53,6 +53,7 @@
53 'PreservePos' : pos,53 'PreservePos' : pos,
54 'IgnoreStack' : ignoreStack,54 'IgnoreStack' : ignoreStack,
55 'StackMatch' : stack,55 'StackMatch' : stack,
56 'RecordAction' : recordAction,
56 }57 }
57 58
5859
5960
=== modified file 'src/ViGedit/bindings/base.py' (properties changed: -x to +x)
--- src/ViGedit/bindings/base.py 2009-06-30 02:54:14 +0000
+++ src/ViGedit/bindings/base.py 2010-02-05 03:26:13 +0000
@@ -38,6 +38,10 @@
38 """Called when no binding has been found and so the mode is left to handle the event"""38 """Called when no binding has been found and so the mode is left to handle the event"""
39 return True39 return True
40 40
41 def ignore(self, vibase, event):
42 """Returns True if this event should be ignored"""
43 return False
44
41 def nop(self, act):45 def nop(self, act):
42 pass46 pass
4347
4448
=== modified file 'src/ViGedit/bindings/block.py' (properties changed: -x to +x)
=== modified file 'src/ViGedit/bindings/capture.py' (properties changed: -x to +x)
--- src/ViGedit/bindings/capture.py 2009-06-30 02:54:14 +0000
+++ src/ViGedit/bindings/capture.py 2010-02-05 03:26:13 +0000
@@ -5,7 +5,8 @@
5 def __init__(self, act, options=None):5 def __init__(self, act, options=None):
6 self.captureNum = 06 self.captureNum = 0
7 self.capturedEvents = []7 self.capturedEvents = []
8 self.startMode = act.modes.command8 self.start = None
9 self.capture = None
9 10
10class Mode(VIG_ModeBase):11class Mode(VIG_ModeBase):
1112
@@ -16,7 +17,8 @@
16 """17 """
17 18
18 def setup(self, act):19 def setup(self, act):
19 self.reg(self.captureNextEvents, act.gtk.keysyms.a, final=True, after=act.modes.command)20 self.reg(self.captureNextEvents, act.gtk.keysyms.a, final=True)
21 self.reg(self.setCaptureMode, act.gtk.keysyms.d, final=True, after=act.modes.command)
20 self.reg(self.setStartMode, act.gtk.keysyms.s, final=True, after=act.modes.command)22 self.reg(self.setStartMode, act.gtk.keysyms.s, final=True, after=act.modes.command)
21 self.reg(self.clearCapturedEvents, act.gtk.keysyms.c, final=True, after=act.modes.command)23 self.reg(self.clearCapturedEvents, act.gtk.keysyms.c, final=True, after=act.modes.command)
22 self.reg(self.emitCapturedEvents, act.gtk.keysyms.e, final=True)24 self.reg(self.emitCapturedEvents, act.gtk.keysyms.e, final=True)
@@ -50,12 +52,15 @@
50 act.vibase.setExtraStatus(num, self.extraStatus)52 act.vibase.setExtraStatus(num, self.extraStatus)
51 options.captureNum = num53 options.captureNum = num
52 54
55 act.bindings.mode = act.modes.command
56 if options.capture:
57 options.captureNum += 1
58 act.keyboard.emitEvent(act, options.capture)
59
53 def capture(act, event):60 def capture(act, event):
54 options = act.vibase.captureOptions61 options = act.vibase.captureOptions
62
55 if options.captureNum > 0:63 if options.captureNum > 0:
56 if not options.startMode and len(options.capturedEvents) == 0:
57 options.startMode = act.bindings.mode
58
59 capturedEvent = act.keyboard.makeEvent(act, event.keyval, event.state)64 capturedEvent = act.keyboard.makeEvent(act, event.keyval, event.state)
60 options.capturedEvents.append(capturedEvent)65 options.capturedEvents.append(capturedEvent)
61 options.captureNum -= 166 options.captureNum -= 1
@@ -66,14 +71,28 @@
66 ### GET START MODE71 ### GET START MODE
67 ########################72 ########################
68 73
74 def setFutureMode(self, act, when, message):
75 act.bindings.mode = act.modes.command
76 act.vibase.setExtraStatus(1, lambda act : " (%s)" % message)
77
78 def getEvent(act, event, when):
79 if type(when) is str:
80 when = (when, )
81
82 for w in when:
83 setattr(act.vibase.captureOptions, w, act.keyboard.makeEvent(act, event.keyval, event.state))
84
85 act.vibase.setRule(1, lambda a, e : getEvent(a, e, when))
86
69 def setStartMode(self, act):87 def setStartMode(self, act):
70 act.bindings.mode = act.modes.command88 when = "start"
71 act.vibase.setExtraStatus(1, lambda : "(next key determines start mode when emmitting captured keys)")89 if not act.vibase.captureOptions.capture:
72 90 when = [when, 'capture']
73 def getStartEvent(act, event):
74 act.vibase.captureOptions['start'] = act.keyboard.makeEvent(act, event.keyval, event.state)
75 91
76 act.vibase.setRule(1, getStartEvent) 92 self.setFutureMode(act, when, "next key determines start mode when emitting captured keys")
93
94 def setCaptureMode(self, act):
95 self.setFutureMode(act, 'capture', "Next key determines mode for capturing keys")
77 96
78 ########################97 ########################
79 ### EMIT98 ### EMIT
@@ -81,7 +100,10 @@
81 100
82 def emitCapturedEvents(self, act):101 def emitCapturedEvents(self, act):
83 options = act.vibase.captureOptions102 options = act.vibase.captureOptions
84 act.bindings.mode = options.startMode103 act.bindings.mode = act.modes.command
104 if options.start:
105 act.keyboard.emitEvent(act, options.start)
106
85 message = "captured keys : ["107 message = "captured keys : ["
86 for event in options.capturedEvents:108 for event in options.capturedEvents:
87 act.keyboard.emitEvent(act, event)109 act.keyboard.emitEvent(act, event)
@@ -96,5 +118,7 @@
96 def clearCapturedEvents(self, act):118 def clearCapturedEvents(self, act):
97 options = act.vibase.captureOptions119 options = act.vibase.captureOptions
98 options.capturedEvents = []120 options.capturedEvents = []
99 optionscaptureNum = 0121 options.captureNum = 0
122 options.start = None
123 options.capture = None
100 124
101125
=== modified file 'src/ViGedit/bindings/change.py' (properties changed: -x to +x)
=== modified file 'src/ViGedit/bindings/command.py' (properties changed: -x to +x)
--- src/ViGedit/bindings/command.py 2009-07-08 05:08:29 +0000
+++ src/ViGedit/bindings/command.py 2010-02-05 03:26:13 +0000
@@ -22,25 +22,27 @@
22 self.reg(act.text.paste_ClipboardAbove, act.gtk.keysyms.P, after=act.modes.command, pos=True, **self.fr)22 self.reg(act.text.paste_ClipboardAbove, act.gtk.keysyms.P, after=act.modes.command, pos=True, **self.fr)
23 self.reg(act.text.paste_ClipboardBelow, act.gtk.keysyms.p, after=act.modes.command, pos=True, **self.fr)23 self.reg(act.text.paste_ClipboardBelow, act.gtk.keysyms.p, after=act.modes.command, pos=True, **self.fr)
2424
25 self.reg(act.others.redo, act.gtk.keysyms.r, True, **self.fr)25 self.reg(act.others.redoLastOperation, act.gtk.keysyms.period, recordAction=False, **self.fr)
26 self.reg(act.others.undo, act.gtk.keysyms.u, **self.fr)26 self.reg(act.others.redo, act.gtk.keysyms.r, True,recordAction=False, **self.fr)
27 self.reg(act.text.delete_Char, act.gtk.keysyms.x, **self.fr)27 self.reg(act.others.undo, act.gtk.keysyms.u, recordAction=False, **self.fr)
28 self.reg(act.others.nextSearchItem, act.gtk.keysyms.n, **self.fr)28 self.reg(act.text.delete_Char, act.gtk.keysyms.x, **self.fr)
29 self.reg(act.text.delete_PrevChar, act.gtk.keysyms.X, **self.fr)29 self.reg(act.getMenu('searchNext'), act.gtk.keysyms.n, **self.fr)
30 self.reg(act.text.delete_Char, act.gtk.keysyms.Delete, **self.fr)30 self.reg(act.getMenu('searchPrev'), act.gtk.keysyms.N, **self.fr)
31 self.reg(act.text.switchChar, act.gtk.keysyms.S, **self.fr)31 self.reg(act.text.delete_PrevChar, act.gtk.keysyms.X, **self.fr)
32 self.reg(act.text.delete_Char, act.gtk.keysyms.Delete, **self.fr)
33 self.reg(act.text.switchChar, act.gtk.keysyms.S, **self.fr)
3234
33 self.reg(act.pos.move_Forward, act.gtk.keysyms.l, **self.fr)35 self.reg(act.pos.move_Forward, act.gtk.keysyms.l, **self.fr)
34 self.reg(act.pos.move_Backward, act.gtk.keysyms.h, **self.fr)36 self.reg(act.pos.move_Backward, act.gtk.keysyms.h, **self.fr)
35 self.reg(act.pos.move_Down, act.gtk.keysyms.j, **self.fr)37 self.reg(act.pos.move_Down, act.gtk.keysyms.j, **self.fr)
36 self.reg(act.pos.move_Up, act.gtk.keysyms.k, **self.fr)38 self.reg(act.pos.move_Up, act.gtk.keysyms.k, **self.fr)
37 self.reg(act.pos.move_WordForward, act.gtk.keysyms.w, **self.fr)39 self.reg(act.pos.move_WordForward, act.gtk.keysyms.w, **self.fr)
38 self.reg(act.pos.move_WordBackward, act.gtk.keysyms.b, **self.fr)40 self.reg(act.pos.move_WordBackward, act.gtk.keysyms.b, **self.fr)
39 self.reg(act.pos.move_BufferEnd, act.gtk.keysyms.G, **self.fr) 41 self.reg(act.pos.move_BufferEnd, act.gtk.keysyms.G, **self.fr)
40 self.reg(act.pos.move_LineBegin, act.gtk.keysyms._0, **self.fr)42 self.reg(act.pos.move_LineBegin, act.gtk.keysyms._0, **self.fr)
41 self.reg(act.pos.move_LineEnd, act.gtk.keysyms.dollar, **self.fr)43 self.reg(act.pos.move_LineEnd, act.gtk.keysyms.dollar, **self.fr)
42 self.reg(act.pos.move_LineBegin, act.gtk.keysyms.asciicircum, **self.fr)44 self.reg(act.pos.move_LineBegin, act.gtk.keysyms.asciicircum, **self.fr)
43 self.reg(act.pos.toEmptyLine, act.gtk.keysyms.E, **self.fr)45 self.reg(act.pos.toEmptyLine, act.gtk.keysyms.E, **self.fr)
4446
45 self.reg(act.pos.move_LineEnd, act.gtk.keysyms.A, after=act.modes.insert, **self.fr)47 self.reg(act.pos.move_LineEnd, act.gtk.keysyms.A, after=act.modes.insert, **self.fr)
46 self.reg(act.pos.move_LineBegin, act.gtk.keysyms.I, after=act.modes.insert, **self.fr)48 self.reg(act.pos.move_LineBegin, act.gtk.keysyms.I, after=act.modes.insert, **self.fr)
@@ -63,5 +65,12 @@
63 (so you can still use ordinary shortcuts in command mode"""65 (so you can still use ordinary shortcuts in command mode"""
64 return not act.keyboard.isModifierPressed(act, event)66 return not act.keyboard.isModifierPressed(act, event)
65 67
68 def ignore(self, vibase, event):
69 if event.keyval == ord('0'):
70 if int(''.join(vibase.number)) > 0:
71 return True
72
73 return False
74
66 75
67 76
6877
=== modified file 'src/ViGedit/bindings/delete.py' (properties changed: -x to +x)
=== modified file 'src/ViGedit/bindings/ex.py' (properties changed: -x to +x)
=== modified file 'src/ViGedit/bindings/g.py' (properties changed: -x to +x)
=== modified file 'src/ViGedit/bindings/indent.py' (properties changed: -x to +x)
=== modified file 'src/ViGedit/bindings/insert.py' (properties changed: -x to +x)
=== modified file 'src/ViGedit/bindings/replace.py' (properties changed: -x to +x)
=== modified file 'src/ViGedit/bindings/selection.py' (properties changed: -x to +x)
=== modified file 'src/ViGedit/bindings/t.py' (properties changed: -x to +x)
=== modified file 'src/ViGedit/bindings/visual.py' (properties changed: -x to +x)
--- src/ViGedit/bindings/visual.py 2009-06-30 02:54:14 +0000
+++ src/ViGedit/bindings/visual.py 2010-02-05 03:26:13 +0000
@@ -27,7 +27,9 @@
27 27
28 self.reg(act.others.undo, act.gtk.keysyms.u, **self.fr)28 self.reg(act.others.undo, act.gtk.keysyms.u, **self.fr)
29 self.reg(act.others.search, act.gtk.keysyms.slash, final=True)29 self.reg(act.others.search, act.gtk.keysyms.slash, final=True)
30 30
31 self.reg(act.lines.select_OneLine, act.gtk.keysyms.V, after=act.modes.visual, final=True)
32
31 self.reg(act.pos.move_LineEnd, act.gtk.keysyms.A, after=act.modes.insert, **self.fr)33 self.reg(act.pos.move_LineEnd, act.gtk.keysyms.A, after=act.modes.insert, **self.fr)
32 self.reg(act.pos.move_LineBegin, act.gtk.keysyms.I, after=act.modes.insert, **self.fr)34 self.reg(act.pos.move_LineBegin, act.gtk.keysyms.I, after=act.modes.insert, **self.fr)
33 self.reg(act.insert.open_LineBelow, act.gtk.keysyms.o, after=act.modes.visual, **self.fr)35 self.reg(act.insert.open_LineBelow, act.gtk.keysyms.o, after=act.modes.visual, **self.fr)
3436
=== modified file 'src/ViGedit/bindings/yank.py' (properties changed: -x to +x)
=== modified file 'src/ViGedit/cursor.py' (properties changed: -x to +x)
=== modified file 'src/ViGedit/keyboard.py' (properties changed: -x to +x)
=== modified file 'src/ViGedit/options.py' (properties changed: -x to +x)
=== modified file 'src/ViGedit/static.py' (properties changed: -x to +x)
--- src/ViGedit/static.py 2009-06-30 02:54:14 +0000
+++ src/ViGedit/static.py 2010-02-05 03:26:13 +0000
@@ -27,7 +27,7 @@
27### MODES27### MODES
28###28###
29########################29########################
30 30
31class VIG_Modes(object):31class VIG_Modes(object):
32 """Holds info on all the modes"""32 """Holds info on all the modes"""
33 33
3434
=== modified file 'src/ViGedit/vi.py' (properties changed: -x to +x)
--- src/ViGedit/vi.py 2009-06-30 02:54:14 +0000
+++ src/ViGedit/vi.py 2010-02-05 03:26:13 +0000
@@ -54,6 +54,7 @@
54 self.returnToMode = None54 self.returnToMode = None
55 self.extraMessage = None 55 self.extraMessage = None
56 self.select = False56 self.select = False
57 self.lastOperation = None
57 58
58 self.viewEvents = [59 self.viewEvents = [
59 self.view.connect("key-press-event", self.onKeyPress),60 self.view.connect("key-press-event", self.onKeyPress),
@@ -137,7 +138,7 @@
137 if callable(rule):138 if callable(rule):
138 rule(self.act, event)139 rule(self.act, event)
139 if life == 0:140 if life == 0:
140 self.rules.remove(1, rule)141 self.rules.remove((1, rule))
141 142
142 # Always return to command mode when Escape is pressed.143 # Always return to command mode when Escape is pressed.
143 if (event.keyval == gtk.keysyms.Escape):144 if (event.keyval == gtk.keysyms.Escape):
@@ -215,11 +216,12 @@
215 control, meta = self.keyboard.modifiers(self.act, event)216 control, meta = self.keyboard.modifiers(self.act, event)
216 self.act.trace.info(1, "\t%s %s %s %s", currentMode, event.keyval, control, meta)217 self.act.trace.info(1, "\t%s %s %s %s", currentMode, event.keyval, control, meta)
217 218
218 #determine if there is a binding, and put it into bindingInfo219 bindingInfo = None
219
220 doPropogate = currentMode != static.modes.insert220 doPropogate = currentMode != static.modes.insert
221 keycombo = [currentMode, event.keyval, control, meta, "".join(self.stack)]221 keycombo = [currentMode, event.keyval, control, meta, "".join(self.stack)]
222 bindingInfo = self.vigtk.registry[(_ for _ in keycombo)]222 #determine if there is a binding, and put it into bindingInfo
223 if not self.bindings.vigm[currentMode].ignore(self, event):
224 bindingInfo = self.vigtk.registry[(_ for _ in keycombo)]
223 225
224 #if no binding, remove stack from keycombo and try again226 #if no binding, remove stack from keycombo and try again
225 if not bindingInfo:227 if not bindingInfo:
@@ -253,36 +255,52 @@
253 isRepeatable = bindingInfo["Repeatable"]255 isRepeatable = bindingInfo["Repeatable"]
254 afterMode = bindingInfo["AfterMode"]256 afterMode = bindingInfo["AfterMode"]
255 preservePos = bindingInfo["PreservePos"]257 preservePos = bindingInfo["PreservePos"]
258 recordAction = bindingInfo["RecordAction"]
256 pos = None259 pos = None
257 260
258 if callable(function):261 if callable(function):
259 args = [self.act]262 def operation(act, preservePos, isRepeatable, isFinal, number, numLines, stack):
260 263 args = [act]
261 if preservePos:264 self.stack = stack
262 pos = self.cursor.getIter(self.act)265 self.numLines = numLines
263 266
264 self.act.trace.info(2, "\tfunction is callable")267 if preservePos:
265 if isRepeatable:268 pos = self.cursor.getIter(self.act)
266 self.act.trace.info(2, "\tfunction is repeatable")269
267 [function(*args) for _ in range(int("".join(self.number or ["1"])) or 1)]270 act.trace.info(2, "\tfunction is callable")
268 271 if isRepeatable:
269 self.act.trace.info(2, "\tresetting numbers")272 act.trace.info(2, "\tfunction is repeatable")
270 self.number = ['0']273 [function(*args) for _ in range(int("".join(number or ["1"])) or 1)]
271 self.numLines = 0274
272 self.stack = []275 act.trace.info(2, "\tresetting numbers")
273 276 self.number = ['0']
274 else:
275 function(*args)
276 self.numLines = int("".join(self.number or ["1"]))
277 self.number = []
278
279 if isFinal:
280 self.act.trace.info(2, "\tfunction is final")
281 self.numLines = 0277 self.numLines = 0
282 self.stack = []278 self.stack = []
283 279
284 if preservePos:280 else:
285 self.cursor.moveInsert(self.act, pos) 281 function(*args)
282 self.numLines = int("".join(self.number or ["1"]))
283 self.number = []
284
285 if isFinal:
286 self.act.trace.info(2, "\tfunction is final")
287 self.numLines = 0
288 self.stack = []
289
290 if preservePos:
291 self.cursor.moveInsert(self.act, pos)
292
293 number = list(self.number)
294 numLines = self.numLines
295
296 op = lambda act : operation(act, preservePos, isRepeatable, isFinal, number, numLines, self.stack)
297
298 if recordAction:
299 #store lastOperation so keybindings can call it again if need be (i.e. . option in command mode)
300 self.lastOperation = op
301
302 #call that operation
303 op(self.act)
286 304
287 else:305 else:
288 self.act.trace.info(2, "\tfunction is not callable")306 self.act.trace.info(2, "\tfunction is not callable")
289307
=== modified file 'src/ViGedit/vigtk.py' (properties changed: -x to +x)
--- src/ViGedit/vigtk.py 2009-06-30 02:54:14 +0000
+++ src/ViGedit/vigtk.py 2010-02-05 03:26:13 +0000
@@ -61,6 +61,7 @@
61 self.menu_save = self.ui_manager.get_action("/MenuBar/FileMenu/FileSaveMenu")61 self.menu_save = self.ui_manager.get_action("/MenuBar/FileMenu/FileSaveMenu")
62 self.menu_saveAs = self.ui_manager.get_action("/MenuBar/FileMenu/FileSaveAsMenu")62 self.menu_saveAs = self.ui_manager.get_action("/MenuBar/FileMenu/FileSaveAsMenu")
63 self.menu_searchNext = self.ui_manager.get_action("/MenuBar/SearchMenu/SearchFindNextMenu")63 self.menu_searchNext = self.ui_manager.get_action("/MenuBar/SearchMenu/SearchFindNextMenu")
64 self.menu_searchPrev = self.ui_manager.get_action("/MenuBar/SearchMenu/SearchFindPreviousMenu")
64 self.menu_quit = self.ui_manager.get_action("/MenuBar/FileMenu/FileQuitMenu")65 self.menu_quit = self.ui_manager.get_action("/MenuBar/FileMenu/FileQuitMenu")
65 self.menu_fileClose = self.ui_manager.get_action("/MenuBar/FileMenu/FileCloseMenu")66 self.menu_fileClose = self.ui_manager.get_action("/MenuBar/FileMenu/FileCloseMenu")
66 self.menu_indentRight = self.ui_manager.get_action("/MenuBar/EditMenu/EditOps_5/Indent")67 self.menu_indentRight = self.ui_manager.get_action("/MenuBar/EditMenu/EditOps_5/Indent")
6768
=== modified file 'src/autotab/ChangeLog (Case Conflict 1)' (properties changed: -x to +x)
=== modified file 'src/autotab/README' (properties changed: -x to +x)
=== modified file 'src/autotab/autotab.py' (properties changed: -x to +x)

Subscribers

People subscribed via source and target branches

to all changes: