Merge lp:vigedit into lp:~tristil/vigedit/main-method
- vigedit-additions
- Merge into 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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Joseph Method | Pending | ||
Review via email: mp+18518@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Lauri Niskanen (ape3000) wrote : | # |
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
1 | === modified file 'AUTHORS' (properties changed: -x to +x) |
2 | === modified file 'ChangeLog' (properties changed: -x to +x) |
3 | === modified file 'TODO' (properties changed: -x to +x) |
4 | === modified file 'data/autotab.gedit-plugin' (properties changed: -x to +x) |
5 | === modified file 'data/vigedit.gedit-plugin' (properties changed: -x to +x) |
6 | === modified file 'docs/chart.png' (properties changed: -x to +x) |
7 | === modified file 'docs/chart.svg' (properties changed: -x to +x) |
8 | === modified file 'docs/documentation.odt' (properties changed: -x to +x) |
9 | === modified file 'docs/documentation.pdf' (properties changed: -x to +x) |
10 | === modified file 'gpl.txt' (properties changed: -x to +x) |
11 | === modified file 'install.py' (properties changed: -x to +x) |
12 | --- install.py 2009-07-10 19:55:25 +0000 |
13 | +++ install.py 2010-02-05 03:26:13 +0000 |
14 | @@ -1,6 +1,7 @@ |
15 | #!/usr/bin/env python |
16 | |
17 | import os |
18 | +<<<<<<< TREE |
19 | from distutils.file_util import * |
20 | from distutils.dir_util import * |
21 | |
22 | @@ -29,3 +30,163 @@ |
23 | # Considering integration with other plugins |
24 | # install_plugin("classbrowser") |
25 | |
26 | +======= |
27 | +import sys |
28 | +import shutil |
29 | +from distutils.dir_util import copy_tree |
30 | +class Complaint(Exception): pass |
31 | + |
32 | +class Installer(object): |
33 | + def __init__(self, base=None, plugins=None): |
34 | + |
35 | + self.availablePlugins = ['ViGedit', 'autotab'] |
36 | + |
37 | + try: |
38 | + if not base: |
39 | + self.base = os.sep.join([os.environ['HOME'], '.gnome2', 'gedit']) |
40 | + else: |
41 | + self.flag_base(base) |
42 | + |
43 | + if not plugins: |
44 | + self.plugins = [p for p in self.availablePlugins] |
45 | + else: |
46 | + self.flag_plugins(plugins) |
47 | + |
48 | + except Complaint, c: |
49 | + self.error(c) |
50 | + |
51 | + self.flags = ( |
52 | + (['--help', '-h'], "Show help", self.flag_help, False), |
53 | + (['--base', '-b'], "Specify folder that holds plugins folder (default : %s)" % base, self.flag_base, True), |
54 | + ( |
55 | + ['--plugins', '-p'], |
56 | + "Comma seperated list of desired plugins to install (available : %s)" % ','.join(self.availablePlugins), |
57 | + self.flag_plugins, |
58 | + True |
59 | + ), |
60 | + ) |
61 | + |
62 | + self.register = {} |
63 | + for flags, _, func, needsArg in self.flags: |
64 | + for flag in flags: |
65 | + self.register[flag] = (func, needsArg) |
66 | + |
67 | + def error(self, error): |
68 | + print "\nERROR : %s\n" % error |
69 | + exit() |
70 | + |
71 | + def copy(self, plugin, src, dest): |
72 | + if os.path.exists(src): |
73 | + if os.path.isdir(src): |
74 | + print "Copying directory %s to %s" % (src, dest) |
75 | + pluginFolder = os.sep.join([dest, plugin]) |
76 | + if not os.path.exists(pluginFolder): |
77 | + os.mkdir(pluginFolder) |
78 | + |
79 | + copy_tree(src, pluginFolder) |
80 | + else: |
81 | + print "Copying file %s to %s" % (src, dest) |
82 | + shutil.copy(src, dest) |
83 | + |
84 | + else: |
85 | + raise Complaint("%s doesn't exist" % src) |
86 | + |
87 | + ######################## |
88 | + ### FLAGS |
89 | + ######################## |
90 | + |
91 | + def flag_help(self, arg=None): |
92 | + print "Usage : python install.py [options]" |
93 | + print "-----------------------------------" |
94 | + lines = [] |
95 | + for flags, message, _, _ in self.flags: |
96 | + lines.append((', '.join(flags), message)) |
97 | + |
98 | + l1 = max(len(flags) for flags, _ in lines) |
99 | + s = "%%-%ds : %%s" % l1 |
100 | + for flags, message in lines: |
101 | + print s % (flags, message) |
102 | + |
103 | + exit() |
104 | + |
105 | + def flag_base(self, arg): |
106 | + self.base = arg |
107 | + |
108 | + def flag_plugins(self, arg): |
109 | + plugins = [p.lstrip().rstrip().lower() for p in arg.split(',')] |
110 | + |
111 | + if not plugins: |
112 | + raise Complaint("You need to install atleast one plugin") |
113 | + |
114 | + available = dict([(p.lower(), p) for p in self.availablePlugins]) |
115 | + matched = [] |
116 | + |
117 | + #ensuring correct case |
118 | + for plugin in plugins: |
119 | + if plugin in available.keys(): |
120 | + matched.append(available[plugin]) |
121 | + else: |
122 | + raise Complaint("%s is not an available plugin" % plugin) |
123 | + |
124 | + self.plugins = matched |
125 | + |
126 | + ######################## |
127 | + ### INSTALLER |
128 | + ######################## |
129 | + |
130 | + def install(self): |
131 | + pluginDir = os.sep.join([self.base, 'plugins']) |
132 | + if not os.path.exists(pluginDir): |
133 | + os.makedirs(pluginDir) |
134 | + |
135 | + for plugin in self.plugins: |
136 | + # copy gedit-plugin file |
137 | + geditPluginFile = os.sep.join(['data', '%s.gedit-plugin' % plugin.lower()]) |
138 | + self.copy(plugin, geditPluginFile, pluginDir) |
139 | + |
140 | + initFile = os.sep.join(['src', plugin, '__init__.py']) |
141 | + singleFile = os.sep.join(['src', plugin, '%s.py' % plugin]) |
142 | + |
143 | + if not os.path.exists(initFile): |
144 | + # installing a single file |
145 | + self.copy(plugin, singleFile, pluginDir) |
146 | + |
147 | + else: |
148 | + #installing directory |
149 | + self.copy(plugin, os.sep.join(['src', plugin]), pluginDir) |
150 | + |
151 | + ######################## |
152 | + ### MAIN |
153 | + ######################## |
154 | + |
155 | + def main(self): |
156 | + args = sys.argv[1:] |
157 | + index = 0 |
158 | + try: |
159 | + while index < len(args): |
160 | + flag = args[index] |
161 | + if flag.startswith('-'): |
162 | + if flag in self.register: |
163 | + func, needsArg = self.register[flag] |
164 | + if needsArg: |
165 | + index += 1 |
166 | + if index >= len(args): |
167 | + raise Complaint("%s flag needs a following arguement" % flag) |
168 | + func(args[index]) |
169 | + else: |
170 | + func() |
171 | + else: |
172 | + raise Complaint("%s is an unkown flag" % flag) |
173 | + else: |
174 | + raise Complaint("All arguements must be preceded by a flag. Try --help or -h") |
175 | + |
176 | + index += 1 |
177 | + |
178 | + self.install() |
179 | + |
180 | + except Complaint, c: |
181 | + self.error(c) |
182 | + |
183 | +if __name__ == '__main__': |
184 | + Installer().main() |
185 | +>>>>>>> MERGE-SOURCE |
186 | |
187 | === modified file 'src/ViGedit/__init__.py' (properties changed: -x to +x) |
188 | === modified file 'src/ViGedit/actions/__init__.py' (properties changed: -x to +x) |
189 | === modified file 'src/ViGedit/actions/blocks.py' (properties changed: -x to +x) |
190 | === modified file 'src/ViGedit/actions/ex.py' (properties changed: -x to +x) |
191 | --- src/ViGedit/actions/ex.py 2009-07-01 03:43:42 +0000 |
192 | +++ src/ViGedit/actions/ex.py 2010-02-05 03:26:13 +0000 |
193 | @@ -123,6 +123,16 @@ |
194 | terminal = act.others.getTerminal(act) |
195 | terminal._vte.feed_child(terminalCommand + "\n") |
196 | |
197 | +@regexDec("printall") |
198 | +def ex_PrintAll(act, command, result): |
199 | + location = "%s/Desktop" % os.environ['HOME'] |
200 | + act.others.printall(act, location) |
201 | + |
202 | +@regexDec("printall (.+)") |
203 | +def ex_PrintAllLoc(act, command, result): |
204 | + location = result.group(1) |
205 | + act.others.printall(act, location) |
206 | + |
207 | @regexDec(r's/(?P<search>(?:\\.|(?!/)[^\\])+)(/(?P<replace>(?:\\.|(?!/)[^\\])+)(/(?P<options>.+))?)?') |
208 | def ex_Search(act, command, result): |
209 | search = result.groupdict()['search'] |
210 | |
211 | === modified file 'src/ViGedit/actions/fileOperations.py' (properties changed: -x to +x) |
212 | === modified file 'src/ViGedit/actions/insert.py' (properties changed: -x to +x) |
213 | === modified file 'src/ViGedit/actions/lines.py' (properties changed: -x to +x) |
214 | --- src/ViGedit/actions/lines.py 2009-06-30 02:54:14 +0000 |
215 | +++ src/ViGedit/actions/lines.py 2010-02-05 03:26:13 +0000 |
216 | @@ -16,6 +16,10 @@ |
217 | select_OneLine(act) |
218 | |
219 | def select_OneLine(act): |
220 | + |
221 | + if act.mode == act.modes.visual: |
222 | + act.bindings.mode = act.modes.command |
223 | + |
224 | act.pos.move_LineBegin(act) |
225 | |
226 | cursor = act.pos.getIter(act) |
227 | @@ -27,6 +31,10 @@ |
228 | act.pos.moveInsert(act, cursor, True) |
229 | |
230 | def select_ManyLines(act, number): |
231 | + |
232 | + if act.mode == act.modes.visual: |
233 | + act.bindings.mode = act.modes.command |
234 | + |
235 | if type(number) in (list, tuple): |
236 | try: |
237 | number = int("".join(number)) |
238 | @@ -35,8 +43,12 @@ |
239 | |
240 | act.pos.move_LineBegin(act) |
241 | cursor = act.pos.getIter(act) |
242 | + l1 = cursor.get_line() |
243 | cursor.forward_lines(number) |
244 | - |
245 | + l2 = cursor.get_line() |
246 | + if abs(l1 - l2) == number: |
247 | + cursor.backward_char() |
248 | + |
249 | act.pos.moveInsert(act, cursor, True) |
250 | |
251 | def getLinesTillEnd(act): |
252 | |
253 | === modified file 'src/ViGedit/actions/others.py' (properties changed: -x to +x) |
254 | --- src/ViGedit/actions/others.py 2009-06-30 02:54:14 +0000 |
255 | +++ src/ViGedit/actions/others.py 2010-02-05 03:26:13 +0000 |
256 | @@ -1,8 +1,6 @@ |
257 | +from gtk import PrintOperation, PageSetup |
258 | +import gtksourceview2 |
259 | import gobject |
260 | - |
261 | -def nextSearchItem(act): |
262 | - if act.vibase.doc.get_can_search_again(): |
263 | - act.menus["searchNext"].activate() |
264 | |
265 | def search(act): |
266 | act.vibase.view.emit("start_interactive_search") |
267 | @@ -22,4 +20,38 @@ |
268 | if len(notebook.get_children()) != 0: |
269 | terminal = notebook.get_children()[1] |
270 | return terminal |
271 | - return None |
272 | + return None |
273 | + |
274 | +def redoLastOperation(act): |
275 | + act.vibase.lastOperation(act) |
276 | + |
277 | +def draw_page(operation, context, page_nr, compositor): |
278 | + compositor.draw_page(context, page_nr) |
279 | + |
280 | +def begin_print(operation, context, compositor): |
281 | + n_pages = 1 |
282 | + while not compositor.paginate(context): |
283 | + pass |
284 | + |
285 | + n_pages = compositor.get_n_pages() |
286 | + operation.set_n_pages(n_pages) |
287 | + |
288 | +def printall(act, location): |
289 | + views = [view for view in act.vigtk.window.get_views()] |
290 | + |
291 | + count = 1 |
292 | + for view in views: |
293 | + |
294 | + po = PrintOperation() |
295 | + setup = PageSetup() |
296 | + po.set_default_page_setup(setup) |
297 | + |
298 | + po.set_export_filename("%s/%d.pdf" % (location, count)) |
299 | + count += 1 |
300 | + |
301 | + pc = gtksourceview2.print_compositor_new_from_view(view) |
302 | + |
303 | + po.connect("begin_print", begin_print, pc) |
304 | + po.connect("draw_page", draw_page, pc) |
305 | + |
306 | + res = po.run(act.gtk.PRINT_OPERATION_ACTION_EXPORT) |
307 | |
308 | === modified file 'src/ViGedit/actions/text.py' (properties changed: -x to +x) |
309 | --- src/ViGedit/actions/text.py 2009-07-08 05:08:29 +0000 |
310 | +++ src/ViGedit/actions/text.py 2010-02-05 03:26:13 +0000 |
311 | @@ -4,23 +4,31 @@ |
312 | ### |
313 | ######################## |
314 | |
315 | -def delete_PrevChar(act): |
316 | - oldMode = act.bindings.mode |
317 | - act.bindings.mode = act.modes.visual |
318 | - act.pos.move_Backward(act, True) |
319 | - cut_Selection(act) |
320 | - act.bindings.mode = oldMode |
321 | - #act.vibase.doc.backspace(act.pos.getIter(act), False, True) |
322 | +def delete_PrevChar(act, withBackSpace=False): |
323 | + if withBackSpace: |
324 | + act.vibase.doc.backspace(act.pos.getIter(act), False, True) |
325 | + else: |
326 | + oldMode = act.bindings.mode |
327 | + act.bindings.mode = act.modes.visual |
328 | + act.pos.move_Backward(act, True) |
329 | + cut_Selection(act) |
330 | + act.bindings.mode = oldMode |
331 | |
332 | -def delete_Char(act): |
333 | +def delete_Char(act, withBackSpace=False): |
334 | act.pos.move_Forward(act) |
335 | - delete_PrevChar(act) |
336 | + delete_PrevChar(act, withBackSpace) |
337 | |
338 | def delete_WholeLines(act): |
339 | number = act.vibase.numLines |
340 | act.lines.select_Lines(act, number) |
341 | cut_Selection(act) |
342 | - act.text.delete_Char(act) |
343 | + cursor = act.pos.getIter(act) |
344 | + line = cursor.get_line() |
345 | + if line > 0: |
346 | + delete_PrevChar(act, withBackSpace=True) |
347 | + act.pos.move_Forward(act) |
348 | + else: |
349 | + delete_Char(act, withBackSpace=True) |
350 | |
351 | def delete_ToLineEnd(act): |
352 | act.lines.select_ToLineEnd(act) |
353 | |
354 | === modified file 'src/ViGedit/actions/trace.py' (properties changed: -x to +x) |
355 | --- src/ViGedit/actions/trace.py 2009-06-30 02:54:14 +0000 |
356 | +++ src/ViGedit/actions/trace.py 2010-02-05 03:26:13 +0000 |
357 | @@ -35,8 +35,8 @@ |
358 | |
359 | def intro(mode=None, message=None, *args): |
360 | if message: |
361 | - info(1, message, *args, color=MAGNETA) |
362 | + info(1, message, *args, **{'color' : MAGNETA}) |
363 | else: |
364 | - info(1, "Introducing %s mode", mode.mode, color=MAGNETA) |
365 | + info(1, "Introducing %s mode", mode.mode, **{'color' : MAGNETA}) |
366 | |
367 | |
368 | |
369 | === modified file 'src/ViGedit/bindings/__init__.py' (properties changed: -x to +x) |
370 | --- src/ViGedit/bindings/__init__.py 2009-06-30 02:54:14 +0000 |
371 | +++ src/ViGedit/bindings/__init__.py 2010-02-05 03:26:13 +0000 |
372 | @@ -31,7 +31,7 @@ |
373 | |
374 | def register(self, mode, function, keycode, control=False, meta=False, |
375 | final=False, repeat=False, after=None, pos=False, |
376 | - ignoreStack=False, stack = ""): |
377 | + ignoreStack=False, stack = "", recordAction = True): |
378 | |
379 | keycombo = keycode, control, meta, stack |
380 | try: |
381 | @@ -53,6 +53,7 @@ |
382 | 'PreservePos' : pos, |
383 | 'IgnoreStack' : ignoreStack, |
384 | 'StackMatch' : stack, |
385 | + 'RecordAction' : recordAction, |
386 | } |
387 | |
388 | |
389 | |
390 | === modified file 'src/ViGedit/bindings/base.py' (properties changed: -x to +x) |
391 | --- src/ViGedit/bindings/base.py 2009-06-30 02:54:14 +0000 |
392 | +++ src/ViGedit/bindings/base.py 2010-02-05 03:26:13 +0000 |
393 | @@ -38,6 +38,10 @@ |
394 | """Called when no binding has been found and so the mode is left to handle the event""" |
395 | return True |
396 | |
397 | + def ignore(self, vibase, event): |
398 | + """Returns True if this event should be ignored""" |
399 | + return False |
400 | + |
401 | def nop(self, act): |
402 | pass |
403 | |
404 | |
405 | === modified file 'src/ViGedit/bindings/block.py' (properties changed: -x to +x) |
406 | === modified file 'src/ViGedit/bindings/capture.py' (properties changed: -x to +x) |
407 | --- src/ViGedit/bindings/capture.py 2009-06-30 02:54:14 +0000 |
408 | +++ src/ViGedit/bindings/capture.py 2010-02-05 03:26:13 +0000 |
409 | @@ -5,7 +5,8 @@ |
410 | def __init__(self, act, options=None): |
411 | self.captureNum = 0 |
412 | self.capturedEvents = [] |
413 | - self.startMode = act.modes.command |
414 | + self.start = None |
415 | + self.capture = None |
416 | |
417 | class Mode(VIG_ModeBase): |
418 | |
419 | @@ -16,7 +17,8 @@ |
420 | """ |
421 | |
422 | def setup(self, act): |
423 | - self.reg(self.captureNextEvents, act.gtk.keysyms.a, final=True, after=act.modes.command) |
424 | + self.reg(self.captureNextEvents, act.gtk.keysyms.a, final=True) |
425 | + self.reg(self.setCaptureMode, act.gtk.keysyms.d, final=True, after=act.modes.command) |
426 | self.reg(self.setStartMode, act.gtk.keysyms.s, final=True, after=act.modes.command) |
427 | self.reg(self.clearCapturedEvents, act.gtk.keysyms.c, final=True, after=act.modes.command) |
428 | self.reg(self.emitCapturedEvents, act.gtk.keysyms.e, final=True) |
429 | @@ -50,12 +52,15 @@ |
430 | act.vibase.setExtraStatus(num, self.extraStatus) |
431 | options.captureNum = num |
432 | |
433 | + act.bindings.mode = act.modes.command |
434 | + if options.capture: |
435 | + options.captureNum += 1 |
436 | + act.keyboard.emitEvent(act, options.capture) |
437 | + |
438 | def capture(act, event): |
439 | options = act.vibase.captureOptions |
440 | + |
441 | if options.captureNum > 0: |
442 | - if not options.startMode and len(options.capturedEvents) == 0: |
443 | - options.startMode = act.bindings.mode |
444 | - |
445 | capturedEvent = act.keyboard.makeEvent(act, event.keyval, event.state) |
446 | options.capturedEvents.append(capturedEvent) |
447 | options.captureNum -= 1 |
448 | @@ -66,14 +71,28 @@ |
449 | ### GET START MODE |
450 | ######################## |
451 | |
452 | + def setFutureMode(self, act, when, message): |
453 | + act.bindings.mode = act.modes.command |
454 | + act.vibase.setExtraStatus(1, lambda act : " (%s)" % message) |
455 | + |
456 | + def getEvent(act, event, when): |
457 | + if type(when) is str: |
458 | + when = (when, ) |
459 | + |
460 | + for w in when: |
461 | + setattr(act.vibase.captureOptions, w, act.keyboard.makeEvent(act, event.keyval, event.state)) |
462 | + |
463 | + act.vibase.setRule(1, lambda a, e : getEvent(a, e, when)) |
464 | + |
465 | def setStartMode(self, act): |
466 | - act.bindings.mode = act.modes.command |
467 | - act.vibase.setExtraStatus(1, lambda : "(next key determines start mode when emmitting captured keys)") |
468 | - |
469 | - def getStartEvent(act, event): |
470 | - act.vibase.captureOptions['start'] = act.keyboard.makeEvent(act, event.keyval, event.state) |
471 | + when = "start" |
472 | + if not act.vibase.captureOptions.capture: |
473 | + when = [when, 'capture'] |
474 | |
475 | - act.vibase.setRule(1, getStartEvent) |
476 | + self.setFutureMode(act, when, "next key determines start mode when emitting captured keys") |
477 | + |
478 | + def setCaptureMode(self, act): |
479 | + self.setFutureMode(act, 'capture', "Next key determines mode for capturing keys") |
480 | |
481 | ######################## |
482 | ### EMIT |
483 | @@ -81,7 +100,10 @@ |
484 | |
485 | def emitCapturedEvents(self, act): |
486 | options = act.vibase.captureOptions |
487 | - act.bindings.mode = options.startMode |
488 | + act.bindings.mode = act.modes.command |
489 | + if options.start: |
490 | + act.keyboard.emitEvent(act, options.start) |
491 | + |
492 | message = "captured keys : [" |
493 | for event in options.capturedEvents: |
494 | act.keyboard.emitEvent(act, event) |
495 | @@ -96,5 +118,7 @@ |
496 | def clearCapturedEvents(self, act): |
497 | options = act.vibase.captureOptions |
498 | options.capturedEvents = [] |
499 | - optionscaptureNum = 0 |
500 | + options.captureNum = 0 |
501 | + options.start = None |
502 | + options.capture = None |
503 | |
504 | |
505 | === modified file 'src/ViGedit/bindings/change.py' (properties changed: -x to +x) |
506 | === modified file 'src/ViGedit/bindings/command.py' (properties changed: -x to +x) |
507 | --- src/ViGedit/bindings/command.py 2009-07-08 05:08:29 +0000 |
508 | +++ src/ViGedit/bindings/command.py 2010-02-05 03:26:13 +0000 |
509 | @@ -22,25 +22,27 @@ |
510 | self.reg(act.text.paste_ClipboardAbove, act.gtk.keysyms.P, after=act.modes.command, pos=True, **self.fr) |
511 | self.reg(act.text.paste_ClipboardBelow, act.gtk.keysyms.p, after=act.modes.command, pos=True, **self.fr) |
512 | |
513 | - self.reg(act.others.redo, act.gtk.keysyms.r, True, **self.fr) |
514 | - self.reg(act.others.undo, act.gtk.keysyms.u, **self.fr) |
515 | - self.reg(act.text.delete_Char, act.gtk.keysyms.x, **self.fr) |
516 | - self.reg(act.others.nextSearchItem, act.gtk.keysyms.n, **self.fr) |
517 | - self.reg(act.text.delete_PrevChar, act.gtk.keysyms.X, **self.fr) |
518 | - self.reg(act.text.delete_Char, act.gtk.keysyms.Delete, **self.fr) |
519 | - self.reg(act.text.switchChar, act.gtk.keysyms.S, **self.fr) |
520 | + self.reg(act.others.redoLastOperation, act.gtk.keysyms.period, recordAction=False, **self.fr) |
521 | + self.reg(act.others.redo, act.gtk.keysyms.r, True,recordAction=False, **self.fr) |
522 | + self.reg(act.others.undo, act.gtk.keysyms.u, recordAction=False, **self.fr) |
523 | + self.reg(act.text.delete_Char, act.gtk.keysyms.x, **self.fr) |
524 | + self.reg(act.getMenu('searchNext'), act.gtk.keysyms.n, **self.fr) |
525 | + self.reg(act.getMenu('searchPrev'), act.gtk.keysyms.N, **self.fr) |
526 | + self.reg(act.text.delete_PrevChar, act.gtk.keysyms.X, **self.fr) |
527 | + self.reg(act.text.delete_Char, act.gtk.keysyms.Delete, **self.fr) |
528 | + self.reg(act.text.switchChar, act.gtk.keysyms.S, **self.fr) |
529 | |
530 | - self.reg(act.pos.move_Forward, act.gtk.keysyms.l, **self.fr) |
531 | - self.reg(act.pos.move_Backward, act.gtk.keysyms.h, **self.fr) |
532 | - self.reg(act.pos.move_Down, act.gtk.keysyms.j, **self.fr) |
533 | - self.reg(act.pos.move_Up, act.gtk.keysyms.k, **self.fr) |
534 | - self.reg(act.pos.move_WordForward, act.gtk.keysyms.w, **self.fr) |
535 | - self.reg(act.pos.move_WordBackward, act.gtk.keysyms.b, **self.fr) |
536 | - self.reg(act.pos.move_BufferEnd, act.gtk.keysyms.G, **self.fr) |
537 | - self.reg(act.pos.move_LineBegin, act.gtk.keysyms._0, **self.fr) |
538 | - self.reg(act.pos.move_LineEnd, act.gtk.keysyms.dollar, **self.fr) |
539 | - self.reg(act.pos.move_LineBegin, act.gtk.keysyms.asciicircum, **self.fr) |
540 | - self.reg(act.pos.toEmptyLine, act.gtk.keysyms.E, **self.fr) |
541 | + self.reg(act.pos.move_Forward, act.gtk.keysyms.l, **self.fr) |
542 | + self.reg(act.pos.move_Backward, act.gtk.keysyms.h, **self.fr) |
543 | + self.reg(act.pos.move_Down, act.gtk.keysyms.j, **self.fr) |
544 | + self.reg(act.pos.move_Up, act.gtk.keysyms.k, **self.fr) |
545 | + self.reg(act.pos.move_WordForward, act.gtk.keysyms.w, **self.fr) |
546 | + self.reg(act.pos.move_WordBackward, act.gtk.keysyms.b, **self.fr) |
547 | + self.reg(act.pos.move_BufferEnd, act.gtk.keysyms.G, **self.fr) |
548 | + self.reg(act.pos.move_LineBegin, act.gtk.keysyms._0, **self.fr) |
549 | + self.reg(act.pos.move_LineEnd, act.gtk.keysyms.dollar, **self.fr) |
550 | + self.reg(act.pos.move_LineBegin, act.gtk.keysyms.asciicircum, **self.fr) |
551 | + self.reg(act.pos.toEmptyLine, act.gtk.keysyms.E, **self.fr) |
552 | |
553 | self.reg(act.pos.move_LineEnd, act.gtk.keysyms.A, after=act.modes.insert, **self.fr) |
554 | self.reg(act.pos.move_LineBegin, act.gtk.keysyms.I, after=act.modes.insert, **self.fr) |
555 | @@ -63,5 +65,12 @@ |
556 | (so you can still use ordinary shortcuts in command mode""" |
557 | return not act.keyboard.isModifierPressed(act, event) |
558 | |
559 | + def ignore(self, vibase, event): |
560 | + if event.keyval == ord('0'): |
561 | + if int(''.join(vibase.number)) > 0: |
562 | + return True |
563 | + |
564 | + return False |
565 | + |
566 | |
567 | |
568 | |
569 | === modified file 'src/ViGedit/bindings/delete.py' (properties changed: -x to +x) |
570 | === modified file 'src/ViGedit/bindings/ex.py' (properties changed: -x to +x) |
571 | === modified file 'src/ViGedit/bindings/g.py' (properties changed: -x to +x) |
572 | === modified file 'src/ViGedit/bindings/indent.py' (properties changed: -x to +x) |
573 | === modified file 'src/ViGedit/bindings/insert.py' (properties changed: -x to +x) |
574 | === modified file 'src/ViGedit/bindings/replace.py' (properties changed: -x to +x) |
575 | === modified file 'src/ViGedit/bindings/selection.py' (properties changed: -x to +x) |
576 | === modified file 'src/ViGedit/bindings/t.py' (properties changed: -x to +x) |
577 | === modified file 'src/ViGedit/bindings/visual.py' (properties changed: -x to +x) |
578 | --- src/ViGedit/bindings/visual.py 2009-06-30 02:54:14 +0000 |
579 | +++ src/ViGedit/bindings/visual.py 2010-02-05 03:26:13 +0000 |
580 | @@ -27,7 +27,9 @@ |
581 | |
582 | self.reg(act.others.undo, act.gtk.keysyms.u, **self.fr) |
583 | self.reg(act.others.search, act.gtk.keysyms.slash, final=True) |
584 | - |
585 | + |
586 | + self.reg(act.lines.select_OneLine, act.gtk.keysyms.V, after=act.modes.visual, final=True) |
587 | + |
588 | self.reg(act.pos.move_LineEnd, act.gtk.keysyms.A, after=act.modes.insert, **self.fr) |
589 | self.reg(act.pos.move_LineBegin, act.gtk.keysyms.I, after=act.modes.insert, **self.fr) |
590 | self.reg(act.insert.open_LineBelow, act.gtk.keysyms.o, after=act.modes.visual, **self.fr) |
591 | |
592 | === modified file 'src/ViGedit/bindings/yank.py' (properties changed: -x to +x) |
593 | === modified file 'src/ViGedit/cursor.py' (properties changed: -x to +x) |
594 | === modified file 'src/ViGedit/keyboard.py' (properties changed: -x to +x) |
595 | === modified file 'src/ViGedit/options.py' (properties changed: -x to +x) |
596 | === modified file 'src/ViGedit/static.py' (properties changed: -x to +x) |
597 | --- src/ViGedit/static.py 2009-06-30 02:54:14 +0000 |
598 | +++ src/ViGedit/static.py 2010-02-05 03:26:13 +0000 |
599 | @@ -27,7 +27,7 @@ |
600 | ### MODES |
601 | ### |
602 | ######################## |
603 | - |
604 | + |
605 | class VIG_Modes(object): |
606 | """Holds info on all the modes""" |
607 | |
608 | |
609 | === modified file 'src/ViGedit/vi.py' (properties changed: -x to +x) |
610 | --- src/ViGedit/vi.py 2009-06-30 02:54:14 +0000 |
611 | +++ src/ViGedit/vi.py 2010-02-05 03:26:13 +0000 |
612 | @@ -54,6 +54,7 @@ |
613 | self.returnToMode = None |
614 | self.extraMessage = None |
615 | self.select = False |
616 | + self.lastOperation = None |
617 | |
618 | self.viewEvents = [ |
619 | self.view.connect("key-press-event", self.onKeyPress), |
620 | @@ -137,7 +138,7 @@ |
621 | if callable(rule): |
622 | rule(self.act, event) |
623 | if life == 0: |
624 | - self.rules.remove(1, rule) |
625 | + self.rules.remove((1, rule)) |
626 | |
627 | # Always return to command mode when Escape is pressed. |
628 | if (event.keyval == gtk.keysyms.Escape): |
629 | @@ -215,11 +216,12 @@ |
630 | control, meta = self.keyboard.modifiers(self.act, event) |
631 | self.act.trace.info(1, "\t%s %s %s %s", currentMode, event.keyval, control, meta) |
632 | |
633 | - #determine if there is a binding, and put it into bindingInfo |
634 | - |
635 | + bindingInfo = None |
636 | doPropogate = currentMode != static.modes.insert |
637 | keycombo = [currentMode, event.keyval, control, meta, "".join(self.stack)] |
638 | - bindingInfo = self.vigtk.registry[(_ for _ in keycombo)] |
639 | + #determine if there is a binding, and put it into bindingInfo |
640 | + if not self.bindings.vigm[currentMode].ignore(self, event): |
641 | + bindingInfo = self.vigtk.registry[(_ for _ in keycombo)] |
642 | |
643 | #if no binding, remove stack from keycombo and try again |
644 | if not bindingInfo: |
645 | @@ -253,36 +255,52 @@ |
646 | isRepeatable = bindingInfo["Repeatable"] |
647 | afterMode = bindingInfo["AfterMode"] |
648 | preservePos = bindingInfo["PreservePos"] |
649 | + recordAction = bindingInfo["RecordAction"] |
650 | pos = None |
651 | |
652 | if callable(function): |
653 | - args = [self.act] |
654 | - |
655 | - if preservePos: |
656 | - pos = self.cursor.getIter(self.act) |
657 | - |
658 | - self.act.trace.info(2, "\tfunction is callable") |
659 | - if isRepeatable: |
660 | - self.act.trace.info(2, "\tfunction is repeatable") |
661 | - [function(*args) for _ in range(int("".join(self.number or ["1"])) or 1)] |
662 | - |
663 | - self.act.trace.info(2, "\tresetting numbers") |
664 | - self.number = ['0'] |
665 | - self.numLines = 0 |
666 | - self.stack = [] |
667 | - |
668 | - else: |
669 | - function(*args) |
670 | - self.numLines = int("".join(self.number or ["1"])) |
671 | - self.number = [] |
672 | - |
673 | - if isFinal: |
674 | - self.act.trace.info(2, "\tfunction is final") |
675 | + def operation(act, preservePos, isRepeatable, isFinal, number, numLines, stack): |
676 | + args = [act] |
677 | + self.stack = stack |
678 | + self.numLines = numLines |
679 | + |
680 | + if preservePos: |
681 | + pos = self.cursor.getIter(self.act) |
682 | + |
683 | + act.trace.info(2, "\tfunction is callable") |
684 | + if isRepeatable: |
685 | + act.trace.info(2, "\tfunction is repeatable") |
686 | + [function(*args) for _ in range(int("".join(number or ["1"])) or 1)] |
687 | + |
688 | + act.trace.info(2, "\tresetting numbers") |
689 | + self.number = ['0'] |
690 | self.numLines = 0 |
691 | self.stack = [] |
692 | - |
693 | - if preservePos: |
694 | - self.cursor.moveInsert(self.act, pos) |
695 | + |
696 | + else: |
697 | + function(*args) |
698 | + self.numLines = int("".join(self.number or ["1"])) |
699 | + self.number = [] |
700 | + |
701 | + if isFinal: |
702 | + self.act.trace.info(2, "\tfunction is final") |
703 | + self.numLines = 0 |
704 | + self.stack = [] |
705 | + |
706 | + if preservePos: |
707 | + self.cursor.moveInsert(self.act, pos) |
708 | + |
709 | + number = list(self.number) |
710 | + numLines = self.numLines |
711 | + |
712 | + op = lambda act : operation(act, preservePos, isRepeatable, isFinal, number, numLines, self.stack) |
713 | + |
714 | + if recordAction: |
715 | + #store lastOperation so keybindings can call it again if need be (i.e. . option in command mode) |
716 | + self.lastOperation = op |
717 | + |
718 | + #call that operation |
719 | + op(self.act) |
720 | |
721 | else: |
722 | self.act.trace.info(2, "\tfunction is not callable") |
723 | |
724 | === modified file 'src/ViGedit/vigtk.py' (properties changed: -x to +x) |
725 | --- src/ViGedit/vigtk.py 2009-06-30 02:54:14 +0000 |
726 | +++ src/ViGedit/vigtk.py 2010-02-05 03:26:13 +0000 |
727 | @@ -61,6 +61,7 @@ |
728 | self.menu_save = self.ui_manager.get_action("/MenuBar/FileMenu/FileSaveMenu") |
729 | self.menu_saveAs = self.ui_manager.get_action("/MenuBar/FileMenu/FileSaveAsMenu") |
730 | self.menu_searchNext = self.ui_manager.get_action("/MenuBar/SearchMenu/SearchFindNextMenu") |
731 | + self.menu_searchPrev = self.ui_manager.get_action("/MenuBar/SearchMenu/SearchFindPreviousMenu") |
732 | self.menu_quit = self.ui_manager.get_action("/MenuBar/FileMenu/FileQuitMenu") |
733 | self.menu_fileClose = self.ui_manager.get_action("/MenuBar/FileMenu/FileCloseMenu") |
734 | self.menu_indentRight = self.ui_manager.get_action("/MenuBar/EditMenu/EditOps_5/Indent") |
735 | |
736 | === modified file 'src/autotab/ChangeLog (Case Conflict 1)' (properties changed: -x to +x) |
737 | === modified file 'src/autotab/README' (properties changed: -x to +x) |
738 | === modified file 'src/autotab/autotab.py' (properties changed: -x to +x) |
This branch has great commits and I can't see any problems in it. Please merge it to the trunk.