AkelPad Forum Index AkelPad
Support forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Request for Block Indent function

 
Post new topic   Reply to topic    AkelPad Forum Index -> Discussion (English)
View previous topic :: View next topic  
Author Message
Emote623



Joined: 04 Jun 2008
Posts: 1

PostPosted: Wed Jun 04, 2008 2:21 am    Post subject: Request for Block Indent function Reply with quote

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
Back to top
View user's profile Send private message
martz



Joined: 19 Apr 2011
Posts: 19

PostPosted: Tue Apr 19, 2011 1:08 pm    Post subject: Reply with quote

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!
Back to top
View user's profile Send private message
martz



Joined: 19 Apr 2011
Posts: 19

PostPosted: Tue Apr 19, 2011 1:27 pm    Post subject: Reply with quote

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:


*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:


*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.)
Back to top
View user's profile Send private message
Surveyor



Joined: 08 Feb 2008
Posts: 146
Location: British Columbia, Canada

PostPosted: Tue Apr 19, 2011 3:30 pm    Post subject: Reply with quote

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!
Back to top
View user's profile Send private message Send e-mail
FeyFre



Joined: 07 Aug 2007
Posts: 2045
Location: Vinnitsa, Ukraine

PostPosted: Tue Apr 19, 2011 4:26 pm    Post subject: Reply with quote

Quote:
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).
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
martz



Joined: 19 Apr 2011
Posts: 19

PostPosted: Wed Apr 20, 2011 12:27 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
martz



Joined: 19 Apr 2011
Posts: 19

PostPosted: Wed Apr 20, 2011 12:38 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Instructor
Site Admin


Joined: 06 Jul 2006
Posts: 5381

PostPosted: Wed Apr 20, 2011 4:36 pm    Post subject: Reply with quote

martz
Something like that: LinesWrap.js


Last edited by Instructor on Thu Apr 21, 2011 4:04 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
martz



Joined: 19 Apr 2011
Posts: 19

PostPosted: Thu Apr 21, 2011 10:16 am    Post subject: Reply with quote

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 Smile

But, of course, I really appreciate the script even if it stays as is.
Once more, thanks mate!
Back to top
View user's profile Send private message
Instructor
Site Admin


Joined: 06 Jul 2006
Posts: 5381

PostPosted: Thu Apr 21, 2011 12:00 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Send e-mail
martz



Joined: 19 Apr 2011
Posts: 19

PostPosted: Thu Apr 21, 2011 12:42 pm    Post subject: Reply with quote

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

    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:

    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
Back to top
View user's profile Send private message
Instructor
Site Admin


Joined: 06 Jul 2006
Posts: 5381

PostPosted: Thu Apr 21, 2011 12:52 pm    Post subject: Reply with quote

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:
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
Back to top
View user's profile Send private message Send e-mail
martz



Joined: 19 Apr 2011
Posts: 19

PostPosted: Thu Apr 21, 2011 2:26 pm    Post subject: Reply with quote

Ah, sorry. This is embarrassing.
Indeed, everything works as intended. Thank you very much!
Back to top
View user's profile Send private message
Instructor
Site Admin


Joined: 06 Jul 2006
Posts: 5381

PostPosted: Thu Apr 21, 2011 4:06 pm    Post subject: Reply with quote

You are welcome. Just to let you know: I decide to change name to LinesWrap.js.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    AkelPad Forum Index -> Discussion (English) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


SourceForge.net Logo Powered by phpBB © 2001, 2005 phpBB Group