a few last missing minor bits of DB's refactored display code
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1561 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
f03c78b382
commit
2dd7ed14bc
13
ChangeLog
13
ChangeLog
|
@ -46,12 +46,13 @@ CVS code -
|
|||
instead of several; and do some other minor refactoring of
|
||||
related display functions to simplify them. New functions
|
||||
mark_order() and display_string(); changes to actual_x(),
|
||||
strnlenpt(), blank_bottombars(), edit_add(), update_line(),
|
||||
statusbar(), and do_replace_highlight(). (David Benbennick)
|
||||
DLR: Add minor cosmetic tweaks, add missing NANO_SMALL #ifdef
|
||||
around the text for a backwards search in the refactored code,
|
||||
and enclose dump_buffer() and dump_buffer_reverse() in one
|
||||
ENABLE_DEBUG #ifdef instead of two.
|
||||
strnlenpt(), blank_bottombars(), blank_edit(),
|
||||
get_page_start(), edit_add(), update_line(), statusbar(), and
|
||||
do_replace_highlight(). (David Benbennick) DLR: Add minor
|
||||
cosmetic tweaks, add missing NANO_SMALL #ifdef around the text
|
||||
for a backwards search in the refactored code, and enclose
|
||||
dump_buffer() and dump_buffer_reverse() in one ENABLE_DEBUG
|
||||
#ifdef instead of two.
|
||||
- Convert memmove() function calls to charmove() macro calls, as
|
||||
the former all work on char*'s. (DLR)
|
||||
- files.c:
|
||||
|
|
|
@ -473,7 +473,7 @@ void onekey(const char *keystroke, const char *desc, int len);
|
|||
#ifndef NDEBUG
|
||||
int check_linenumbers(const filestruct *fileptr);
|
||||
#endif
|
||||
int get_page_start(int column);
|
||||
size_t get_page_start(size_t column);
|
||||
void reset_cursor(void);
|
||||
void add_marked_sameline(int begin, int end, filestruct *fileptr, int y,
|
||||
int virt_cur_x, int this_page);
|
||||
|
|
21
src/winio.c
21
src/winio.c
|
@ -411,7 +411,7 @@ void blank_bottomwin(void)
|
|||
void blank_edit(void)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i <= editwinrows - 1; i++)
|
||||
for (i = 0; i < editwinrows; i++)
|
||||
mvwaddstr(edit, i, 0, hblank);
|
||||
}
|
||||
|
||||
|
@ -965,11 +965,20 @@ int check_linenumbers(const filestruct *fileptr)
|
|||
|
||||
/* nano scrolls horizontally within a line in chunks. This function
|
||||
* returns the column number of the first character displayed in the
|
||||
* window when the cursor is at the given column. */
|
||||
int get_page_start(int column)
|
||||
* window when the cursor is at the given column. Note that
|
||||
* 0 <= column - get_page_start(column) < COLS. */
|
||||
size_t get_page_start(size_t column)
|
||||
{
|
||||
assert(COLS > 9);
|
||||
return column < COLS - 1 ? 0 : column - 7 - (column - 8) % (COLS - 9);
|
||||
assert(COLS > 0);
|
||||
if (column == 0 || column < COLS - 1)
|
||||
return 0;
|
||||
else if (COLS > 9)
|
||||
return column - 7 - (column - 8) % (COLS - 9);
|
||||
else if (COLS > 2)
|
||||
return column - (COLS - 2);
|
||||
else
|
||||
return column - (COLS - 1);
|
||||
/* The parentheses are necessary to avoid overflow. */
|
||||
}
|
||||
|
||||
/* Resets current_y, based on the position of current, and puts the
|
||||
|
@ -1318,7 +1327,7 @@ void update_line(const filestruct *fileptr, size_t index)
|
|||
|
||||
/* Next, convert variables that index the line to their equivalent
|
||||
* positions in the expanded line. */
|
||||
index = fileptr == current ? strnlenpt(fileptr->data, index) : 0;
|
||||
index = (fileptr == current) ? strnlenpt(fileptr->data, index) : 0;
|
||||
page_start = get_page_start(index);
|
||||
|
||||
/* Expand the line, replacing Tab by spaces, and control characters
|
||||
|
|
Loading…
Reference in New Issue