# sample script
# converts the selected text to lower case
# if no text is selected, is converts the hole buffer
# (C) 2000 Andrey Panov (under GPL)
# created from To_Upper.py

import string
import glimmer

if glimmer.has_selection():
    begin = glimmer.selection_start()
    end = glimmer.selection_end()
else:
    begin=0
    end= glimmer.buffer_size()
s = glimmer.get_text(begin,end)
glimmer.freeze()
glimmer.delete_text(begin,end)
glimmer.move_to(begin)
glimmer.insert(string.lower(s))
glimmer.thaw()
