Skip to content

Commit

Permalink
copy-path command
Browse files Browse the repository at this point in the history
  • Loading branch information
pommicket committed Jul 14, 2023
1 parent 34ef28e commit fc847c8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions command.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ static CommandName command_names[] = {
{"autocomplete", CMD_AUTOCOMPLETE},
{"autocomplete-back", CMD_AUTOCOMPLETE_BACK},
{"find-usages", CMD_FIND_USAGES},
{"copy-path", CMD_COPY_PATH},
{"goto-definition", CMD_GOTO_DEFINITION},
{"goto-definition-at-cursor", CMD_GOTO_DEFINITION_AT_CURSOR},
{"goto-declaration-at-cursor", CMD_GOTO_DECLARATION_AT_CURSOR},
Expand Down Expand Up @@ -304,6 +305,13 @@ void command_execute_ex(Ted *ted, Command c, CommandArgument full_argument, Comm
}
}
break;
case CMD_COPY_PATH:
if (buffer) {
SDL_SetClipboardText(buffer->path);
} else {
SDL_SetClipboardText(ted->cwd);
}
break;
case CMD_TAB:
if (ted->replace && buffer == &ted->find_buffer) {
ted_switch_to_buffer(ted, &ted->replace_buffer);
Expand Down
3 changes: 3 additions & 0 deletions command.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ typedef enum {
CMD_PASTE,
CMD_FIND,
CMD_FIND_REPLACE,

/// copy path to current file
CMD_COPY_PATH,

CMD_TAB_CLOSE,
/// argument = index of tab (starting at 0)
Expand Down

0 comments on commit fc847c8

Please sign in to comment.