Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Krüger <mkrueger@xamarin.com>2012-03-31 21:03:25 +0400
committerMike Krüger <mkrueger@xamarin.com>2012-03-31 21:03:25 +0400
commitbb421dfb4269754707461aa63bd029a5e289314e (patch)
tree67918ddfda8936056c6ceaa048db1151de6918e5 /main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/POEditorWidget.cs
parentbd5f3afa6a22ec2d75bb4d2481671f3885ce7ae9 (diff)
[TextEditor] Caret position is now updated by the textreplace changes.
! breaking change ! Code that did stuff like offset += delta, colum/line change updates no longer works. Fortunately most code didn't break (used Caret.Offset = newOffset). That still does work. This change was required because the virtual input mode doesn't make it trival to update the caret positon. Many high level IDE text editor operations had little bugs because of the virtual input mode. The idea letting the caller manually update the caret was bad to begin with, it was an approach to minimize caret position change updates, but didn't pay off. Now it's easier to use the text editor (!). As a side effect Caret.Offset is now a fast operation, since the caret now caches it's offset and text replace changes do fast updates (Was a O(log n) operation before). Furthermore setting Caret.Offset = Caret.Offset no longer yields a caret position change (like setting Caret.Location = Caret.Location). During the change I fixed some bugs in the indent/unindent selection code and extended the unit tests for this operation.
Diffstat (limited to 'main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/POEditorWidget.cs')
-rw-r--r--main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/POEditorWidget.cs4
1 files changed, 2 insertions, 2 deletions
diff --git a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/POEditorWidget.cs b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/POEditorWidget.cs
index 947027b174..8dfbb37d90 100644
--- a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/POEditorWidget.cs
+++ b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/POEditorWidget.cs
@@ -619,7 +619,7 @@ namespace MonoDevelop.Gettext
this.isUpdating = true;
try {
currentEntry = entry;
- this.texteditorOriginal.Caret.Offset = 0;
+ this.texteditorOriginal.Caret.Location = new DocumentLocation (1, 1);
this.texteditorOriginal.Document.Text = entry != null ? entry.String : "";
this.texteditorOriginal.VAdjustment.Value = this.texteditorOriginal.HAdjustment.Value = 0;
@@ -632,7 +632,7 @@ namespace MonoDevelop.Gettext
this.notebookTranslated.ShowTabs = entry != null && entry.HasPlural;
if (entry != null && entry.HasPlural) {
- this.texteditorPlural.Caret.Offset = 0;
+ this.texteditorPlural.Caret.Location = new DocumentLocation (1, 1);
this.texteditorPlural.Document.Text = entry.PluralString;
this.texteditorPlural.VAdjustment.Value = this.texteditorPlural.HAdjustment.Value = 0;
// if (GtkSpell.IsSupported && !gtkSpellSet.ContainsKey (this.textviewOriginalPlural)) {