diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2022-03-18 10:33:26 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2022-03-18 10:39:56 -0700 |
commit | 0374e82aa523c3f64a99aacacbc23eccb5c25404 (patch) | |
tree | aacb749b2b21c3c78b1ea05cc9b22837c83e783b /src/teliva.c | |
parent | af8d3addd29880a7eb739cdedaf594facbcad06f (diff) | |
download | teliva-0374e82aa523c3f64a99aacacbc23eccb5c25404.tar.gz |
show current definition being edited
This serves two purposes: - Things get confusing if function being defined doesn't match the definition name. Displaying the current definition helps diagnose this situation. - We're already able to see callers at a glance even if the cursor is below the fold. The name of the current definition is arguably more important in that situation.
Diffstat (limited to 'src/teliva.c')
-rw-r--r-- | src/teliva.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/teliva.c b/src/teliva.c index ed4ddab..b88a42b 100644 --- a/src/teliva.c +++ b/src/teliva.c @@ -699,8 +699,10 @@ int editor_view_in_progress(lua_State* L) { char Current_definition[CURRENT_DEFINITION_LEN+1] = {0}; -void draw_callers_of_current_definition(lua_State* L) { +void draw_current_definition_name_and_callers(lua_State* L) { int oldtop = lua_gettop(L); + mvaddstr(0, 0, ""); + draw_definition_name(Current_definition); luaL_newmetatable(L, "__teliva_caller"); int ct = lua_gettop(L); lua_getfield(L, ct, Current_definition); @@ -711,7 +713,7 @@ void draw_callers_of_current_definition(lua_State* L) { } int ctc = lua_gettop(L); attron(COLOR_PAIR(COLOR_PAIR_FADE)); - mvaddstr(0, 0, "callers: "); + addstr("callers: "); attroff(COLOR_PAIR(COLOR_PAIR_FADE)); for (lua_pushnil(L); lua_next(L, ctc) != 0; lua_pop(L, 1)) { const char* caller_name = lua_tostring(L, -2); |