Skip to content

Commit

Permalink
uosc menu syntax support
Browse files Browse the repository at this point in the history
  • Loading branch information
tsl0922 committed Dec 13, 2023
1 parent a5dc276 commit 2e179b5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ The syntax is similar to [mpv.net](https://github.com/mpvnet-player/mpv.net):
Ctrl+a show-text hello #menu: Foo > Bar
```

The [uosc](https://github.com/tomasklaen/uosc) menu syntax `#!` is supported too.

## Credits

This project contains code copied from [mpv](https://github.com/mpv-player/mpv).
4 changes: 3 additions & 1 deletion src/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "menu.h"

#define MENU_PREFIX "#menu:"
#define MENU_PREFIX_UOSC "#!"

struct item_data {
char *key;
Expand Down Expand Up @@ -108,7 +109,8 @@ HMENU load_menu(void *talloc_ctx, char *input) {
if (cmd.len == 0) continue;

comment = bstr_strip(comment);
if (comment.len == 0 || !bstr_eatstart0(&comment, MENU_PREFIX))
if (comment.len == 0 || (!bstr_eatstart0(&comment, MENU_PREFIX) &&
!bstr_eatstart0(&comment, MENU_PREFIX_UOSC)))
continue;

comment = bstr_strip(comment);
Expand Down

0 comments on commit 2e179b5

Please sign in to comment.