Browse Subversion Repository
Contents of /cursor.rb
Parent Directory
| Revision Log
Revision 44 -
( show annotations)
( download)
Fri Apr 20 19:04:12 2007 UTC
(16 years, 11 months ago)
by bluedwarf
File size: 1258 byte(s)
* New: meta commands
* New scroll function for Ncurses mode.
| 1 |
# cursor.rb: the class definition of Edmaru::Cursor |
| 2 |
# |
| 3 |
# Copyright (C) 2007 Takashi Nakamoto |
| 4 |
# |
| 5 |
# This program is free software; you can redistribute it and/or modify |
| 6 |
# it under the terms of the GNU General Public License version 2 as |
| 7 |
# published by the Free Software Foundation. |
| 8 |
# |
| 9 |
# This program is distributed in the hope that it will be useful, but |
| 10 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 |
# General Public License for more details. |
| 13 |
# |
| 14 |
# You should have received a copy of the GNU General Public License |
| 15 |
# along with this program; if not, write to the Free Software |
| 16 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
| 17 |
# 02110-1301 USA. |
| 18 |
# |
| 19 |
|
| 20 |
module Edmaru |
| 21 |
|
| 22 |
#The cursor instance that represents logical location in a specific |
| 23 |
#buffer. |
| 24 |
class Cursor |
| 25 |
|
| 26 |
def initialize(a_row = 0, a_col = 0) |
| 27 |
@row = a_row |
| 28 |
@col = a_col |
| 29 |
end |
| 30 |
|
| 31 |
def row=(new_row) |
| 32 |
@row = new_row |
| 33 |
end |
| 34 |
|
| 35 |
def row |
| 36 |
@row |
| 37 |
end |
| 38 |
|
| 39 |
def column=(new_col) |
| 40 |
@col = new_col |
| 41 |
end |
| 42 |
|
| 43 |
def column |
| 44 |
@col |
| 45 |
end |
| 46 |
|
| 47 |
def ==(other) |
| 48 |
return nil if other.class != self.class |
| 49 |
self.row == other.row && self.column == other.column |
| 50 |
end |
| 51 |
end |
| 52 |
end |
|