PDA

View Full Version : Automatically reflow long lines while typing



broSr
10-12-2015,
Hello,
I'm, wondering if there is a way to automatically break long lines into
multiple lines while you are typing (is it called code reflowing?). I've
checked there is an auto-wrap feature in 'preferences > smart
editing' and a code reflow action in 'code' menu. Is there a way to do
this while you are typing? Let's say I'm writing a long line: as soon as I
get to 80 columns can the editor insert a line break and take me to an
indented new line?
Thanks for you help!

BryantSt
10-15-2015,
Here are a couple of macros that can do this. I call them "start-auto-rewrap" and "auto-rewrap-end" (just to be inconsistent for fun), because I don't always want autowrap on, like when typing code.

bsctjqcwiz
10-16-2015,
Hi there, you can reflow a paragraph of text via Code > Reflow Paragraph. This is not done automatically while you type, though it wouldn't be very difficult to invoke it through a macro automatically if you'd wish that.
Note that this feature is intended for plain text, it will not intelligently identify where to end a line (and escape it) for your languages. Personally I prefer to do this myself and I use the edge line column (Prefs > Editor > Smart Editing) to help me with this.

buhTuntene
10-17-2015,
Here's the macro to kick in autowrap:
// Komodo macro for automatic reflowing of paragraphs
ko.views.manager.currentView.scintilla.focus();
ko.autoReflow = function (event) {
var currentView = ko.views.manager.currentView;
var scimoz = currentView.scimoz;
var myEdge = gPrefs.getLongPref("editAutoWrapColumn");
if (scimoz.getColumn(scimoz.currentPos) > myEdge) {
ko.commands.doCommand('cmd_editReflow');
}
}
ko.views.manager.topView.addEventListener("keypress", ko.autoReflow, true);And here's the macro to end it:
// Komodo macro to stop the autoReflow keypress listener
var topView = ko.views.manager.topView;
topView.removeEventListener("keypress", ko.autoReflow, true)Somewhere in the blog archives there's a post by TroyT on how to make the bell ring when the line nears the autowrap-column point, just like an old-timey typewriter.


Eric