Finch does not restore cursor + a fix

Dave Wood dave at unrealize.co.uk
Tue Jan 6 16:59:41 EST 2009


On (21:50 06/01/09), Dave Wood <dave at unrealize.co.uk> put forth the proposition:
>On (21:35 06/01/09), Dave Wood <dave at unrealize.co.uk> put forth the proposition:
>>On (21:21 06/01/09), Dave Wood <dave at unrealize.co.uk> put forth the proposition:
>>>I noticed this problem a few days ago and also noticed with one of my own
>>>programs. When exiting Finch the cursor is not restored to the termcap
>>>setting.
>>>
>>>I use a flashing block cursor because my eyesight isn't so great but finch
>>>always resets it to underline at exit. I managed to fix my own curses code
>>>so I thought you might like to have a look:
>>>
>>>
>>>int main ( void )
>>>{
>>>      // ncurses start
>>>      initscr();
>>>      cbreak();
>>>      noecho();
>>>      nonl();
>>>      intrflush(stdscr, FALSE);
>>>      keypad(stdscr, TRUE);
>>>      clear();
>>>      curs_set(0);
>>>
>>>      //main loop
>>>	 <snip>
>>>
>>>      // exiting
>>>      curs_set(1);
>>>      cout<<cursor_visible; // < -- restore cursor to terminfo setting
>>>      refresh();
>>>      endwin();
>>>      cout<<clear_screen; // <-- need this to restore colour
>>>      return 0;
>>>}
>>>
>>>I haven't tried this in the finch code yet. I will do so now and see if I 
>>>have any luck.
>>
>>Well I probably should have looked at the finch source first. No idea what
>>you are using instead of cout.
>
>And you will need to #include "term.h" in there for cursor_visible and
>clear_screen

in finch.c:

#include "term.h"

int main(int argc, char *argv[])
  {
      signal(SIGPIPE, SIG_IGN);

      g_thread_init(NULL);

      g_set_prgname("Finch");
  #if GLIB_CHECK_VERSION(2,2,0)
      g_set_application_name(_("Finch"));
  #endif

      if (gnt_start(&argc, &argv)) {
          gnt_main();

  #ifdef STANDALONE
          purple_core_quit();
  #endif
      printf(cursor_visible); // <-- this is all you need by the look of it
      }
      return 0;
  }


>
>>
>>>
>>>Cheers
>>>
>>>-- 
>>>Cahn's Axiom:
>>>	When all else fails, read the instructions.
>>>
>>>_______________________________________________
>>>Support mailing list
>>>Support at pidgin.im
>>>http://pidgin.im/cgi-bin/mailman/listinfo/support
>>
>>-- 
>>All of the true things I am about to tell you are shameless lies.
>>		-- The Book of Bokonon / Kurt Vonnegut Jr.
>>
>>_______________________________________________
>>Support mailing list
>>Support at pidgin.im
>>http://pidgin.im/cgi-bin/mailman/listinfo/support
>
>-- 
>Finagle's fourth Law:
>	Once a job is fouled up, anything done to improve it only makes
>it worse.
>
>_______________________________________________
>Support mailing list
>Support at pidgin.im
>http://pidgin.im/cgi-bin/mailman/listinfo/support

-- 
"I can resist anything but temptation."




More information about the Support mailing list