Skip to content

Commit

Permalink
Use string_view::remove_prefix instead of reassigning
Browse files Browse the repository at this point in the history
  • Loading branch information
tfpf committed Aug 13, 2024
1 parent f7a6ac0 commit 0219f16
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion custom-prompt/custom-prompt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ void report_command_status(std::string_view& last_command, int exit_code, long l

#ifdef BASH
// Remove the initial part (index and timestamp) of the command.
last_command = last_command.substr(last_command.find(RIGHT_SQUARE_BRACKET[0]) + 2);
last_command.remove_prefix(last_command.find(RIGHT_SQUARE_BRACKET[0]) + 2);
#endif
last_command.remove_suffix(last_command.size() - 1 - last_command.find_last_not_of(' '));
LOG_DEBUG("Command length is %zu.", last_command.size());
Expand Down

0 comments on commit 0219f16

Please sign in to comment.