[Lazarus] How should "delete to end of word behave"

Martin Friebe lazarus at mfriebe.de
Fri Nov 7 22:28:29 CET 2008


Marius wrote:
> 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.


> 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
> Lazarus at lazarus.freepascal.org
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>   



More information about the Lazarus mailing list