Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-10

Block unindent does not work in Lazarus like in Delphi7....

14 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bo Berglund

I have tried to fix indentation problems that were not visible when the unit was edited in Delphi7, but now shows up as massive block indents.

But I cannot get anything to work, not Tab and Shift-Tab or Ctrl-i and Ctrl-u...
They seem only to work as follows:

- Select a block of text
- Use TAB or Ctrl-i to indent and the block moves to the right
- Use Shift-TAB or Ctrl-u to unindent and the block moves left

BUT it moves right only to the original position of the text before the indentaion commands were given!
I want to move the block left because it has too much indentaion caused by Lazarus translating TAB characters too widely before I had time to change the tab indentation width to 2.

So how can I unindent in Lazarus in the same way as is possible in Delphi???

Bo Berglund Developer in Sweden

Reply by email

Martin
to Bo Berglund
Bo Berglund wrote 20 lines
I have tried to fix indentation problems that were not visible when the unit was edited in Delphi7, but now shows up as massive block indents. But I cannot get anything to work, not Tab and Shift-Tab or Ctrl-i and Ctrl-u... They seem only to work as follows: - Select a block of text - Use TAB or Ctrl-i to indent and the block moves to the right - Use Shift-TAB or Ctrl-u to unindent and the block moves left BUT it moves right only to the original position of the text before the indentaion commands were given! I want to move the block left because it has too much indentaion caused by Lazarus translating TAB characters too widely before I had time to change the tab indentation width to 2. So how can I unindent in Lazarus in the same way as is possible in Delphi???

Hm, I don't know how delphi does it. I only have "Turbo Delphi" (the one Borland gave away for free) and it doesn't seem do have any indent/unindent at all. (ctrl-i/ctrl-u don't do it, neither does tab).

But yes it looks like the the unindent in Lazarus doesn't deal with tabs at all.

I understand your text has mixed indent some with space, some with tab? Which is why adjusting tab doesn't work, because the lines that are adjusted on space do not react to it? Maybe you an provide an example?

Also if nothing helps: Lazarus includes Jedi code formater => that should be able to deal with it.

If you need to get rid of *whole* tabs (e.g you have lots of consecutive lines starting with 4 tabs, but you want all of them only 3 tabs), yoou can use column mode selection.
Select with alt-shift-cursor_keys, You can select several lines, but only one (or two) tab chars in each line. Once selected you can delete them. But this only works, if the whole tab is selected => I do not know of a way to delete a partial selected tab (e.g substitute it to spaces)

Martin

Reply by email

Leonardo M. Ramé
to Bo Berglund: I have tried to fix indentation problems that were not visible when the unit was edited…
Bo Berglund wrote 26 lines
I have tried to fix indentation problems that were not visible when the unit was edited in Delphi7, but now shows up as massive block indents. But I cannot get anything to work, not Tab and Shift-Tab or Ctrl-i and Ctrl-u... They seem only to work as follows: - Select a block of text - Use TAB or Ctrl-i to indent and the block moves to the right - Use Shift-TAB or Ctrl-u to unindent and the block moves left BUT it moves right only to the original position of the text before the indentaion commands were given! I want to move the block left because it has too much indentaion caused by Lazarus translating TAB characters too widely before I had time to change the tab indentation width to 2. So how can I unindent in Lazarus in the same way as is possible in Delphi??? -- Bo Berglund Developer in Sweden

In both, Delphi and Lazarus I allways used "ctrl+k i" to indent and "ctrl+k u" to unindent. Just tested on Lazarus and it works ok.

Reply by email

Bo Berglund
to Leonardo M. Ramé: In both, Delphi and Lazarus I allways used "ctrl+k i" to indent and "ctrl+k u" to…
Leonardo M. Ram? wrote
In both, Delphi and Lazarus I allways used "ctrl+k i" to indent and "ctrl+k u" to unindent. Just tested on Lazarus and it works ok.

I forgot to say that I am testing on Lazarus 0.9.28.2 beta in Windows.

In Lazarus after selecting a group of code lines:
-------------------------------------------------
Ctrl-k-u or Ctrl-k-i does exactly nothing.

Ctrl-Shift-i and Ctrl-Shift-u (the Delphi keys) does nothing

TAB indents 2 spaces at a time

Shift-TAB unindents 2 spaces at a time but only to the original position

In Delphi 7:
------------
Ctrl-k-i indents 2 spaces

Ctrl-k-u does nothing

Ctrl-Shift-i indents 2 spaces

Ctrl-Shift-u unindents 2 spaces until the text reaches left edge. If some lines had more indentation more operations move these towards left so in the end all lines start at column 1.
This is what I always do when fixing up old badly indented code.

TAB erases the selected text and puts 2 spaces there instead (ouch!)

I can use the column selection trick for now to get rid of extra indentation, but I really think this should be working the "Delphi way"....

Bo Berglund Developer in Sweden

Reply by email

Martin
to Bo Berglund
Bo Berglund wrote
In Lazarus after selecting a group of code lines: ------------------------------------------------- Ctrl-k-u or Ctrl-k-i does exactly nothing.

you can assign them, or maybe select a different keymap-scheme...

Show quoted text 6 lines
Ctrl-Shift-i and Ctrl-Shift-u (the Delphi keys) does nothing TAB indents 2 spaces at a time Shift-TAB unindents 2 spaces at a time but only to the original position

I think that is only the appearance you get.

unindent works until all spaces are gone. But of course only, if it is all indented by spaces.

Because (other than delphi) unindent does not substitute any tabs by spaces => so if the first char on the line is a tab, then unindent does nothing.

And yes, some kind of solution for this would be good => feel free to add a feature request on our bugtracker, so it will not get forgotten

Show quoted text 9 lines
In Delphi 7: ------------ Ctrl-k-i indents 2 spaces Ctrl-k-u does nothing Ctrl-Shift-i indents 2 spaces Ctrl-Shift-u unindents 2 spaces until the text reaches left edge.

It does more, it replaces all tabs by spaces.
That is why it can unindent

Martin

Reply by email

Bo Berglund
to Martin
Martin wrote 35 lines
On 10/10/2010 20:29, Bo Berglund wrote: > In Lazarus after selecting a group of code lines: > ------------------------------------------------- > Ctrl-k-u or Ctrl-k-i does exactly nothing. you can assign them, or maybe select a different keymap-scheme... > Ctrl-Shift-i and Ctrl-Shift-u (the Delphi keys) does nothing > > TAB indents 2 spaces at a time > > Shift-TAB unindents 2 spaces at a time but only to the original > position I think that is only the appearance you get. unindent works until all spaces are gone. But of course only, if it is all indented by spaces. Because (other than delphi) unindent does not substitute any tabs by spaces => so if the first char on the line is a tab, then unindent does nothing. And yes, some kind of solution for this would be good => feel free to add a feature request on our bugtracker, so it will not get forgotten > In Delphi 7: > ------------ > Ctrl-k-i indents 2 spaces > > Ctrl-k-u does nothing > > Ctrl-Shift-i indents 2 spaces > > Ctrl-Shift-u unindents 2 spaces until the text reaches left edge. It does more, it replaces all tabs by spaces. That is why it can unindent

And which is what is needed....
Why can't Lazarus replace any whitespace at the front of the lines???

Bo Berglund Developer in Sweden

Reply by email

Martin
to Bo Berglund
Bo Berglund wrote 39 lines
On Sun, 10 Oct 2010 20:50:56 +0100, Martin wrote: > On 10/10/2010 20:29, Bo Berglund wrote: >> In Lazarus after selecting a group of code lines: >> ------------------------------------------------- >> Ctrl-k-u or Ctrl-k-i does exactly nothing. > you can assign them, or maybe select a different keymap-scheme... >> Ctrl-Shift-i and Ctrl-Shift-u (the Delphi keys) does nothing >> >> TAB indents 2 spaces at a time >> >> Shift-TAB unindents 2 spaces at a time but only to the original >> position > I think that is only the appearance you get. > > unindent works until all spaces are gone. But of course only, if it is > all indented by spaces. > > Because (other than delphi) unindent does not substitute any tabs by > spaces => so if the first char on the line is a tab, then unindent does > nothing. > > And yes, some kind of solution for this would be good => feel free to > add a feature request on our bugtracker, so it will not get forgotten > >> In Delphi 7: >> ------------ >> Ctrl-k-i indents 2 spaces >> >> Ctrl-k-u does nothing >> >> Ctrl-Shift-i indents 2 spaces >> >> Ctrl-Shift-u unindents 2 spaces until the text reaches left edge. > It does more, it replaces all tabs by spaces. > That is why it can unindent > And which is what is needed.... Why can't Lazarus replace any whitespace at the front of the lines???

As I said, please add a feature request, so far simply no one thought about it, and no one has asked.

As for right now: I believe you can get that done by using jedi code formater (tools menu / environment options)
(the feature request will likely end up with me, and I have several other thinks to do before I can look at it)

Reply by email

Mattias Gaertner
to Martin
Show quoted text 5 lines
[...] As for right now: I believe you can get that done by using jedi code formater (tools menu / environment options) (the feature request will likely end up with me, and I have several other thinks to do before I can look at it)

Maybe use Tabs to Spaces, then unindent.

Mattias

Reply by email

Bo Berglund
to Martin: As I said, please add a feature request, so far simply no one thought about it, and no…
Martin wrote
On 10/10/2010 21:43, Bo Berglund wrote: As I said, please add a feature request, so far simply no one thought about it, and no one has asked.

I am new here and I don't know how to add a feature request. Will search for it on the web...

As for right now: I believe you can get that done by using jedi code formater (tools menu / environment options) (the feature request will likely end up with me, and I have several other thinks to do before I can look at it)

Oh, so you are the Lazarus editor author then?

Bo Berglund

Reply by email

Martin
to Bo Berglund
Bo Berglund wrote 7 lines
On Sun, 10 Oct 2010 22:05:32 +0100, Martin wrote: > As for right now: I believe you can get that done by using jedi code > formater (tools menu / environment options) > (the feature request will likely end up with me, and I have several > other thinks to do before I can look at it) Oh, so you are the Lazarus editor author then?

No just the current maintainer.

Lazarus uses a fork of SynEdit
(http://sourceforge.net/apps/mediawiki/synedit/index.php?title=SynEdit_Home_Page).

Lazarus was forked of version 1.1 or 1.2.
SynEdit itself was based on MWEdit.

I joined a couple of years back, and since have maintained the lazarus SynEdit fork.

Martin

Reply by email

Bo Berglund
to Juha Manninen gmail
Show quoted text 6 lines
On Monday 11 October 2010 00:50:20 Bo Berglund wrote: > I am new here and I don't know how to add a feature request. Will > search for it on the web... Bugtracker. The same place where bug reports go.

Found it, I thought I had the wrong place because it showed the Free-Pascal bug tracker but then I saw that one could change the tracker via a small dropdown selector...

Anyway report added: http://mantis.freepascal.org/view.php?id=17603

Bo Berglund Developer in Sweden

Reply by email

Martin
to Bo Berglund
Bo Berglund wrote 13 lines
On Mon, 11 Oct 2010 12:29:59 +0300, "Juha Manninen (gmail)" wrote: > On Monday 11 October 2010 00:50:20 Bo Berglund wrote: >> I am new here and I don't know how to add a feature request. Will >> search for it on the web... > Bugtracker. The same place where bug reports go. > Found it, I thought I had the wrong place because it showed the Free-Pascal bug tracker but then I saw that one could change the tracker via a small dropdown selector... Anyway report added: http://mantis.freepascal.org/view.php?id=17603

Thanks.

A few hints for you, where to find some of the other features, you seem to be missing:

Show quoted text 11 lines
1) Select a block which has ragged left limit (some lines in different positions) 2) Use Ctrl-Shift-u repeatedly until the block is at the left edge and all lines now start in column 1. 3) Use Ctrl-Shift-i repeatedly to move the block to the wanted position. This does not work in Lazarus. Only by activating the Tab to move blocks in editor configuration is it possible to move blocks of text, but only to the right of the original position.

Go to menu -> enviroment -> options -> Tree: Editor / Key Mapping In the edit box on top enter "indent" => you should see 2 entries (from the "Text selection commands" (hint: they act on selection, thats why they are in this group)
"indent block": ctrl-i (without shift, but you can change it) / ctrl-k,i "unindent": crtl-u / ctrl-k,U

Show quoted text 8 lines
Using Shift-TAB does nothing, except if it is entered immediately after TAB, when it backs off the indentation just done by TAB. Notice that it seems totally impossible to move any block *left* of the original position, which totally breaks the procedure outlined above. It has been suggested that it is caused by not using TAB as indentation, but this is very hard to prove since Lazarus does not show any whitespace difference...

same option dialog, Tree: Editor / General / Misc: "Show special characters"
Tabs and spaces are shown.

Also on Editor/General : "Cursor skips tabs" (in cursor section) contols if the cursor can be in the middle of a tab.

More help (maybe slightly outdated) via F1 on
http://wiki.lazarus.freepascal.org/IDE_Window:_Editor_Options

Reply by email