#350 open
Michal Hantl

Jumpy comment indenting

Reported by Michal Hantl | October 21st, 2010 @ 10:28 PM

When I comment a line in ruby mode

#That.do(this)

The indentation that happens is not consistent

result A)

#That.do(this)

result B)
#That.do(this)

result C)
# That.do(this)

(or something like that)

Comments and changes to this ticket

  • Daniel Lucraft

    Daniel Lucraft October 23rd, 2010 @ 01:40 PM

    • State changed from “new” to “open”

    Are you doing this by typing the "#" character at the start of the line? Or are you using a plugin?

  • tim.felgentreff (at student.hpi.uni-potsdam)

    tim.felgentreff (at student.hpi.uni-potsdam) October 24th, 2010 @ 09:30 AM

    I cannot reproduce this. Which mode is the file in? Are you in some lexical scope?

    Please post more context.

  • Michal Hantl

    Michal Hantl October 25th, 2010 @ 12:02 PM

    Original

    
    class AdminOffersController < AdminController
        
      def orders_html; returns String
        html = ''
        weekdays = ['Ne', 'Po', 'Út', 'St', 'Čt', 'So', 'Ne']
        
        if params.action? :at
          at = TimeHelper.at(params.parse_long)
          orders = Order.for_day(at)
          html += "<h1>Objednávky z #{weekdays.get(at.week_day)} #{at.month_day}. #{at.month+1}."+
                  "[<a href=\"/admin/offers/add/at=#{at.ms}\">přidat slevu</a>]</h1>"
          html = "<div class=\"order-list\">"
          #html += orders_list(orders.toArray())
          html += "</div>"
        elsif params.action? :for
          offer = Offer.get(params.id)
          orders = Order.all.offer_id(offer.id).run
          html += "<h1>#{offer.title} [<a href=\"/admin/offers/edit/#{offer.id}\">upravit</a>]</h1>"
          html = "<div class=\"order-list\">"
          orders.each { |order|
            html += print_order(Order(order))
          } <--- this one will jump
          html += "</div>"
        end
        html
      end
    end
    

    Commented:

    
    class AdminOffersController < AdminController
        
      def orders_html; returns String
        html = ''
        weekdays = ['Ne', 'Po', 'Út', 'St', 'Čt', 'So', 'Ne']
        
        if params.action? :at
          at = TimeHelper.at(params.parse_long)
          orders = Order.for_day(at)
          html += "<h1>Objednávky z #{weekdays.get(at.week_day)} #{at.month_day}. #{at.month+1}."+
                  "[<a href=\"/admin/offers/add/at=#{at.ms}\">přidat slevu</a>]</h1>"
          html = "<div class=\"order-list\">"
          #html += orders_list(orders.toArray())
          html += "</div>"
        elsif params.action? :for
          offer = Offer.get(params.id)
          orders = Order.all.offer_id(offer.id).run
          html += "<h1>#{offer.title} [<a href=\"/admin/offers/edit/#{offer.id}\">upravit</a>]</h1>"
          html = "<div class=\"order-list\">"
          #orders.each { |order| <--- OK
            #html += print_order(Order(order)) <--- OK
            #} <--- JUMPY
          html += "</div>"
        end
        html
      end
    end
    
  • Deleted User

    Deleted User November 20th, 2010 @ 05:10 AM

    Comments intent to at least the same level as the last line. If you indent

    while true {
      do_it
    end
    
    to
    #while true {

    do_it

    
    
    

    end

    
    
    

    And that's more or less how I'd expect it to work.

  • Deleted User

    Deleted User November 20th, 2010 @ 05:20 AM

    Damn the comment formatting.

     while true do
       do_it
     end
    
    comments to
     # while true do
     #   do_it
     # end
    

    And that's more or less how I'd expect it to work.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

A programmer's text editor for Gnome.

People watching this ticket

Pages