--- yapet-0.2/ui/inputwidget.h 2008-07-20 12:49:02.000000000 +0200 +++ yapet-0.2p1/ui/inputwidget.h 2008-07-23 22:45:26.000000000 +0200 @@ -1,6 +1,6 @@ // -*- c++ -*- // -// $Id: inputwidget.h 1203 2008-02-13 20:47:49Z rafi $ +// $Id: inputwidget.h 1372 2008-07-23 20:45:26Z rafi $ // // YAPET -- Yet Another Password Encryption Tool // Copyright (C) 2008 Rafael Ostertag @@ -81,6 +81,7 @@ protected: void createWindow(int sx, int sy, int w) throw(UIException); + void visibleCursor(bool v) const; inline const WINDOW* getWindow() const { return window; } inline WINDOW* getWindow() { return window; } inline int getStartPos() const { return start_pos; } @@ -89,6 +90,7 @@ inline secstring& getBuffer() { return buffer; } inline const secstring& getBuffer() const { return buffer; } + public: InputWidget(int sx, int sy, int w, int ml = 512) throw(UIException); virtual ~InputWidget(); --- yapet-0.2/ui/inputwidget.cc 2008-07-20 12:49:01.000000000 +0200 +++ yapet-0.2p1/ui/inputwidget.cc 2008-07-23 22:45:26.000000000 +0200 @@ -1,4 +1,4 @@ -// $Id: inputwidget.cc 1202 2008-02-13 00:20:25Z rafi $ +// $Id: inputwidget.cc 1372 2008-07-23 20:45:26Z rafi $ // // YAPET -- Yet Another Password Encryption Tool // Copyright (C) 2008 Rafael Ostertag @@ -135,6 +135,16 @@ //refresh(); } +void +InputWidget::visibleCursor(bool v) const { + if (v) { + int err = curs_set(2); + if (err == ERR) curs_set(1); + } else { + curs_set(0); + } +} + InputWidget::InputWidget(int sx, int sy, int w, int ml) throw(UIException) : window(NULL), max_length(ml), @@ -163,7 +173,7 @@ if (retval == ERR) throw UIException("Error moving cursor for widget"); - curs_set(2); + visibleCursor(true); int ch; while ( (ch=wgetch(window)) != '\n' && ch != '\t') { switch (ch) { @@ -187,11 +197,10 @@ ungetch('\n'); break; case KEY_DC: - case 127: processDelete(); break; case KEY_BACKSPACE: - case 8: + case 127: processBackspace(); break; #ifdef HAVE_WRESIZE @@ -208,7 +217,7 @@ } } BAILOUT: - curs_set(0); + visibleCursor(false); Colors::setcolor(window, INPUTWIDGET_NOFOCUS);