Summary: | Ability to reformat paragraphs | ||
---|---|---|---|
Product: | [Applications] kate | Reporter: | Nicolas Girard <nicolas.girard> |
Component: | general | Assignee: | KWrite Developers <kwrite-bugs-null> |
Status: | RESOLVED DUPLICATE | ||
Severity: | wishlist | CC: | bluedzins, jquelin, skunk |
Priority: | NOR | ||
Version: | 2.3.1 | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Nicolas Girard
2004-11-16 22:50:23 UTC
This is really a job for the text filter, imo. You can select text and enter a shell command to filter the selection through, you could even use perl with module. When I get the time, the text filter will hae a history, and it will be possible to create actions with shortcuts using them them. > This is really a job for the text filter, imo.
Anders,
I agree that the text filter may be a good candidate for the job ; actually I
succeeded in running a script using the perl Text::Autoformat filter through it.
But this solution suffer from at least 2 things:
- you cannot run it by typing a single shortcur yet ; as you said you'll
enhance the text filter this point could vanish
- it introduces an external dependancy ; not all Kate users will be able
to take advantage of it ; as ther's no official text reformatter, users
and especially beginners will be left alone to choose a proper tool ; no
standard behaviour or customization will lead to less documented or
undocumented feature, which most users won't notice.
On the other hand such an action would perfectly fit into the core
of kate IMHO, the more so as it may be even more useful than the
existing "Capitalize" or "To Lowercase" features.
see also bug #78813 An improved text filter facility would be nifty. It would be awkward, however, if you always had to select the text that a filter is to operate on (or, absent that, have the filter run on the whole document). This would certainly be a bad interface to the previously-discussed paragraph-reformatting routine---you'd have to exactly select the paragraph every time. It would be great to be able to define a filter that operates on "the current paragraph," with an assumed paragraph separator of /\n\s*\n/. Extending the concept, you could have another option that filters just "the current line." Extending it even further, you could allow filtering "the current chunk of text between two instances of this arbitrary regex." But that might make the editor Too Powerful(tm), and therefore dangerous in the hands of untrained n00bies :-) In the end, however, I have to agree with Mr. Girard. Kate really should have a simple paragraph-reformatting routine built-in. Nearly every decent editor out there has one, and in this "Advanced Text Editor" it is sorely lacking. You can use scripting to do this, see [1]. If you implement it with a script, you can attach it to this bug report :) [1] http://www.kate-editor.org/article/scripting_katepart_with_javascript Oh, the scripting functionality is fine. My point, however, is that a simple reformatter should be part of the core feature set. Functions like "Join Lines," "Capitalize" et al. could also be handled via scripting, but there's a line where you expect a modern text editor to have certain common/universal functions built-in. (The point is well-taken for an advanced reformatter, however. It would be unreasonable to expect Kate to include something like Text::Autoformat.) Information of how to implement this as a script can be found here: http://docs.kde.org/development/en/kdesdk/kate/advanced-editing-tools-scripting.html simple reformatter also requested in bug #78813. Please have a look at the last comment, because you can now implement it easily through our scripting facilities. I'd be willing to add this to the default Kate installation! Please contribute! :) *** This bug has been marked as a duplicate of bug 78813 *** |