Subject: pkg/37208: editors/nano: input prompt cursor position problems using curses
To: None <,,>
From: None <>
List: pkgsrc-bugs
Date: 10/25/2007 15:35:00
>Number:         37208
>Category:       pkg
>Synopsis:       physical cursor position does not update during prompt edits when using curses
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Oct 25 15:35:00 +0000 2007
>Originator:     Jason White
>Release:        NetBSD 3.1
Jason White <>       Jabber: jdwhite(                     jason.d.white(
PGP KeyID: 0x5290E477
System: NetBSD 3.1 NetBSD 3.1 (BENDER_XEN2_DOMU) #0: Sat Nov 18 20:00:43 CST 2006 root@smeghead:/usr/obj/i386/BENDER_XEN2_DOMU i386
Architecture: i386
Machine: i386
When prompted for input, as when searching or saving, and you use any of the 
editing keys that would move the cursor around, the physical position does 
not update, but does logically.  I suspect this problem is similar to 
PR/37133 as this problem only occurs when using stock curses -- if compiled 
with ncursesw this problem does not exist.

Bring up the search function. Type a few characters and then use the cursor 
keys to move left a few characters, then type some more.  The additional 
input will be inserted in the proper position, but the cursor will not 
change its position on screen moving it around and characters aren't being 
inserted or deleted.

Similar to PR/37133, it would appear the problem is that the prompt line 
needs to be refreshed after any cursor movements that don't result in the 
insertion or deletion of a character if stock curses is used.  The following 
patch forces the prompt line to be redrawn after each kbd input if ncurses 
isn't used.

--- src/prompt.c.orig   2007-10-25 04:28:18.000000000 -0500
+++ src/prompt.c        2007-10-25 10:26:12.000000000 -0500
@@ -916,10 +916,14 @@
  * different pages. */
 bool need_statusbar_horizontal_update(size_t pww_save)
+#if defined(HAVE_NCURSES_H)
     size_t start_col = strlenpt(prompt) + 1;

     return get_statusbar_page_start(start_col, start_col + pww_save) !=
        get_statusbar_page_start(start_col, start_col + statusbar_pww);
+    return(1);

 /* Unconditionally redraw the entire screen, and then refresh it using