Commit 4ab80154 authored by David Lawrence Ramsey's avatar David Lawrence Ramsey
Browse files

simplify do_cursorpos(), and remove an unneeded assert from it

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2953 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
parent c879f556
Showing with 8 additions and 12 deletions
+8 -12
...@@ -273,6 +273,8 @@ CVS code - ...@@ -273,6 +273,8 @@ CVS code -
that there's more room for other things, and to not display that there's more room for other things, and to not display
the status when we're in the file browser, since Pico doesn't. the status when we're in the file browser, since Pico doesn't.
(DLR) (DLR)
do_cursorpos()
- Simplify, and remove unneeded assert. (DLR)
- configure.ac: - configure.ac:
- Since we only use vsnprintf() now, remove the tests for - Since we only use vsnprintf() now, remove the tests for
snprintf(). (DLR) snprintf(). (DLR)
......
...@@ -3823,25 +3823,19 @@ void display_main_list(void) ...@@ -3823,25 +3823,19 @@ void display_main_list(void)
* display the current cursor position next time. */ * display the current cursor position next time. */
void do_cursorpos(bool constant) void do_cursorpos(bool constant)
{ {
char c; size_t i = 0, cur_xpt = xplustabs() + 1;
filestruct *f;
size_t i, cur_xpt = xplustabs() + 1;
size_t cur_lenpt = strlenpt(openfile->current->data) + 1; size_t cur_lenpt = strlenpt(openfile->current->data) + 1;
int linepct, colpct, charpct; int linepct, colpct, charpct;
assert(openfile->current != NULL && openfile->fileage != NULL); assert(openfile->fileage != NULL && openfile->current != NULL);
c = openfile->current->data[openfile->current_x]; if (openfile->current->prev != NULL)
f = openfile->current->next; i += get_totsize(openfile->fileage, openfile->current->prev);
openfile->current->data[openfile->current_x] = '\0'; i += mbstrnlen(openfile->current->data, openfile->current_x);
openfile->current->next = NULL;
i = get_totsize(openfile->fileage, openfile->current);
openfile->current->data[openfile->current_x] = c;
openfile->current->next = f;
/* Check whether totsize is correct. If it isn't, there is a bug /* Check whether totsize is correct. If it isn't, there is a bug
* somewhere. */ * somewhere. */
assert(openfile->current != openfile->filebot || i == openfile->totsize); assert(i == openfile->totsize);
if (constant && disable_cursorpos) { if (constant && disable_cursorpos) {
disable_cursorpos = FALSE; disable_cursorpos = FALSE;
......
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