Fixed Next/PreviousTableCellHandler

The handlers selected the complete content of the next table cell. The
new behavior is to place the caret to the start of the cell's content,
which is how most texteditors work.
The previous cell handler most probably never worked, as it selected the
current cell.

Change-Id: I1c8449ba96b176bd12930c0947a5d28d5b7a124c
Signed-off-by: Carsten Hiesserich <carsten.hie@gmail.com>
diff --git a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/NextTableCellHandler.java b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/NextTableCellHandler.java
index 4b01b21..d98b749 100644
--- a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/NextTableCellHandler.java
+++ b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/NextTableCellHandler.java
@@ -28,8 +28,7 @@
 		// in this row
 		for (final IElement cell : tableRow.childElements()) {
 			if (cell.getStartOffset() > offset) {
-				widget.moveTo(cell.getStartOffset());
-				widget.moveTo(cell.getEndOffset(), true);
+				widget.moveTo(cell.getStartOffset() + 1);
 				return;
 			}
 		}
@@ -40,8 +39,7 @@
 				final IElement firstCell = firstCellOf(siblingRow);
 
 				if (firstCell != null) {
-					widget.moveTo(firstCell.getStartOffset());
-					widget.moveTo(firstCell.getEndOffset(), true);
+					widget.moveTo(firstCell.getStartOffset() + 1);
 				} else {
 					System.out.println("TODO - dup row into new empty row");
 				}
diff --git a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/PreviousTableCellHandler.java b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/PreviousTableCellHandler.java
index 29488fc..2e2aabf 100644
--- a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/PreviousTableCellHandler.java
+++ b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/PreviousTableCellHandler.java
@@ -26,7 +26,7 @@
 	protected void navigate(final VexWidget widget, final IElement tableRow, final int offset) {
 		IElement siblingCell = null;
 		for (final IElement cell : tableRow.childElements()) {
-			if (cell.getStartOffset() >= offset) {
+			if (cell.getEndOffset() >= offset) {
 				break;
 			}
 			siblingCell = cell;
@@ -34,14 +34,13 @@
 
 		// in this row
 		if (siblingCell != null) {
-			widget.moveTo(siblingCell.getStartOffset());
-			widget.moveTo(siblingCell.getEndOffset(), true);
+			widget.moveTo(siblingCell.getStartOffset() + 1);
 			return;
 		}
 
 		IElement siblingRow = null;
 		for (final IElement row : tableRow.getParentElement().childElements()) {
-			if (row.getStartOffset() >= offset) {
+			if (row.getEndOffset() >= offset) {
 				break;
 			}
 			siblingRow = row;
@@ -51,8 +50,7 @@
 		if (siblingRow != null) {
 			final IElement lastCell = lastCellOf(siblingRow);
 			if (lastCell != null) {
-				widget.moveTo(lastCell.getStartOffset());
-				widget.moveTo(lastCell.getEndOffset(), true);
+				widget.moveTo(lastCell.getStartOffset() + 1);
 			}
 		}
 	}