<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Uxebu.com - the Ajax and JavaScript Experts &#187; editor</title>
	<atom:link href="http://uxebu.com/blog/tag/editor/feed/" rel="self" type="application/rss+xml" />
	<link>http://uxebu.com/blog</link>
	<description>Web, Dojo, news</description>
	<lastBuildDate>Sun, 06 Jun 2010 22:28:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>&#8220;Duplicate line/selection&#8221; macro for Komodo</title>
		<link>http://uxebu.com/blog/2008/06/26/duplicate-lineselection-macro-for-komodo/</link>
		<comments>http://uxebu.com/blog/2008/06/26/duplicate-lineselection-macro-for-komodo/#comments</comments>
		<pubDate>Thu, 26 Jun 2008 16:43:05 +0000</pubDate>
		<dc:creator>Wolfram Kriesing</dc:creator>
				<category><![CDATA[development tools]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[editor]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[komodo]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://blog.uxebu.com/?p=13</guid>
		<description><![CDATA[I don&#8217;t remember which IDE it was that made me learn to use the shortcuts (may be Turbo Pascal back then), and (almost) since then I am too lazy to learn new shortcuts. Now I always first customize the keyboard shortcuts.
And already for a long time I am missing Ctrl+D/Apple+D for Komodo Edit which I [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t remember which IDE it was that made me learn to use the shortcuts (may be Turbo Pascal back then), and (almost) since then I am too lazy to learn new shortcuts. Now I always first customize the keyboard shortcuts.<br />
And already for a long time I am missing Ctrl+D/Apple+D for <a href="http://www.activestate.com/Products/komodo_ide/komodo_edit.mhtml">Komodo Edit</a> which I use for editing JavaScript, CSS and HTML. This shortcut is supposed to duplicate either the current line or the entire selection. To make a long story short, here is <a href="http://www.vimeo.com/1237622">the screencast video</a> (1:04 min) that shows you how to apply the macro shown below.<br />
<span id="more-13"></span><br />
<script type="text/javascript">
// initHighlightOnLoad is deprecated.
// if parseOnLoad==true, the onLoad init stuff is run.
// if parseOnLoad==false, you can call dojox.highlight.init(domNode)
dojo.require("dojox.highlight");
dojo.require("dojox.highlight.languages.javascript");
dojo.addOnLoad(function(){
dojo.query("code").forEach(dojox.highlight.init);
});
</script></p>
<style type="text/css">
@import "http://blog.uxebu.com/js/dojo-1.1.1/dojox/highlight/resources/highlight.css";
</style>
<p>Since there seems to be no native implementation of that in Komodo I just took some JavaScript skills and the time to look into the macro stuff, and found out that it is actually pretty easy. After looking at the <a href="http://ASPN.ActiveState.com/ASPN/docs/Komodo/4.4/macroapi.html#macroapi_js">macro API doc</a> to find out how to differentiate if something is selected or not. It was as simple as recording the two macros and mixing them together, surrounded by an &#8220;if&#8221; that does the job right for the selection and the other for the current line. And I was done.</p>
<p>This is the end result. Just create a new macro and put the source there (the video shows how to do that in detail).</p>
<pre><code class="javascript">
// Duplicate line/selection macro, more info at
// http://blog.uxebu.com/2008/06/26/duplicate-lineselection-macro-for-komodo/
komodo.assertMacroVersion(2);
if (komodo.view) { komodo.view.setFocus() };
if (ko.views.manager.currentView.scimoz.selText){
    // Copy the current selection
    komodo.doCommand('cmd_copy')
    komodo.doCommand('cmd_lineNext')
    komodo.doCommand('cmd_linePrevious')
    komodo.doCommand('cmd_paste')
} else {
    // Copy the current line
    komodo.doCommand('cmd_homeAbsolute')
    komodo.doCommand('cmd_selectLineNext')
    komodo.doCommand('cmd_copy')
    komodo.doCommand('cmd_paste')
    komodo.doCommand('cmd_paste')
    komodo.doCommand('cmd_linePrevious')
}
</code></pre>
<p><object width="499" height="436"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=1237622&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://www.vimeo.com/moogaloop.swf?clip_id=1237622&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="499" height="436"></embed></object></p>
<p>Have fun duplicating &#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://uxebu.com/blog/2008/06/26/duplicate-lineselection-macro-for-komodo/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
