Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions trepan/processor/cmdlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ def parse_list_cmd(proc, args, listsize=10):
if text in frozenset(('', '.', '+', '-')):
if text == '.':
location = resolve_location(proc, '.')
return location.path, location.line_number, listsize
filename = location.path
first = location.line_number - (listsize // 2)
else:
if proc.list_lineno is None:
proc.errmsg("Don't have previous list location")
Expand Down Expand Up @@ -69,7 +70,7 @@ def parse_list_cmd(proc, args, listsize=10):
if not location:
return INVALID_PARSE_LIST
last = location.line_number
first = max(1, last - listsize)
first = max(1, last - listsize + 1)
return location.path, first, last
elif isinstance(list_range.first, int):
first = list_range.first
Expand All @@ -80,7 +81,7 @@ def parse_list_cmd(proc, args, listsize=10):
last = location.line_number
if last < first:
# Treat as a count rather than an absolute location
last = first + last
last = first + last - 1
return location.path, first, last
else:
# First is location. Last may be empty or a number
Expand All @@ -97,10 +98,10 @@ def parse_list_cmd(proc, args, listsize=10):
assert last[0] == '+'
last = first + int(last[1:])
elif not last:
last = first + listsize
last = first + listsize - 1
elif last < first:
# Treat as a count rather than an absolute location
last = first + last
last = first + last - 1

return location.path, first, last
pass
Expand Down