X-Git-Url: https://git.deb.at/?a=blobdiff_plain;f=edit.c;h=739d001d2c4e1cfa80468605c53ca00423aedaa2;hb=7d7ae6aab5fb6307328b7cfb193ebce3e2870624;hp=538eb422d18b1b80b6ad075cafab9045a8454a28;hpb=f5a6c419271623d4e30d257e4bfde1b0b6d0fb79;p=pkg%2Fabook.git diff --git a/edit.c b/edit.c index 538eb42..739d001 100644 --- a/edit.c +++ b/edit.c @@ -29,10 +29,7 @@ * some extern variables */ - -extern int curitem; extern int views_count; -extern int items; WINDOW *editw; @@ -510,17 +507,17 @@ edit_loop(int item) void edit_item(int item) { - if( item < 0 ) { - if( curitem < 0 ) + if(item < 0) { + if(list_get_curitem() < 0) return; else - item = curitem; + item = list_get_curitem(); } init_editor(); while((item = edit_loop(item)) >= 0) - curitem = item; /* hmm, this is not very clean way to go */ + list_set_curitem(item); /* this is not very clean way to go */ close_editor(); } @@ -541,8 +538,8 @@ add_item() add_item2database(item); item_free(&item); - curitem = LAST_ITEM; + list_set_curitem(last_item()); - edit_item(LAST_ITEM); + edit_item(last_item()); }