From 0704166f9a9c6028314d50b493670e7862c968b3 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Fri, 1 Mar 2024 10:03:32 +0200 Subject: gh-65824: Improve the "less" prompt in pydoc (GH-116050) Output the line number, the percentage and the help about how to get help or quit the pager. Inspired by the GNU man. --- Lib/pydoc.py | 11 ++++++++++- .../Library/2024-02-28-17-04-28.gh-issue-65824.gG8KR1.rst | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Library/2024-02-28-17-04-28.gh-issue-65824.gG8KR1.rst diff --git a/Lib/pydoc.py b/Lib/pydoc.py index b0193b4..407c020 100755 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -1685,8 +1685,17 @@ def plain(text): def pipepager(text, cmd): """Page through text by feeding it to another program.""" import subprocess + env = os.environ.copy() + prompt_string = ( + ' ' + '?ltline %lt?L/%L.' + ':byte %bB?s/%s.' + '.' + '?e (END):?pB %pB\\%..' + ' (press h for help or q to quit)') + env['LESS'] = '-RmPm{0}$PM{0}$'.format(prompt_string) proc = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, - errors='backslashreplace') + errors='backslashreplace', env=env) try: with proc.stdin as pipe: try: diff --git a/Misc/NEWS.d/next/Library/2024-02-28-17-04-28.gh-issue-65824.gG8KR1.rst b/Misc/NEWS.d/next/Library/2024-02-28-17-04-28.gh-issue-65824.gG8KR1.rst new file mode 100644 index 0000000..7bc6ced --- /dev/null +++ b/Misc/NEWS.d/next/Library/2024-02-28-17-04-28.gh-issue-65824.gG8KR1.rst @@ -0,0 +1 @@ +Improve the ``less`` prompt in :mod:`pydoc`. -- cgit v0.12 being a native application with native capabilities and speed.
summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/code/src_gui_kernel_qshortcutmap.cpp
blob: 119690d2d6890f4642cb768df2cfc5db3684b053 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights.  These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/

//! [0]
key = QKeySequence();
//! [0]