Author Topic: Unindent completely  (Read 2969 times)

Offline JJK

  • Registered User
  • Full Member
  • *
  • Posts: 152
  • Karma: +2/-0
    • View Profile
Unindent completely
« on: January 19, 2009, 08:50:54 am »
Hello Alex. First, cheers for 1.40. And here is my request :
When unindenting, we can only unindent until the external ends of the selected scope has reached the left margin. Then we can no more unindent the internal portion of text.
For example if I select the next text,
Code: [Select]
     For i=1 to 5
          print i
     Next i
I am able to unindent until
Code: [Select]
For i=1 to 5
     print i
Next i
but not until
Code: [Select]
For i=1 to 5
print i
Next i
It is perhaps by design, yet it would be useful in some cases. UltraEdit, EditPlus or Pspad are able to do that.
Currently I resolve the issue by replacing \t by nothing. But not elegant.


Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 775
  • Karma: +6/-0
    • View Profile
Re: Unindent completely
« Reply #1 on: January 19, 2009, 09:11:40 am »
Hi JJK,
i think this it's the correct behaviour.
If an coder rapidly clicks on "Decrease Indent" too much ... he would be sulkily if hes code lose its indent totally.

-

How about an general function like

"Delete
( ) white space: [   \s\t]
(o) string [              ;  ]
( ) empty lines
[X]in front of line;
[ ] at EOL;
[ ] inside line;
(o)delete all;  ( )reduce to one"



EDIT: I don't know if i make myself clear?
I suggest maybe this function could be multifunctional and allow the user to enter any string he want to delete?
Not white spaces only, but any sign or string, like remove any "; " in front of an line, or any ".bak" at the end.
If we can use RegEx here, i don't would regret it :D
(i have modified my dummy dialog-box above)
-

And/or maybe holding an accelerator key while clicking on "Decrease Indent" to
not decrease the indent but remove all white space in front of the line at onces.
« Last Edit: January 19, 2009, 11:31:50 am by Stefan »

Offline JJK

  • Registered User
  • Full Member
  • *
  • Posts: 152
  • Karma: +2/-0
    • View Profile
Re: Unindent completely
« Reply #2 on: January 19, 2009, 09:52:30 am »
Hi Stefan
I vote for both. Even in MsOffice VBA's IDE we can decrease indent until margin. It is often useful to redo bad indents (even sometimes spaces instead of real indents, coded by bad coders, isn't it ?).
Quote
If an coder rapidly clicks on "Decrease Indent" too much ... he would be sulkily if hes code lose its indent totally.
In this case, simply undo by Ctrl-Z.
Perhaps a warning in the status bar would be useful when reaching the left margin.

But I like also your proposal of general function. Obtained how ? By future scripting ?

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 775
  • Karma: +6/-0
    • View Profile
Re: Unindent completely
« Reply #3 on: January 19, 2009, 11:25:02 am »
Hi Stefan
I vote for both.
I too :D

Quote
Even in MsOffice VBA's IDE we can decrease indent until margin.
Ah, i see.... you're right here.

Quote
In this case, simply undo by Ctrl-Z.
yes, ok

Quote
Perhaps a warning in the status bar would be useful when reaching the left margin.
How locks to there if you focus the code? :D
i think not that this is needed, since you rather have an lock at the code then at the status bar.
But maybe an peep?

Quote
But I like also your proposal of general function. Obtained how ? By future scripting ?
No, i hope by Alex, since this should be an default option for an editor (IMHO) :D

CU

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2183
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: Unindent completely
« Reply #4 on: January 19, 2009, 04:08:38 pm »
Hi guys,

such behavior to indent till no spaces left (not only till minimum indent) was in HE in some early versions, but then I have removed it. Dont know why... I can bring it back, and JJK is right it can be always undone with Ctrl+Z, so  no problem if somebody un-indents too much.

About the special function for this... Sorry, I am not a fan of such mega functions, doing everything... You could not predict which functionality would need every user and cover all cases. Or it would be very buggy or too complex to use.
At the and this function would not be used very often and people would prefer to do several search replace or just edit manually then learn it. This is my opinion. If somebody would need it repeatedly, I think best would be do built script for this, and have possibility to put a menu entrz for it or shortcut. Sorry, that scripting is not available yet.

Also about modifier keys when calling command. I did a mistake introducing this in some functions...
Why? It is fine when you call command from menu, but what would happen if you would assign a shortcut to it? Then using of modifier keys would mean another shortcut, and command just would not be called... So, only one way I see, create different commands for every combination of modifier keys.

With indenting, I would do the correction for behavior in beta 1.41.

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 775
  • Karma: +6/-0
    • View Profile
Re: Unindent completely
« Reply #5 on: January 19, 2009, 04:36:11 pm »

About the special function for this... Sorry, I am not a fan of such mega functions, doing everything...
To bad :D, imho such standard helpers belongs to an good editor. (i want to push :D)

Quote
Also about modifier keys when calling command.
Why? It is fine when you call command from menu,
but what would happen if you would assign a shortcut to it?
I don't want to push you...Just to talk about... i would thought there are two commands available ,
one with and one without accelerator,
like  .decreaseIndent and .decreaseIndentAcc

If i click on the button  then .decreaseIndent would be executed
If i hold an accelerator key AND click the button ...then decreaseIndentAcc would be executed
And that way it's no problem to add shortcuts.... because that are two commands
(they may share the same code but with an IF...Else..statment more ?)


Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2183
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: Unindent completely
« Reply #6 on: January 19, 2009, 05:13:43 pm »
Quote
To bad , imho such standard helpers belongs to an good editor. (i want to push )
:) with a big "unindent" function, lets see. I really prefer to do such things with a scripting.

Quote
I don't want to push you...Just to talk about... i would thought there are two commands available ,
one with and one without accelerator
Yes, I think this is correct way. Just wrote that, because have noticed this mistake in my implementation (for example in HTML paste, would not change it know, but can happen then somewhen).

And with problem reported by JJK I think I would have behavior requested by him as default, without accelerator. He is right, you can just use undo, in case of mistake. If you think this is necessary, I can have a xml flag to control this.

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 775
  • Karma: +6/-0
    • View Profile
Re: Unindent completely
« Reply #7 on: January 19, 2009, 05:45:40 pm »
>I really prefer to do such things with a scripting
Then it must be OK for me too, (but i had to push since it's my point of view, my opinion, my use of other editors)
Maybe we will have such feature as kind of "add-in" to download later if scripting is implemented :D


> without accelerator.
> If you think this is necessary,
No no, i talked just in generally, not for this special feature.
I think i don't matter what way around this works (when i have to press Acc and when not)

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 775
  • Karma: +6/-0
    • View Profile
Re: Unindent completely
« Reply #8 on: January 19, 2009, 09:02:45 pm »
I really prefer to do such things with a scripting.
I forgot, did you plan to add GUI options to scripting, so we can build such dialogs like i suggest above? (i know it's to early)

 

Related Topics

  Subject / Started by Replies Last post
7 Replies
2930 Views
Last post March 06, 2009, 07:04:25 pm
by alex