Twiddle?

New Message Reply Date view Thread view Subject view Author view

From: Masatsugu Nagata (nagata@kurims.kyoto-u.ac.jp)
Date: 9 Mar 01, 22:58 EST


From: Masatsugu Nagata <nagata@kurims.kyoto-u.ac.jp>
Subject: Twiddle?

Vince wrote:

> > > So, you're adding yet another user-preference to our list of i,ii,iii?
> > > How does it relate to the other preferences?
> > >
> > No, I'm not.
> 
> Really.  First you suggested keeping the cursor position fixed, and then
> you presented a procedure which moved it (with the convenient option for
> the user to edit the procedure if they wanted a different behaviour)!
> That strikes me as adding another preference (or shall we have no
> preferences at all and simply tell all users to 'edit procedures').
> 
Really.  The issue here (and your suggestion of three preference choices)
were about the _target_ of the twiddle operation.  Whether the cursor
position was to be fixed after the twiddle operation or not was not the 
issue.  Therefore, I was _not_ adding "yet another user-preference".

It was _your_ idea to add "yet another" preference (that is, the
three options about the twiddling target).  I, personally, am against
adding such things, which unnecessarily complicates AlphaTcl.

As for the cursor position after the operation, I was totally convinced
by Tom Burke, that it would be best if Alpha's twiddling behaved
exactly in the same way as emacs does.  That is,

- transpose characters before and after the cursor,  and
- move the cursor one-char-forward (that is, after the two transposed
 characters), so that the 'twiddle' operation can be repeated to
 twiddle the characters further (not just reverting to the previous
 state, which can be realised by 'undo').

My 'twiddle0' and 'teiddleWords0' procs behave exactly in this way, (that
is, the "emacs way"), _if_there_is_no_selection_ when the procs are run.
So, if I start from "abc def", place the cursor between "a" and "b", and
run 'twiddle' 6-times-in-a-row, then I get "bc defa", as Tom Burke wrote:

> With the above, one can use twiddle successively to move a letter (or
> word) several spaces to the right -- if you want more than just a
> one-time transposition.  E.g., "I rather often found this useful"
> could be edited to "I often found this rather useful" in short order.

Now, Vince wrote:

> Really.  First you suggested keeping the cursor position fixed, and then
> 
No, I have never suggested keeping the cursor position fixed.
I suggested that _if_ a proc operates _on_a_(selected)_region_ of text,
then the operated region should be left selected (or, the 'mark' and
'point' pair be left at the ends of the operated region) after the
operation.

My 'twiddle0' and 'twiddleWords0' procs behave in this way, too, when
there is a selected text.  As for 'twiddle0', it does nothing if only
one character is selected, and, if two or more characters are selected,
it transposes the first character and the last character in the selection,
and leaves the region selected after the operation.

So, my twiddle0/twiddleWords0 behaves exactly "the emacs way" when
nothing is selected, and does the natural thing when some text is
selected.  I believe this could be the best behaviour for the
"case (i)" among the three preference options that Vince has proposed,
thus my posting this  twiddle0/twiddleWords0  to the atcl-d mailing
list.

Anyway, this  twiddle0/twiddleWords0  has already found position in
my personal 7.4.1 'prefs.tcl' file, as well as my personal 6.52 'misc.tcl'
file (under different proc-name, of course).

Cheers,

Mark
-- 
Mark Nagata
mailto:nagata@kurims.kyoto-u.ac.jp

_______________________________________________
AlphaTcl-developers mailing list
AlphaTcl-developers@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/alphatcl-developers


New Message Reply Date view Thread view Subject view Author view

This archive was generated by das@users.sourceforge.net with hypermail 2b29 on 31 Mar 01, 11:51 EST