def get_cursed_value
    return nil unless @field

    x = Ncurses.curx
    form_driver_key Ncurses::Form::REQ_VALIDATION
    v = @field.field_buffer(0).gsub(/^\s+|\s+$/, "")

    ## cursor <= end of text
    if x - @question.length - v.length <= 0
      v
    else # trailing spaces
      v + (" " * (x - @question.length - v.length))
    end

    # ncurses returns a ASCII-8BIT (binary) string, which
    # bytes presumably are of current charset encoding. we force_encoding
    # so that the char representation / string is tagged will be the
    # system locale and also hopefully the terminal/input encoding. an
    # incorrectly configured terminal encoding (not matching the system
    # encoding) will produce erronous results, but will also do that for
    # a lot of other programs since it is impossible to detect which is
    # which and what encoding the inputted byte chars are supposed to have.
    v.force_encoding($encoding).fix_encoding!
  end
def get_cursed_value
    return nil unless @field

    x = Ncurses.curx
    form_driver_key Ncurses::Form::REQ_VALIDATION
    v = @field.field_buffer(0).gsub(/^\s+|\s+$/, "")

    ## cursor <= end of text
    if x - @question.length - v.length <= 0
      v
    else # trailing spaces
      v + (" " * (x - @question.length - v.length))
    end

    # ncurses returns a ASCII-8BIT (binary) string, which
    # bytes presumably are of current charset encoding. we force_encoding
    # so that the char representation / string is tagged will be the
    # system locale and also hopefully the terminal/input encoding. an
    # incorrectly configured terminal encoding (not matching the system
    # encoding) will produce erronous results, but will also do that for
    # a lot of other programs since it is impossible to detect which is
    # which and what encoding the inputted byte chars are supposed to have.
    v.force_encoding($encoding).fix_encoding!
  end
ncurses inanity wrapper

 DO NOT READ THIS CODE. YOU WILL GO MAD.