Skip to content

Commit

Permalink
a few more cleanup tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
crittermike committed May 9, 2010
1 parent 291c4a3 commit 1a8f45b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions zencoding/zen_dialog.py
Expand Up @@ -74,24 +74,24 @@ def main(self):

def main(editor, window, callback, text=""):

# ensure the caret is hidden
# Ensure the caret is hidden.
editor.view.set_cursor_visible(False)

# get coordinates of the cursor
# Get coordinates of the cursor.
offset_start, offset_end = editor.get_selection_range()
insert = editor.buffer.get_iter_at_offset(offset_start)
location = editor.view.get_iter_location(insert)
window = editor.view.get_window(gtk.TEXT_WINDOW_TEXT)
xo, yo = window.get_origin()
xb, yb = editor.view.buffer_to_window_coords(gtk.TEXT_WINDOW_TEXT, location.x + location.width, location.y)

# open dialog at coordinates with eventual text
# Open dialog at coordinates with eventual text.
my_zen_dialog = ZenDialog(editor, xo + xb, yo + yb, callback, text)
my_zen_dialog.main()

# show the caret again
# Show the caret again.
editor.view.set_cursor_visible(True)

# return exit status and abbreviation
# Return exit status and abbreviation.
return my_zen_dialog.done and my_zen_dialog.exit, my_zen_dialog.abbreviation

6 changes: 3 additions & 3 deletions zencoding/zen_editor.py
Expand Up @@ -15,7 +15,7 @@
@author Sergey Chikuyonok (serge.che@gmail.com)
@link http://chikuyonok.ru
Gedit implementation
Gedit implementation:
@author Franck Marcia (franck.marcia@gmail.com)
'''

Expand Down Expand Up @@ -112,7 +112,7 @@ def get_caret_pos(self):

def set_caret_pos(self, pos):
"""
Set new caret position
Sets the new caret position
@type pos: int
"""
self.buffer.place_cursor(self.buffer.get_iter_at_offset(pos))
Expand All @@ -129,7 +129,7 @@ def get_current_line(self):

def replace_content(self, value, offset_start=None, offset_end=None):
"""
Replace editor's content or it's part (from start to end index). If
Replace editor's content or its part (from start to end index). If
value contains caret_placeholder, the editor will put caret into
this position. If you skip start and end arguments, the whole target's
content will be replaced with value.
Expand Down

0 comments on commit 1a8f45b

Please sign in to comment.