load_buffer(argv[i]);
if (iline > 1 || icol > 1) {
- do_gotolinecolumn(iline, icol - 1, FALSE, FALSE,
- FALSE);
+ do_gotolinecolumn(iline, icol, FALSE, FALSE, FALSE);
iline = 1;
icol = 1;
}
display_main_list();
if (startline > 1 || startcol > 1)
- do_gotolinecolumn(startline, startcol - 1, FALSE, FALSE, FALSE);
+ do_gotolinecolumn(startline, startcol, FALSE, FALSE, FALSE);
#ifndef NANO_SMALL
/* Return here after a SIGWINCH. */
backupstring = mallocstrcpy(backupstring, answer);
return -2; /* Call the opposite search function. */
case NANO_TOGOTOLINE_KEY:
- do_gotolinecolumn(current->lineno, placewewant, TRUE,
- TRUE, FALSE);
+ do_gotolinecolumn(current->lineno, placewewant + 1,
+ TRUE, TRUE, FALSE);
/* Put answer up on the statusbar and
* fall through. */
default:
replace_abort();
}
+/* Go to the specified line and column, or ask for them if interactive
+ * is TRUE. Save the x-coordinate and y-coordinate if save_pos is TRUE.
+ * Note that both the line and column numbers should be one-based. */
void do_gotolinecolumn(int line, ssize_t column, bool use_answer, bool
interactive, bool save_pos)
{
}
/* Do a bounds check. Display a warning on an out-of-bounds
- * line number (which is one-based) or an out-of-bounds column
- * number (which is zero-based) only if we hit Enter at the
- * statusbar prompt. */
+ * line or column number only if we hit Enter at the statusbar
+ * prompt. */
if (!parse_line_column(answer, &line, &column) || line < 1 ||
- --column < 0) {
+ column < 1) {
if (i == 0)
statusbar(_("Come on, be reasonable"));
display_main_list();
if (line < 1)
line = current->lineno;
- if (column < 0)
- column = placewewant;
+ if (column < 1)
+ column = placewewant + 1;
}
for (current = fileage; current->next != NULL && line > 1; line--)
current = current->next;
- current_x = actual_x(current->data, column);
- placewewant = column;
+ current_x = actual_x(current->data, column - 1);
+ placewewant = column - 1;
/* If save_pos is TRUE, don't change the cursor position when
* updating the edit window. */
void do_gotolinecolumn_void(void)
{
- do_gotolinecolumn(current->lineno, placewewant, FALSE, TRUE, FALSE);
+ do_gotolinecolumn(current->lineno, placewewant + 1, FALSE, TRUE,
+ FALSE);
}
#if defined(ENABLE_MULTIBUFFER) || !defined(DISABLE_SPELLER)
/* Since do_gotolinecolumn() resets the x-coordinate but not the
* y-coordinate, set the coordinates up this way. */
current_y = pos_y;
- do_gotolinecolumn(line, pos_x, FALSE, FALSE, TRUE);
+ do_gotolinecolumn(line, pos_x + 1, FALSE, FALSE, TRUE);
/* Set the rest of the coordinates up. */
placewewant = pos_pww;