Sign in Join

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

Mailing lists / lazarus / 2008-11

How should "delete to end of word behave"

9 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

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

Martin Friebe

In 0.9.26 Lazarus deletes to the end of the current token. (Note current SVN behaves different)
|foo_bar := 1;

deletes as follows
foo_bar
<space>
:=
<space>
1
;

There is a request to include deletion of the space, into the deletion of the word before it
foo_bar<space>
:=<space>
1
;

While this would be no problem if the cursor was at the beginning of a word, this may be an issue if the cursor is in the middle of o word foo_b|ar and xyz
would be foo_b|and xyz
instead of foo_b| and xyz

On the other hand, the 0.9.26 behaviour means that foo_bar| and xyz
means 2 ctrl-t, to delete "and", since the first only deletes the <space>

see also http://bugs.freepascal.org/view.php?id=12583

--------------
My opinion is that handling the spaces as n entity of there own, which can and will be deleted by a ctrl-t of its own, allows the best flexibility. Always deleting the spaces with the current word, leads to unwanted situation, if the cursor is in the middle of a word.

A 3rd option is to make it context sensitive, depending on the cursor being at the start of the word (open-office and word do that). I am not necessarily a fan of it.

Any opinions?

Reply by email

Marius
to Martin Friebe

I'm a of the option to delete the spaces behind the word also to make the editor turbo and delphi compatible. Its not because i want it to be fully compatible, but handling it this way requires a lot less keystrokes if you want to delete the first 4 words in a sentence.

I was testing a bit more last night and i was wundering about the following situation:
a:= 'foo_bar| and xyz';
a:= 'foo_bar xyz';
Is this how it should behave ?
(watch the spaces)

Greetings,
Marius

Martin Friebe wrote 45 lines
In 0.9.26 Lazarus deletes to the end of the current token. (Note current SVN behaves different) |foo_bar := 1; deletes as follows foo_bar <space> := <space> 1 ; There is a request to include deletion of the space, into the deletion of the word before it foo_bar<space> :=<space> 1 ; While this would be no problem if the cursor was at the beginning of a word, this may be an issue if the cursor is in the middle of o word foo_b|ar and xyz would be foo_b|and xyz instead of foo_b| and xyz On the other hand, the 0.9.26 behaviour means that foo_bar| and xyz means 2 ctrl-t, to delete "and", since the first only deletes the <space> see also http://bugs.freepascal.org/view.php?id=12583 -------------- My opinion is that handling the spaces as n entity of there own, which can and will be deleted by a ctrl-t of its own, allows the best flexibility. Always deleting the spaces with the current word, leads to unwanted situation, if the cursor is in the middle of a word. A 3rd option is to make it context sensitive, depending on the cursor being at the start of the word (open-office and word do that). I am not necessarily a fan of it. Any opinions?

Reply by email

Martin Friebe
to Marius
Marius wrote 12 lines
I'm a of the option to delete the spaces behind the word also to make the editor turbo and delphi compatible. Its not because i want it to be fully compatible, but handling it this way requires a lot less keystrokes if you want to delete the first 4 words in a sentence. I was testing a bit more last night and i was wundering about the following situation: a:= 'foo_bar| and xyz'; a:= 'foo_bar xyz'; Is this how it should behave ? (watch the spaces)

There are currently 2 things:
1) a regression in SVN: It will delete to the end of the next word, even if there are spaces in front.
This should and will be corrected. It should be: ( "->" indicates ctrl-t ABC| DEF X -> ABC|DEF X -> ABC| X

Well or maybe the last example without space.

IMHO there are 3 option how it could finally be. You can see in all 3 examples that it will differ between space, identifer-chars, and punctation

1) spaces are *not* trimmed

  f|oo_bar  :=  ord('b');  ->   f|  :=  ord('b');  ->  f|:=  ord('b');

-> f| ord('b'); -> f|ord('b'); -> f|('b'); -> f|b'); -> f|'); -> f|

2) spaces are trimmed

  f|oo_bar  :=  ord('b');  ->   f|:=  ord('b');  ->   f|ord('b');  ->

f|('b'); -> f|b'); -> f|'); -> f|

3) spaces are trimmed only if you where at the start of the word (|cond1 AND cond2) -> (|AND cond2)
(co|nd1 AND cond2) -> (co| AND cond2)

The last one is what open-office does and MS word. It solves both: the quick deletition of many word and avoiding to join 2 (unrelated) words. Question is, if it could be irritating to have it conttext sensitive.

Show quoted text 54 lines
Martin Friebe wrote: > In 0.9.26 Lazarus deletes to the end of the current token. (Note current > SVN behaves different) > |foo_bar := 1; > > deletes as follows > foo_bar > <space> > := > <space> > 1 > ; > > There is a request to include deletion of the space, into the deletion > of the word before it > foo_bar<space> > :=<space> > 1 > ; > > While this would be no problem if the cursor was at the beginning of a > word, this may be an issue if the cursor is in the middle of o word > foo_b|ar and xyz > would be foo_b|and xyz > instead of foo_b| and xyz > > On the other hand, the 0.9.26 behaviour means that > foo_bar| and xyz > means 2 ctrl-t, to delete "and", since the first only deletes the <space> > > see also http://bugs.freepascal.org/view.php?id=12583 > > -------------- > My opinion is that handling the spaces as n entity of there own, which > can and will be deleted by a ctrl-t of its own, allows the best flexibility. > Always deleting the spaces with the current word, leads to unwanted > situation, if the cursor is in the middle of a word. > > A 3rd option is to make it context sensitive, depending on the cursor > being at the start of the word (open-office and word do that). I am not > necessarily a fan of it. > > > Any opinions? > > > _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Alexander Klenin
to Martin Friebe
Martin Friebe wrote 20 lines
IMHO there are 3 option how it could finally be. You can see in all 3 examples that it will differ between space, identifer-chars, and punctation 1) spaces are *not* trimmed f|oo_bar := ord('b'); -> f| := ord('b'); -> f|:= ord('b'); -> f| ord('b'); -> f|ord('b'); -> f|('b'); -> f|b'); -> f|'); -> f| 2) spaces are trimmed f|oo_bar := ord('b'); -> f|:= ord('b'); -> f|ord('b'); -> f|('b'); -> f|b'); -> f|'); -> f| 3) spaces are trimmed only if you where at the start of the word (|cond1 AND cond2) -> (|AND cond2) (co|nd1 AND cond2) -> (co| AND cond2) The last one is what open-office does and MS word. It solves both: the quick deletition of many word and avoiding to join 2 (unrelated) words. Question is, if it could be irritating to have it conttext sensitive.

Assuming you speak about Ctrl+Delete shortcut in these applications:

OpenOffice 3.0 does delete _the next word_, even is there are spaces in front of it (which makes sense since word processor users rarely need to indent text).
I do not have MS Word to check.

OTOH, Visual Studio 2008 (and some other widows-specific programmer-oriented editors,
like Far Commander and Notepad++) behave like Delphi, i.e. according to case (2) above.

BTW, perhaps it would be good to add Ctrl+Delete as a default synonym to Ctrl+T?

Alexander S. Klenin Insight Experts Ltd.

Reply by email

Marius
to Alexander Klenin
BTW, perhaps it would be good to add Ctrl+Delete as a default synonym to Ctrl+T

Correct me if i'm wrong about this, but basicly i think we all agree that option 1 isn't going to be very helpfull (way to much keystrokes).

I do not know if option 3 will be used a lot (for me it feels wrong, but i have been using turbo products and option2 for way to many years). Mayby Alexanders idea to put option 3 under Ctrl-Delete would be a solution (and Ctrl-T for option 2)?

Reply by email

Alexander Klenin
to Marius

I tested the latest trunk with the fix to this issue (#12583).

Since I can not comment on 'resolved' issue without reopening it, I'll do it here.
It works as described in the last note, and, while slightly complicated and not fully compatible with Delphi, I think current behaviour is good enough.

The only question is -- should key mapping name be modified, since 'delete to end of word' does not quite describe what is going on?

Alexander S. Klenin Insight Experts Ltd.

Reply by email

Martin
to Alexander Klenin
Alexander Klenin wrote 19 lines
On Sun, Nov 9, 2008 at 02:39, Alexander Klenin wrote: > Just found another minor glitch. Given text: > > abc def <cursor> > xyz > > Ctrl+T results in > > abc defxyz > > i.e. spaces _to the left_ of cursor are deleted. > Since there was no reaction, I closed original issue http://bugs.freepascal.org/view.php?id=12583 and created a new one about this particular bug: http://bugs.freepascal.org/view.php?id=12822

Yes that got lost.

Initially I think was the question, if the spaces should be inserted. Because the caret being past EOL, the spaces were never there to start with. However any other command executed with the caret past EOL, seems to insert the spaces, so ctrl-t should too.

It will be fixed (early next year, since I am away currently)

Regards
Martin

Reply by email