Menu

#100 Elastic tabstops

closed
None
5
2011-11-27
2008-10-16
No

This looks like a great idea for improving readability and easy indentation in code files: http://nickgravgaard.com/elastictabstops/

Discussion

  • Jörgen Kosche (Mnementh)

    Elastic tabstops would be a great addition.

     
  • Alan Ezust

    Alan Ezust - 2009-09-03

    Instead of adding this to core,
    this should go in either the whitespace plugin, or its own separate plugin.
    Moving to plugin feature requests.

     
  • Jose Quesada

    Jose Quesada - 2009-12-08

    +1
    - Makes a world of diffference
    - only available in gedit, codebrowser editors. Most editors cannot implement it correctly
    - the example is done in java, so it must be possible for jedit to implement it

     
  • Dale Anson

    Dale Anson - 2009-12-08

    I think this would need changes in the core to be implemented. The whitespace plugin really doesn't address this issue at all, mostly it just does highlighting, and tab to space and space to tab conversion. I think that both Chunk.java and TextAreaPainter.java would need to be modified for this to work, and probably a few other files that work with the text area.

    Unfortunately, the example code is not useful in jEdit. The example manipulates a StyledDocument, which jEdit does not use at all.

     
  • Anshal Shukla

    Anshal Shukla - 2010-07-13
    • assigned_to: nobody --> anshalmnit
     
  • Anshal Shukla

    Anshal Shukla - 2010-08-08

    Patch for testing elastic tab stops functionality

     
  • Anshal Shukla

    Anshal Shukla - 2010-08-08

    I am nearly done with this !
    Before I give it the final touches can somebody confirm that this is working fine?
    Please apply the patch (attached) and let me know how it goes.

    Elastic tab stops can be turned ON by clicking on Edit>Indent>Reindent using elastic tabstops
    and can be turned OFF by clicking on Edit>Indent>Reindent using tabs/spaces
    (they are turned OFF initially)

    size of any tab character in the buffer = size of the longest row (in the column block the tab lies in) + tab width(set by the user in Utilities>Buffer Options>Tab Width)

     
  • Anonymous

    Anonymous - 2010-08-09

    Great work!
    Is this supposed to work only with fixed-width fonts (such as Monospaced, Courier New)? I thought this was supposed to work with any font.
    It seems to work fine, but with fixed-width fonts only.

     
  • Dale Anson

    Dale Anson - 2010-08-09

    Perhaps I need some additional instruction. It didn't work the way I expected, but that probably just means my expectations need adjusted.

    Would it make sense to have a checkbox under the text area settings to enable/disable this feature?

     
  • Anonymous

    Anonymous - 2010-08-09

    I guess it makes sense, and it would have a similar meaning to the whitespace options of the Whitespace plugin - text area settings option determines the default, while the action affect the current buffer only.
    This feature is useful only if all the developers working on a source file use elastic tabstops. So, I'm not sure you'd like to turn it on globally. But having both an option in Global Options and actions to toggle it would be good.

     
  • Anshal Shukla

    Anshal Shukla - 2010-08-09

    I will do the required modifications to make this work with any font.
    A check box for this feature makes sense as besides other things it would clearly show which indentation(elastic tabstops or normal) is being used currently.
    Perhaps we should also consider the case where the user wants this setting to be enabled over multiple files at once (like source files of a particular project) .
    Dale, can you please elaborate more on what other info you require?
    Currently this setting (Edit>Indent>Reindent using elastic tabstops) works on per buffer basis.

     
  • Anonymous

    Anonymous - 2010-08-10

    Small comments:
    1. I think you can use a check-box style menu item instead of the 2 normal items. This has the additional effect of showing which of the 2 is currently used.
    2. The name "reindent using ..." is not very good since it sounds like it's a one-time action - reindent now - when actually it changes the indentation mode of the buffer, that future indents will also use.
    3. Related to (2) - I didn't check, but is the indentation mode persistent, or only used until the buffer is closed? It sounds like a buffer-local property.

     
  • Anshal Shukla

    Anshal Shukla - 2010-08-17

    Added a new patch(elasticTabstops_Aug17.diff)
    This should work with variable width fonts now.

    Turn ON\OFF
    Elastic tabstops can be turned ON\OFF :
    1)globally inside- Utilities>Global Options> by ticking the checkbox "Indent using elastic tabstops".(This setting always persists )
    2)on a per buffer basis inside - Utilities>Buffer Options> by ticking the checkbox "Indent using elastic tabstops" .(This setting is lost once the buffer is closed)
    3)by using buffer local properties- :elasticTabstops=true:(This setting always persists )

    Please give it a try and let me know any questions\concerns\issues .

    Lets make jedit one of the very few editors that provide elastic tabstops !

     
  • Anonymous

    Anonymous - 2010-08-17

    Thanks for the patch, but I have a problem applying it - I get the message "An unknown line type was found in line 272" (of the patch). I don't know what's bad in this patch, I had no problem applying the previous one.

     
  • Anshal Shukla

    Anshal Shukla - 2010-08-17

    Patch for testing elastic tab stops functionality(added on Aug 17,2010)

     
  • Anshal Shukla

    Anshal Shukla - 2010-08-17

    Removed the old patch and added a new one (elasticTabstops_Aug17.diff).Please try this one and let me know how it goes.

     
  • Anonymous

    Anonymous - 2010-08-17

    Great, thanks! Seems to be working fine, with any type of font.
    I still haven't looked at the code, but some minor adjustments should be made to the code style (to match the style of the core).
    In addition, this has to be documented in the jEdit manual.

     
  • Anshal Shukla

    Anshal Shukla - 2010-10-12

    patch with some fixes related to formatting

     
  • Anshal Shukla

    Anshal Shukla - 2010-10-12

    submitted a new patch "patch_elasticTabStopOct122010.diff" after fixing the formatting

     
  • goebbe

    goebbe - 2011-07-21

    I am using Jedit 4.4.1 and could not find the option for "elastic tabstops".
    Did the patch/feature never made it into the release?
    Or did I look at the wrong places?

     
  • Steve

    Steve - 2011-07-21

    I don't know if it made it into the 4.4.1 release, but it is in the 4.5pre1 daily, under Utilities>Global Options>Editing, about mid-way down.

     
  • goebbe

    goebbe - 2011-07-21

    Thanks a lot for the reply. Indeed it seems that elastic tabstops did not make it in 4.4.1..
    However I just installed the daily build of 4.5pre1 and the option is there.
    Thanks a lot.

     
  • Alan Ezust

    Alan Ezust - 2011-11-27
    • status: open --> closed
     

Log in to post a comment.