Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
topydo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
topydo
Commits
9fae5941
Commit
9fae5941
authored
Jan 11, 2016
by
Bram Schoenmakers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only process non-empty commands
parent
8ace1840
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
topydo/ui/CommandLineWidget.py
topydo/ui/CommandLineWidget.py
+8
-8
No files found.
topydo/ui/CommandLineWidget.py
View file @
9fae5941
...
...
@@ -19,10 +19,10 @@ import urwid
class
CommandLineWidget
(
urwid
.
Edit
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
self
.
history
=
None
self
.
history
=
[]
self
.
history_pos
=
None
# temporary history storage for edits before cmd execution
self
.
history_tmp
=
None
self
.
history_tmp
=
[]
super
().
__init__
(
*
args
,
**
kwargs
)
urwid
.
register_signal
(
CommandLineWidget
,
[
'blur'
,
'execute_command'
])
...
...
@@ -35,15 +35,15 @@ class CommandLineWidget(urwid.Edit):
urwid
.
emit_signal
(
self
,
'blur'
)
def
_emit_command
(
self
):
if
len
(
self
.
edit_text
)
>
0
:
urwid
.
emit_signal
(
self
,
'execute_command'
,
self
.
edit_text
)
self
.
_save_to_history
()
self
.
clear
()
def
_save_to_history
(
self
):
if
len
(
self
.
edit_text
)
>
0
:
if
self
.
history
is
None
:
self
.
history
=
[]
self
.
history
.
append
(
self
.
edit_text
)
self
.
history_pos
=
len
(
self
.
history
)
self
.
history_tmp
=
self
.
history
[:]
# sync temporary storage with real history
self
.
history_tmp
.
append
(
''
)
...
...
@@ -57,7 +57,7 @@ class CommandLineWidget(urwid.Edit):
Also saves value of the command-line (before changing it) to history_tmp
for potential later access.
"""
if
self
.
history
is
not
None
:
if
len
(
self
.
history
)
>
0
:
# don't pollute real history - use temporary storage
self
.
history_tmp
[
self
.
history_pos
]
=
self
.
edit_text
self
.
history_pos
=
self
.
history_pos
+
p_step
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment