Popular JavaScript recipes tagged "wrap"http://code.activestate.com/recipes/langs/javascript/tags/wrap/2012-04-10T17:38:13-07:00ActiveState Code RecipesKomodo JS Macro: Real auto word-wrap (JavaScript) 2012-04-10T17:38:13-07:00Furlohttp://code.activestate.com/recipes/users/4180513/http://code.activestate.com/recipes/578099-komodo-js-macro-real-auto-word-wrap/ <p style="color: grey"> JavaScript recipe 578099 by <a href="/recipes/users/4180513/">Furlo</a> (<a href="/recipes/tags/auto/">auto</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>, <a href="/recipes/tags/word/">word</a>, <a href="/recipes/tags/wrap/">wrap</a>). </p> <p>This script will add real auto-wrap functionality to Komodo, ie. it will wrap text after reaching column 80 just in the same way as you would by pressing &lt;Enter&gt;.</p> <p>You can bind a keyboard shortcut to macro, or trigger it on Komodo startup, or both. Either way, repeated pressing of binded shortcut (or running the macro) will switch it off and on again.</p> <p>In fact, script only adds event listener, which fires a function (after each keypress), that checks if cursor position is not in column higher that 79 and, if needed, calls Komodo built-in function "Reflow paragraph" to reflow the paragraph.</p> <p>This recipe was not created by me from scratch. I have just read David Brewer's feature request at <a href="http://code.activestate.com/lists/komodo-discuss/4965/">komodo-discuss</a>, used <a href="http://www.openkomodo.com/blogs/troyt/revenge-auto-wrap-type-type-type-ding">troyt's original code</a> for autowrap and tweaked/simplified it a little.</p> Komodo JavaScript Macro - wrap the current word under the cursor (JavaScript) 2011-02-02T23:28:37-08:00Todd Whitemanhttp://code.activestate.com/recipes/users/2666241/http://code.activestate.com/recipes/577561-komodo-javascript-macro-wrap-the-current-word-unde/ <p style="color: grey"> JavaScript recipe 577561 by <a href="/recipes/users/2666241/">Todd Whiteman</a> (<a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>, <a href="/recipes/tags/text/">text</a>, <a href="/recipes/tags/toddw/">toddw</a>, <a href="/recipes/tags/wrap/">wrap</a>). </p> <p>A <a href="http://www.activestate.com/komodo">Komodo</a> JavaScript macro that can be used to wrap the current word under the cursor position (or current selection) with arbitrary text.</p> <p>For example, if I'm editing a HTML file and have the selected text "This is my heading", I can quickly use this macro to wrap this text into "&lt;h1&gt;This is my heading&lt;/h1&gt;".</p>