Method: CDK::SCALE#validEditPosition
- Defined in:
- lib/cdk/scale.rb
#validEditPosition(new_position) ⇒ Object
Check if the cursor is on a valid edit-position. This must be one of the non-blank cells in the field.
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 |
# File 'lib/cdk/scale.rb', line 183 def validEditPosition(new_position) if new_position <= 0 || new_position >= @field_width return false end if self.moveToEditPosition(new_position) == Ncurses::ERR return false end ch = @field_win.winch if ch.chr != ' ' return true end if new_position > 1 # Don't use recursion - only one level is wanted if self.moveToEditPosition(new_position - 1) == Ncurses::ERR return false end ch = @field_win.winch return ch.chr != ' ' end return false end |