Request for Block Indent function

English main discussion
Post Reply
  • Author
  • Message
Offline
Posts: 1
Joined: Wed Jun 04, 2008 2:10 am

Request for Block Indent function

Post by Emote623 »

Hi, I'm a newbie user of AkelPad, from Seattle, WA, USA, and want to thank Mr. Shengalts Aleksander and Alexey Kuznetsov for their great program. There's a function that's missing from my older notepad program, that I'm hoping can be implemented on AkelPad without too much fuss.

It's called block-indent, when you ident the first line of a block, all the contents of that block maintains the same indentation after wordwrapping. The 'Keep Left Space' option (which should be renamed to Auto-Indent for English users) doesn't fulfill that function. The block-indent has very common use in formatting plain-text docs, and I'm hoping AkelPad can incorporate it.

Again, thanks for the very useful software, and for hope that it will be better still.

Hoang

Offline
Posts: 19
Joined: Tue Apr 19, 2011 12:50 pm

Post by martz »

Hello,
It's an old topic but can anybody tell -- is there any way for doing this in AkelPad 4?
I'm not a programmer and I couldn't find any hints neither here nor from the (awesome!) help file. But I'd really need this kind of feature, so can anyone help?

Thanks and otherwise ovations for developing such an excellent editor!

Offline
Posts: 19
Joined: Tue Apr 19, 2011 12:50 pm

Post by martz »

To make it more clear:
* I have wrap by words set at 80 chars.
* 'Keep left spaces' is turned on.

Now -- I'd like to create an automatic 'hanging indent' effect with either a piece of text I've pasted or the text I type. Like this:

Code: Select all


*An unindented first line. A term.
    Definition of the term in multiple lines. It should indent itself automatically
    like this both after typing and after pasting from clipboard. Lorem ipsum
    dolor sit amet, consectetur adipiscing elit.

*Another unindented first line. A term.
    Definition of the term in multiple lines. It should indent itself automatically
    like this both after typing and after pasting from clipboard. Lorem ipsum
    dolor sit amet, consectetur adipiscing elit.

But instead of this, here's what I get after typing or pasting to an indented line:

Code: Select all


*An unindented first line. A term.
    Definition of the term in multiple lines. It should indent itself automatically
both aftetyping and after pasting from clipboard. Lorem ipsum dolor sit amet,
consectetur adipiscing elit.

*Another unindented first line. A term.
    Definition of the term in multiple lines. It should indent itself automatically
both aftetyping and after pasting from clipboard. Lorem ipsum dolor sit amet,
consectetur adipiscing elit.

Why is this so? Is an automatic indentation of this kind (='hanging indent effect') possible?

(Sorry if the question appears somewhat silly -- I'm more of an end-user but yet absolutely addicted to AkelPad as an everyday tool.)

Offline
Posts: 147
Joined: Fri Feb 08, 2008 6:41 pm
Location: British Columbia, Canada

Post by Surveyor »

Emote623, martz,

First of all, thanks for the kind word re: the Help Manual - much effort has gone into it!

I understand your request, but have a few comments (from the past). I recall several similar types of requests re: formatting or special features, and Aleksander (Instructor) has sometime answered by hinting or saying outright that his intention was to maintain AkelPad as a powerful text editor, not a word processor. Anything suggested that seems to be more of a word processor feature (eg. spell check, although there is now a plugin for that, I think) seems to have been off his radar. I understand that, since AkelPad is a small, lean editor.

The internals of AkelPad are (as I understand it):
  • text is entered into the main form as text, but the actual representation during editing is an RTF control, to allow for syntax highlighting (through plugins), colouring (current line, etc.) and other features. But...
  • saving a file just saves it in text format - no headers (other than perhaps a BOM), no formatting marks, etc. In this way, it is compatible with ANY other text editor (eg. NotePad).
I think that if your feature (Auto-Indent, or Hanging Indent) were implemented, it would require additional formatting tags to be inserted into the document, so that when loaded, the formatting was preseved. This would almost certainly impact the compatibility! I do not speak for Instructor, but I imagine (based on past responses) that might be his thinking.

When word wrap is turned on, any line breaks are purely visual - a hanging indent would likely have to be implemented as a special formatting particular to each paragraph, hence the need to embed special tags. The only other way to implement such a feature (or other special formatting) might be to have a second formatting file (containing formatting instructions) which accompanies the text file. Again, though, the formatting would not be transferable to other editors, plus this would introduce more house-keeping for AkelPad.

Perhaps Alekander will consider your request, but for now, the only way is to introduce hard line breaks and indents (tabs), both would not work right in line-wrap mode. The Edit/Selection submenu contains features to easily do this.

Cheers!

P.S. I too am addicted to AkelPad - I use it every day!

Offline
Posts: 2247
Joined: Tue Aug 07, 2007 2:03 pm
Location: Vinnitsa, Ukraine

Post by FeyFre »

I think that if your feature (Auto-Indent, or Hanging Indent) were implemented, it would require additional formatting tags to be inserted into the document, so that when loaded, the formatting was preseved. This would almost certainly impact the compatibility! I do not speak for Instructor, but I imagine (based on past responses) that might be his thinking.
I'll insert my 2 cents also(again, not speaking for Instructor), but summary I made after digging in AkelPad inetrnals is most valuable reason why such features will be not implemented is performance penalty. I do not think somebody will be happy if during simple window resize AkelPad will be intensively busy recalculating word wrap points. It is already happening and can be quite annoying(especially when text size is quite huge).

Offline
Posts: 19
Joined: Tue Apr 19, 2011 12:50 pm

Post by martz »

I see. Thanks, guys, for your replies. That's about what I thougt -- that it must be somehow related to the "architecture" of AkelPad.

However, is any of you familiar with Notepad++? I noticed they've got a TextFX feature where you can re-wrap selected text to 72 chars. Basically a workaround of the same kind would in the end do the trick for me. Like this:

1. I have word wrap turned on and a 'default' limit set to, say, 80 chars.
2. I select a block of text (described above as definition of a term). At the moment, this text is *not* indented in any way.
3. Now I run a command that wraps the selected text to 72 chars (or anything that's at least, say, 2-3 chars less than 80).
4. I indent these hard-wrapped lines to the right 2-3 chars.
5. Voila: I have a wrapped and indented section -- and at the same time, I haven't had to change my 'default' wrapping settings.

In other words: I'd need a 'custom' wrap command *inside* the 'default' wrapping settings. (Because after hard-wrapping with 'default' settings the latter indentation would look no good.)

In case it made any sense to you -- can this be implemented with a script/macro of some kind?

Some time ago I switched from (the too-heavyweight) Notepad++ to AkelPad and I'm starting to love this slick program more and more as a plain text tool. (Heck, as an utter non-geek, I even hacked together a syntax file for Markdown...) So it would be great to somehow have this feature here as well.

Even if this doesn't work out -- thanks once more for help! I didn't know AkelPad had such an active community.

Offline
Posts: 19
Joined: Tue Apr 19, 2011 12:50 pm

Post by martz »

Surveyor wrote: First of all, thanks for the kind word re: the Help Manual - much effort has gone into it!
You're welcome! The first time I saw it, I was really baffled. I don't think I've ever used a text editor with a manual *that* comprehensive. It's really awesome.

Offline
Site Admin
Posts: 6311
Joined: Thu Jul 06, 2006 7:20 am

Post by Instructor »

martz
Something like that: LinesWrap.js
Last edited by Instructor on Thu Apr 21, 2011 4:04 pm, edited 1 time in total.

Offline
Posts: 19
Joined: Tue Apr 19, 2011 12:50 pm

Post by martz »

Instructor wrote:martz
Something like that: LinesWrap.js
Brilliant, thank you!

However, If you happen to find one more moment for tweaking -- I think it would be better to leave out the input box. That is, I would rather set the custom wrap margin manually within the *.js file. So I wouldn't have to re-set it every time I'm using the script.

And another idea I just came across: is it actually possible to indent the hard-wrapped lines automatically? Say, by one tab to the right? Would save me one more keystroke :)

But, of course, I really appreciate the script even if it stays as is.
Once more, thanks mate!

Offline
Site Admin
Posts: 6311
Joined: Thu Jul 06, 2006 7:20 am

Post by Instructor »

martz
LinesWrap.js updated. See description at the begin for "Arguments" and "Usage". You can assign hotkey for script call with arguments in Hotkey plugin.
Last edited by Instructor on Thu Apr 21, 2011 4:04 pm, edited 1 time in total.

Offline
Posts: 19
Joined: Tue Apr 19, 2011 12:50 pm

Post by martz »

Hmm,
It doesn't do the indenting for me. Instead of a block hard-wrapped and indented like this...

Code: Select all

    Definition of the term in multiple lines. It should indent itself automatically
    like this both after typing and after pasting from clipboard. Lorem ipsum
    dolor sit amet, consectetur adipiscing elit.
I get this:

Code: Select all

    Definition of the term in multiple lines. It should indent itself automatically
like this both after typing and after pasting from clipboard. Lorem ipsum
dolor sit amet, consectetur adipiscing elit.
So it seems to *first* do the tabbing/indenting and *then* the word-wrapping. But it should be acting the opposite way.

Sorry for bothering, really. But I guess this is a handy script for many of the text-editing (not programming-) people.

Mart

Offline
Site Admin
Posts: 6311
Joined: Thu Jul 06, 2006 7:20 am

Post by Instructor »

martz
Did you read description in the beginning of the script? Line indentation in paragraph is set with "-LineIndent" argument. For example you can assign hotkey for command:

Code: Select all

Call("Scripts::Main", 1, "LinesWrap.js", `-ParaIndent="    " -LineIndent="  " -MaxLength=40 -ShowInput=false`)
Last edited by Instructor on Thu Apr 21, 2011 4:04 pm, edited 1 time in total.

Offline
Posts: 19
Joined: Tue Apr 19, 2011 12:50 pm

Post by martz »

Ah, sorry. This is embarrassing.
Indeed, everything works as intended. Thank you very much!

Offline
Site Admin
Posts: 6311
Joined: Thu Jul 06, 2006 7:20 am

Post by Instructor »

You are welcome. Just to let you know: I decide to change name to LinesWrap.js.
Post Reply