summaryrefslogtreecommitdiff
path: root/input.c
diff options
context:
space:
mode:
Diffstat (limited to 'input.c')
-rw-r--r--input.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/input.c b/input.c
index 5b6ed6ece6e4..6780500d5a5b 100644
--- a/input.c
+++ b/input.c
@@ -146,13 +146,13 @@ get_forw_line:
if (is_line_contig_pos(curr_pos))
{
prewind(TRUE);
- plinestart(base_pos);
+ plinestart(base_pos, curr_pos);
ch_seek(curr_pos);
new_pos = curr_pos;
} else
{
prewind(FALSE);
- plinestart(base_pos);
+ plinestart(base_pos, curr_pos);
ch_seek(base_pos);
new_pos = base_pos;
while (new_pos < curr_pos)
@@ -355,7 +355,7 @@ public POSITION forw_line(POSITION curr_pos, POSITION *p_linepos, lbool *p_newli
* a line. The new position is the position of the first character
* of the PREVIOUS line. The line obtained is the one starting at new_pos.
*/
-public POSITION back_line(POSITION curr_pos, lbool *p_newline)
+public POSITION back_line(POSITION curr_pos, POSITION *p_linepos, lbool *p_newline)
{
POSITION base_pos;
POSITION new_pos;
@@ -368,6 +368,8 @@ public POSITION back_line(POSITION curr_pos, lbool *p_newline)
POSITION wrap_pos;
lbool skipped_leading;
+ if (p_linepos != NULL)
+ *p_linepos = NULL_POSITION;
get_back_line:
if (p_newline != NULL)
*p_newline = TRUE;
@@ -459,9 +461,9 @@ get_back_line:
return (NULL_POSITION);
}
endline = FALSE;
- prewind(FALSE);
- plinestart(new_pos);
loop:
+ prewind(FALSE);
+ plinestart(new_pos, new_pos);
wrap_pos = NULL_POSITION;
skipped_leading = FALSE;
begin_new_pos = new_pos;
@@ -583,6 +585,8 @@ get_back_line:
if (status_col)
init_status_col(base_pos, line_position(), edisp_pos, new_pos);
#endif
+ if (p_linepos != NULL)
+ *p_linepos = curr_pos;
return (begin_new_pos);
}