summaryrefslogtreecommitdiffstats
path: root/Tools/idle/FormatParagraph.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1999-05-03 15:49:52 (GMT)
committerGuido van Rossum <guido@python.org>1999-05-03 15:49:52 (GMT)
commit318a70d976fbf225de3485bbbc61b7fe1f24f4a2 (patch)
tree358d6940133c029256a0b4d94bde7ed61fba03e4 /Tools/idle/FormatParagraph.py
parent2d6a568a0f6c65c76797556bf949b97ede9049e1 (diff)
downloadcpython-318a70d976fbf225de3485bbbc61b7fe1f24f4a2.zip
cpython-318a70d976fbf225de3485bbbc61b7fe1f24f4a2.tar.gz
cpython-318a70d976fbf225de3485bbbc61b7fe1f24f4a2.tar.bz2
Tim Peters writes:
I'm still unsure, but couldn't stand the virtual event trickery so tried a different sin (adding undo_block_start/stop methods to the Text instance in EditorWindow.py). Like it or not, it's efficient and works <wink>. Better idea? Give the attached a whirl. Even if you hate the implementation, I think you'll like the results. Think I caught all the "block edit" cmds, including Format Paragraph, plus subtler ones involving smart indents and backspacing.
Diffstat (limited to 'Tools/idle/FormatParagraph.py')
-rw-r--r--Tools/idle/FormatParagraph.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Tools/idle/FormatParagraph.py b/Tools/idle/FormatParagraph.py
index f8827e7..e17f54c 100644
--- a/Tools/idle/FormatParagraph.py
+++ b/Tools/idle/FormatParagraph.py
@@ -37,8 +37,10 @@ class FormatParagraph:
text.tag_remove("sel", "1.0", "end")
if newdata != data:
text.mark_set("insert", first)
+ text.undo_block_start()
text.delete(first, last)
text.insert(first, newdata)
+ text.undo_block_stop()
else:
text.mark_set("insert", last)
text.see("insert")