Bug 204852

Summary: [regression] [patch] fix gstat undocumented keyboard controls
Product: Base System Reporter: Keith White <ksw.childe>
Component: binAssignee: Alan Somers <asomers>
Status: Closed FIXED    
Severity: Affects Only Me CC: asomers
Priority: --- Keywords: patch, regression
Version: CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
fix for libncurses/libedit interaction
none
oops, missed the last part of the patch none

Description Keith White 2015-11-27 19:06:36 UTC
Created attachment 163589 [details]
fix for libncurses/libedit interaction

gstat includes undocumented keyboard controls for quit [q], filter [f], etc.  With (I'm guessing!) recent libedit changes, these commands fail to work as expected.  The terminal echoes the single key command, and does not run it until the enter key is pressed.  In particular, 'q' 'enter' exits gstat and leaves the terminal in a non-echo state requiring "reset".

The attached patch relocates the cbreak() etc. calls after the libedit initialization, and calls cbreak() etc. after libedit is called to enter a new filter.
Comment 1 Keith White 2015-11-27 21:40:03 UTC
Created attachment 163600 [details]
oops, missed the last part of the patch

include the swapped endwin() el_end()
Comment 2 Alan Somers freebsd_committer freebsd_triage 2016-06-23 15:22:40 UTC
In review at https://reviews.freebsd.org/D6934
Comment 3 commit-hook freebsd_committer freebsd_triage 2016-06-23 23:13:42 UTC
A commit references this bug:

Author: asomers
Date: Thu Jun 23 23:13:14 UTC 2016
New revision: 302162
URL: https://svnweb.freebsd.org/changeset/base/302162

Log:
  Fix gstat's interactive f and q commands

  curses and libedit don't play well together. After last year's libedit
  upgrade in head, they play even less well together. This change resets some
  curses settings after they get screwed up by libedit calls. Without it,
  gstat's interactive commands require an extra "enter", screw up the terminal
  on exit, and screw up the display if the user enters an invalid filter
  string.

  PR:		204852
  Submitted by:	Keith White
  Reviewed by:	pfg
  Approved by:	re (gjb)
  MFC after:	4 weeks
  Sponsored by:	Spectra Logic Corp
  Differential Revision:	https://reviews.freebsd.org/D6934

Changes:
  head/usr.sbin/gstat/gstat.c
Comment 4 Alan Somers freebsd_committer freebsd_triage 2016-06-23 23:15:38 UTC
Fixed by 302162