Skip to content

Commit

Permalink
show basename in source: split line
Browse files Browse the repository at this point in the history
before this change I would get a split with...
`────────────────────────── source:/server/externa[...].cpp+130 ────`
which does not tell me anything about what file I am in.

now I get something like this...
`─────────────── source:/server/externa[...]SendReceive.hpp+110 ────`
  • Loading branch information
bartman committed Nov 22, 2023
1 parent 5927df4 commit 2bc7096
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions gef.py
Original file line number Diff line number Diff line change
Expand Up @@ -7663,8 +7663,11 @@ def context_source(self) -> None:

nb_line = self["nb_lines_code"]
fn = symtab.filename
if len(fn) > 20:
fn = f"{fn[:15]}[...]{os.path.splitext(fn)[1]}"
if len(fn) > 30:
base = os.path.basename(fn)
if len(base) > 20:
base = f"{base[-10:]}"
fn = f"{fn[:15]}[...]{base}"
title = f"source:{fn}+{line_num + 1}"
cur_line_color = gef.config["theme.source_current_line"]
self.context_title(title)
Expand Down

0 comments on commit 2bc7096

Please sign in to comment.