[prev in list] [next in list] [prev in thread] [next in thread]
List: mono-patches
Subject: [Mono-patches] r114505 - in
From: "Peter Johanson (latexer () gentoo ! org)"
Date: 2008-09-30 20:35:58
Message-ID: 20080930203558.379799472C () mono-cvs ! ximian ! com
[Download RAW message or body]
Author: pjohanson
Date: 2008-09-30 16:35:57 -0400 (Tue, 30 Sep 2008)
New Revision: 114505
Modified:
trunk/monodevelop/main/src/core/MonoDevelop.Ide/ChangeLog
trunk/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/EditCommands.cs
trunk/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ViewCommandHandlers.cs
trunk/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.addin.xml
Log:
2008-09-30 Peter Johanson <peter@peterjohanson.com>
* MonoDevelop.Ide.Commands/EditCommands.cs:
* MonoDevelop.Ide.Gui/ViewCommandHandlers.cs:
* MonoDevelop.Ide.addin.xml: Add a shortcut for joining lines,
with inspiration from vim's "J" command.
Modified: trunk/monodevelop/main/src/core/MonoDevelop.Ide/ChangeLog
===================================================================
--- trunk/monodevelop/main/src/core/MonoDevelop.Ide/ChangeLog 2008-09-30 19:41:03 UTC \
(rev 114504)
+++ trunk/monodevelop/main/src/core/MonoDevelop.Ide/ChangeLog 2008-09-30 20:35:57 UTC \
(rev 114505) @@ -1,3 +1,10 @@
+2008-09-30 Peter Johanson <peter@peterjohanson.com>
+
+ * MonoDevelop.Ide.Commands/EditCommands.cs:
+ * MonoDevelop.Ide.Gui/ViewCommandHandlers.cs:
+ * MonoDevelop.Ide.addin.xml: Add a shortcut for joining lines,
+ with inspiration from vim's "J" command.
+
2008-09-29 Mike Krüger <mkrueger@novell.com>
* MonoDevelop.Ide.CodeTemplates/TemplateCompletionDataProvider.cs:
Modified: trunk/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/EditCommands.cs
===================================================================
--- trunk/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/EditCommands.cs 2008-09-30 \
19:41:03 UTC (rev 114504)
+++ trunk/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/EditCommands.cs 2008-09-30 \
20:35:57 UTC (rev 114505) @@ -51,6 +51,7 @@
UnIndentSelection,
UppercaseSelection,
LowercaseSelection,
+ JoinWithNextLine,
WordCount,
MonodevelopPreferences,
InsertStandardHeader,
Modified: trunk/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ViewCommandHandlers.cs
===================================================================
--- trunk/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ViewCommandHandlers.cs 2008-09-30 \
19:41:03 UTC (rev 114504)
+++ trunk/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ViewCommandHandlers.cs 2008-09-30 \
20:35:57 UTC (rev 114505) @@ -312,6 +312,46 @@
}
}
}
+
+ [CommandHandler (EditCommands.JoinWithNextLine)]
+ public void OnJoinWithNextLine ()
+ {
+ IEditableTextBuffer buffer = GetContent <IEditableTextBuffer> ();
+ if (buffer != null)
+ {
+ int cursor_pos = buffer.CursorPosition;
+ int line, column;
+ buffer.GetLineColumnFromPosition (buffer.CursorPosition, out line, out column);
+
+ int start_pos = buffer.GetPositionFromLineColumn (line, 0)+1;
+
+ int line_len = doc.TextEditor.GetLineLength (line);
+ int next_line_len = doc.TextEditor.GetLineLength (line+1);
+
+ if (next_line_len <= 0) {
+ return;
+ }
+
+ int end_pos = start_pos + line_len + next_line_len + 1;
+
+ string curr_line = doc.TextEditor.GetLineText (line);
+ string next_line = doc.TextEditor.GetLineText (line+1);
+
+ string new_text = curr_line;
+ string next_line_trimmed = next_line.TrimStart ('\n', '\r', '\t', ' ');
+ if (next_line_trimmed != null &&
+ next_line_trimmed != String.Empty) {
+ new_text += " " + next_line_trimmed;
+ }
+
+ buffer.BeginAtomicUndo ();
+ buffer.DeleteText (start_pos, end_pos-start_pos);
+ buffer.InsertText (start_pos, new_text);
+ buffer.EndAtomicUndo ();
+
+ buffer.CursorPosition = cursor_pos;
+ }
+ }
[CommandUpdateHandler (SearchCommands.GotoLineNumber)]
void OnUpdateGotoLineNumber (CommandInfo info)
Modified: trunk/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.addin.xml
===================================================================
--- trunk/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.addin.xml 2008-09-30 \
19:41:03 UTC (rev 114504)
+++ trunk/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.addin.xml 2008-09-30 \
20:35:57 UTC (rev 114505) @@ -335,6 +335,10 @@
shortcut = "Control|Shift|L"
_description = "Convert the selected text to lowercase"
_label = "_Lowercase Selection" />
+ <Command id = "MonoDevelop.Ide.Commands.EditCommands.JoinWithNextLine"
+ shortcut = "Control|Shift|J"
+ _description = "Join the current line with the next line"
+ _label = "_Join Lines" />
<Command id = "MonoDevelop.Ide.Commands.EditCommands.WordCount"
_label = "_Word Count..."
description = "Count words in a text file"/>
@@ -1478,6 +1482,8 @@
<CommandItem id = "MonoDevelop.Ide.Commands.EditCommands.ToggleCodeComment" />
<CommandItem id = "MonoDevelop.Ide.Commands.EditCommands.IndentSelection" />
<CommandItem id = "MonoDevelop.Ide.Commands.EditCommands.UnIndentSelection" />
+ <SeparatorItem id = "Separator1" />
+ <CommandItem id = "MonoDevelop.Ide.Commands.EditCommands.JoinWithNextLine" />
</ItemSet>
<ItemSet id = "Folding" _label = "F_olding">
_______________________________________________
Mono-patches maillist - Mono-patches@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-patches
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic