mirror of
https://github.com/python/cpython.git
synced 2025-12-04 08:34:25 +00:00
Add config-main.def option to make the 'history' feature non-cyclic.
Default remains cyclic. Python Patch 914546 Noam Raphael. M IdleHistory.py M NEWS.txt M config-main.def
This commit is contained in:
parent
69b8caa23a
commit
0676dfdce0
3 changed files with 23 additions and 7 deletions
|
|
@ -1,3 +1,5 @@
|
||||||
|
from configHandler import idleConf
|
||||||
|
|
||||||
class History:
|
class History:
|
||||||
|
|
||||||
def __init__(self, text, output_sep = "\n"):
|
def __init__(self, text, output_sep = "\n"):
|
||||||
|
|
@ -6,6 +8,7 @@ class History:
|
||||||
self.history_prefix = None
|
self.history_prefix = None
|
||||||
self.history_pointer = None
|
self.history_pointer = None
|
||||||
self.output_sep = output_sep
|
self.output_sep = output_sep
|
||||||
|
self.cyclic = idleConf.GetOption("main", "History", "cyclic", 1, "bool")
|
||||||
text.bind("<<history-previous>>", self.history_prev)
|
text.bind("<<history-previous>>", self.history_prev)
|
||||||
text.bind("<<history-next>>", self.history_next)
|
text.bind("<<history-next>>", self.history_next)
|
||||||
|
|
||||||
|
|
@ -40,7 +43,11 @@ class History:
|
||||||
if reverse:
|
if reverse:
|
||||||
pointer = nhist
|
pointer = nhist
|
||||||
else:
|
else:
|
||||||
pointer = -1
|
if self.cyclic:
|
||||||
|
pointer = -1
|
||||||
|
else:
|
||||||
|
self.text.bell()
|
||||||
|
return
|
||||||
nprefix = len(prefix)
|
nprefix = len(prefix)
|
||||||
while 1:
|
while 1:
|
||||||
if reverse:
|
if reverse:
|
||||||
|
|
@ -49,10 +56,13 @@ class History:
|
||||||
pointer = pointer + 1
|
pointer = pointer + 1
|
||||||
if pointer < 0 or pointer >= nhist:
|
if pointer < 0 or pointer >= nhist:
|
||||||
self.text.bell()
|
self.text.bell()
|
||||||
if self._get_source("iomark", "end-1c") != prefix:
|
if not self.cyclic and pointer < 0:
|
||||||
self.text.delete("iomark", "end-1c")
|
return
|
||||||
self._put_source("iomark", prefix)
|
else:
|
||||||
pointer = prefix = None
|
if self._get_source("iomark", "end-1c") != prefix:
|
||||||
|
self.text.delete("iomark", "end-1c")
|
||||||
|
self._put_source("iomark", prefix)
|
||||||
|
pointer = prefix = None
|
||||||
break
|
break
|
||||||
item = self.history[pointer]
|
item = self.history[pointer]
|
||||||
if item[:nprefix] == prefix and len(item) > nprefix:
|
if item[:nprefix] == prefix and len(item) > nprefix:
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,9 @@ What's New in IDLE 1.2a0?
|
||||||
|
|
||||||
*Release date: XX-XXX-2005*
|
*Release date: XX-XXX-2005*
|
||||||
|
|
||||||
|
- Add config-main option to make the 'history' feature non-cyclic.
|
||||||
|
Default remains cyclic. Python Patch 914546 Noam Raphael.
|
||||||
|
|
||||||
- Removed ability to configure tabs indent from Options dialog. This 'feature'
|
- Removed ability to configure tabs indent from Options dialog. This 'feature'
|
||||||
has never worked and no one has complained. It is still possible to set a
|
has never worked and no one has complained. It is still possible to set a
|
||||||
default tabs (v. spaces) indent 'manually' via config-main.def (or to turn on
|
default tabs (v. spaces) indent 'manually' via config-main.def (or to turn on
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@
|
||||||
# ~/.idlerc/config-highlight.cfg the user highlighting config file
|
# ~/.idlerc/config-highlight.cfg the user highlighting config file
|
||||||
# ~/.idlerc/config-keys.cfg the user keybinding config file
|
# ~/.idlerc/config-keys.cfg the user keybinding config file
|
||||||
#
|
#
|
||||||
# On Windows2000 and Windows XP the .idlerc directory is at
|
# On Windows2000 and Windows XP the .idlerc directory is at
|
||||||
# Documents and Settings\<username>\.idlerc
|
# Documents and Settings\<username>\.idlerc
|
||||||
#
|
#
|
||||||
# On Windows98 it is at c:\.idlerc
|
# On Windows98 it is at c:\.idlerc
|
||||||
#
|
#
|
||||||
|
|
@ -73,4 +73,7 @@ name= IDLE Classic
|
||||||
default= 1
|
default= 1
|
||||||
name= IDLE Classic Windows
|
name= IDLE Classic Windows
|
||||||
|
|
||||||
|
[History]
|
||||||
|
cyclic=1
|
||||||
|
|
||||||
[HelpFiles]
|
[HelpFiles]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue