Method: RubyCurses::TextView#check_curpos

Defined in:
lib/rbcurse/core/widgets/rtextview.rb

#check_curposObject

newly added to check curpos when moving up or down



354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
# File 'lib/rbcurse/core/widgets/rtextview.rb', line 354

def check_curpos #:nodoc:
  @buffer = @list[@current_index]
  # if the cursor is ahead of data in this row then move it back
  if @pcol+@curpos > row_length
    addcol((@pcol+row_length-@curpos)+1)
    @curpos = row_length 
    maxlen = (@maxlen || @width-@internal_width)

    # even this row is gt maxlen, i.e., scrolled right
    if @curpos > maxlen
      @pcol = @curpos - maxlen
      @curpos = maxlen-1 
    else
      # this row is within maxlen, make scroll 0
      @pcol=0
    end
    set_form_col 
  end
end