Commit df2a4679 authored by David Lawrence Ramsey's avatar David Lawrence Ramsey Committed by Benno Schulenberg
Browse files

softwrap: account for softwrap in get_page_start()

In softwrap mode, nano doesn't horizontally scroll lines at all, so in
this case get_page_start() should always return zero.
parent 380ad30a
Showing with 4 additions and 3 deletions
+4 -3
...@@ -367,13 +367,14 @@ char *free_and_assign(char *dest, char *src) ...@@ -367,13 +367,14 @@ char *free_and_assign(char *dest, char *src)
return src; return src;
} }
/* nano scrolls horizontally within a line in chunks. Return the column /* When not in softwrap mode, nano scrolls horizontally within a line in
* number of the first character displayed in the edit window when the * chunks (a bit smaller than the chunks used in softwrapping). Return the
* column number of the first character displayed in the edit window when the
* cursor is at the given column. Note that (0 <= column - * cursor is at the given column. Note that (0 <= column -
* get_page_start(column) < COLS). */ * get_page_start(column) < COLS). */
size_t get_page_start(size_t column) size_t get_page_start(size_t column)
{ {
if (column == 0 || column < editwincols - 1) if (column < editwincols - 1 || ISSET(SOFTWRAP) || column == 0)
return 0; return 0;
else if (editwincols > 8) else if (editwincols > 8)
return column - 7 - (column - 7) % (editwincols - 8); return column - 7 - (column - 7) % (editwincols - 8);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment