~radu.c/glipper/clipboard-watch

« back to all changes in this revision

Viewing changes to glipper/plugins/newline.py

  • Committer: Laszlo Pandy
  • Date: 2011-04-09 09:29:58 UTC
  • Revision ID: bzr@laszlopandy.com-20110409092958-3ihfuequ42bushsu
Fix recursion in newline plugin.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
import glipper
12
12
from gettext import gettext as _
13
13
 
14
 
recursive = False
 
14
last_set_item = "\n"
15
15
def on_new_item(arg):
16
 
        global recursive
17
 
        if recursive:
18
 
                recursive = False
19
 
        else:
20
 
                recursive = True
21
 
                i = arg + '\n'
22
 
                glipper.set_history_item(0, i)
23
 
                glipper.add_history_item(i)
 
16
        global last_set_item
 
17
        if arg != last_set_item:
 
18
                print 'new line', arg
 
19
                last_set_item = arg + '\n'
 
20
 
 
21
                glipper.set_history_item(0, last_set_item)
 
22
                glipper.add_history_item(last_set_item)
 
23
 
24
24
        
25
25
def info():
26
26
        info = {"Name": _("New line"),