Menu

#153 Provide expected tab stop behavior

closed-fixed
18. [text] (26)
5
2005-11-29
2004-01-17
Dave Hein
No

This patch file is for Tk8.4.2. It modifies
generic/tkTextDisp.c.

The problem is that the text widget has unusual tabbing
behavior that doesn't match the expectations of users.
The patch changes the tab stop behavior to match most
user's expectations.

Here is an example that demonstrates the strange
behavior (note that '\t' means hit the Tab key, and
'\n\ means hit the Enter or Return key):

In "wish" create the text widget using:

text .t -width 40 -height 20 -font {"Courier" 10} -tabs
{30 left 60 90 120 150}
pack .t

Then set the focus on the text widget and type
"\tx\tx\tx\tx\nxxxxx\tx\txx\tx\tx". In the unpatched
code you will see:

bbbbxbbxbbxbbx
xxxxxbxbxxbxbx

As you can see (adjusting for proportional font
distortions), the tabs are not moving the insertion
point to the expected tab stops.

After applying the patch, typing that same string yielded:

bbbbxbbxbbxbbx
xxxxxbxbbxxbxbbx

This time, the tab stops are honored and the insertion
points are where we expect them to be.

NOTE: I did not invent this patch. While search for a
solution to the problem I found this patch given at
this webpage:

http://www.qs.co.nz/Tcl/TkTabs.html

--
Dave Hein

Discussion

  • Dave Hein

    Dave Hein - 2004-01-17

    Patch file for tk8.4.2 to fix text widget tab problem

     
  • Vince Darley

    Vince Darley - 2004-01-19

    Logged In: YES
    user_id=32170

    Ok, I've tested with 8.5 and this has been fixed, along with
    many other text widget problems.

     
  • Donal K. Fellows

    • assigned_to: hobbs --> vincentdarley
     
  • Donal K. Fellows

    Logged In: YES
    user_id=79902

    So, should this patch be applied to the 8.4 branch or dropped?

     
  • Vince Darley

    Vince Darley - 2004-01-19

    Logged In: YES
    user_id=32170

    Good idea to apply patch to 8.4, I would say.

    If someone has the time/inclination it would be good to
    backport many other fixes from 8.5a0 (see Tk's changelog for
    the long list of bugs which have been fixed). The problem
    is that these fixes are to an objectified text widget but
    8.4 is char*-based, so backporting is not always trivial. A
    valuable if somewhat dull exercise ;-).

     
  • Vince Darley

    Vince Darley - 2004-02-28

    Logged In: YES
    user_id=32170

    Probably too late to apply to 8.4, but assigning to Jeff in
    case.

     
  • Vince Darley

    Vince Darley - 2004-02-28
    • assigned_to: vincentdarley --> hobbs
     
  • Jeffrey Hobbs

    Jeffrey Hobbs - 2005-11-29
    • status: open --> closed-fixed
     
  • Jeffrey Hobbs

    Jeffrey Hobbs - 2005-11-29

    Logged In: YES
    user_id=72656

    Taken care of in 8.5

     
MongoDB Logo MongoDB