From patchwork Mon Jul 30 19:22:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Poirier X-Patchwork-Id: 1255901 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 853E240D71 for ; Mon, 30 Jul 2012 19:23:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754303Ab2G3TXm (ORCPT ); Mon, 30 Jul 2012 15:23:42 -0400 Received: from mail-gh0-f174.google.com ([209.85.160.174]:60143 "EHLO mail-gh0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754358Ab2G3TXI (ORCPT ); Mon, 30 Jul 2012 15:23:08 -0400 Received: by mail-gh0-f174.google.com with SMTP id r11so5244904ghr.19 for ; Mon, 30 Jul 2012 12:23:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=gTw0ruCuuQof8/loTjdq3ZjZlfpojlTl0mGSqqhKfYs=; b=eSpmlh1LIZrhSO2PMUfgCHOylU6xxfgG8Hf0Crv+zjvYUiNCb1HKnQDGnBkd3apmqS KJ/3ERH7HqaVXVswUPCZcZpjiuIrq7OUpxH/eSXEqxuSD2UIiNlGW4HFuu3uHoO/hguN 4C0q/VPqdio/2em/hbkgbixAh8r5VeSYYYsdY1KgwfWGV4jOoPQFvMZWPC+PX53Ty9Ar LuzNYBjJL/PS5zptaccHEtkCopuYcbCuVxVj2rCl3uUtu87ilgdoLlAIYzWp6678APal LzqMVux4xTSev7CHoHAN+5g/mo8lkOwfrmO7Qj1of8IdFn6tv8vWctbttRZjip51RwVy Y6Aw== Received: by 10.50.17.162 with SMTP id p2mr62275igd.52.1343676187330; Mon, 30 Jul 2012 12:23:07 -0700 (PDT) Received: from localhost.localdomain (modemcable118.38-22-96.mc.videotron.ca. [96.22.38.118]) by mx.google.com with ESMTPS id dk7sm15471252igb.10.2012.07.30.12.23.05 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 30 Jul 2012 12:23:06 -0700 (PDT) From: Benjamin Poirier To: Michal Marek Cc: Lucas De Marchi , Arnaud Lacombe , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Randy Dunlap Subject: [PATCH 5/6] menuconfig: Do not open code textbox scroll up/down Date: Mon, 30 Jul 2012 15:22:09 -0400 Message-Id: <1343676130-29770-6-git-send-email-bpoirier@suse.de> X-Mailer: git-send-email 1.7.7 In-Reply-To: <1343676130-29770-1-git-send-email-bpoirier@suse.de> References: <1343676130-29770-1-git-send-email-bpoirier@suse.de> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org We don't need to explicitely use ncurses' scroll(). ncurses performs vertical-motion optimization at wrefresh() time. Using strace I confirmed that with the following patch curses still sends only the new line of text to the terminal when scrolling up/down one line at a time. Signed-off-by: Benjamin Poirier --- scripts/kconfig/lxdialog/textbox.c | 55 +++++++---------------------------- 1 files changed, 11 insertions(+), 44 deletions(-) diff --git a/scripts/kconfig/lxdialog/textbox.c b/scripts/kconfig/lxdialog/textbox.c index 506a095..3b3c5c4 100644 --- a/scripts/kconfig/lxdialog/textbox.c +++ b/scripts/kconfig/lxdialog/textbox.c @@ -166,40 +166,12 @@ do_resize: case 'K': /* Previous line */ case 'k': case KEY_UP: - if (!begin_reached) { - int passed_end = 0; - - back_lines(page_length + 1); - - /* We don't call print_page() here but use - * scrolling to ensure faster screen update. - * However, 'end_reached' and 'page_length' - * should still be updated, and 'page' should - * point to start of next page. This is done - * by calling get_line() in the following - * 'for' loop. */ - scrollok(box, TRUE); - wscrl(box, -1); /* Scroll box region down one line */ - scrollok(box, FALSE); - page_length = 0; - for (i = 0; i < boxh; i++) { - if (!i) { - /* print first line of page */ - print_line(box, 0, boxw); - wnoutrefresh(box); - } else - /* Called to update 'end_reached' and 'page' */ - get_line(); - if (!passed_end) - page_length++; - if (end_reached && !passed_end) - passed_end = 1; - } + if (begin_reached) + break; - print_position(dialog); - wmove(dialog, cur_y, cur_x); /* Restore cursor position */ - wrefresh(dialog); - } + back_lines(page_length + 1); + refresh_text_box(dialog, box, boxh, boxw, cur_y, + cur_x); break; case 'B': /* Previous page */ case 'b': @@ -214,17 +186,12 @@ do_resize: case 'J': /* Next line */ case 'j': case KEY_DOWN: - if (!end_reached) { - begin_reached = 0; - scrollok(box, TRUE); - scroll(box); /* Scroll box region up one line */ - scrollok(box, FALSE); - print_line(box, boxh - 1, boxw); - wnoutrefresh(box); - print_position(dialog); - wmove(dialog, cur_y, cur_x); /* Restore cursor position */ - wrefresh(dialog); - } + if (end_reached) + break; + + back_lines(page_length - 1); + refresh_text_box(dialog, box, boxh, boxw, cur_y, + cur_x); break; case KEY_NPAGE: /* Next page */ case ' ':