{"action":"created","issue":{"url":"https://api.github.com/repos/neovim/neovim/issues/4432","repository_url":"https://api.github.com/repos/neovim/neovim","labels_url":"https://api.github.com/repos/neovim/neovim/issues/4432/labels{/name}","comments_url":"https://api.github.com/repos/neovim/neovim/issues/4432/comments","events_url":"https://api.github.com/repos/neovim/neovim/issues/4432/events","html_url":"https://github.com/neovim/neovim/pull/4432","id":139697070,"number":4432,"title":"[WIP] externalize ui elements like the popup menu?","user":{"login":"bfredl","id":1363104,"avatar_url":"https://avatars.githubusercontent.com/u/1363104?v=3","gravatar_id":"","url":"https://api.github.com/users/bfredl","html_url":"https://github.com/bfredl","followers_url":"https://api.github.com/users/bfredl/followers","following_url":"https://api.github.com/users/bfredl/following{/other_user}","gists_url":"https://api.github.com/users/bfredl/gists{/gist_id}","starred_url":"https://api.github.com/users/bfredl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bfredl/subscriptions","organizations_url":"https://api.github.com/users/bfredl/orgs","repos_url":"https://api.github.com/users/bfredl/repos","events_url":"https://api.github.com/users/bfredl/events{/privacy}","received_events_url":"https://api.github.com/users/bfredl/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/neovim/neovim/labels/enhancement","name":"enhancement","color":"bfe5bf"},{"url":"https://api.github.com/repos/neovim/neovim/labels/gui","name":"gui","color":"c7def8"},{"url":"https://api.github.com/repos/neovim/neovim/labels/WIP","name":"WIP","color":"e6e6e6"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":33,"created_at":"2016-03-09T20:49:46Z","updated_at":"2016-07-01T06:26:13Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/neovim/neovim/pulls/4432","html_url":"https://github.com/neovim/neovim/pull/4432","diff_url":"https://github.com/neovim/neovim/pull/4432.diff","patch_url":"https://github.com/neovim/neovim/pull/4432.patch"},"body":"This enables the internal drawing of the completion popupmenu to be switched off and the data instead sent to an external gui for it to display as it likes.\r\n\r\nNot that I care that much about the pum specifically, but it is a good example of an ui element whose implementation is reasonally well isolated from the rest of `screen.c` and thus serves as a good prototype for externalizing ui elements in general.\r\n\r\nSome open questions:\r\n\r\n* It would seem unreasonable to define a member of `ui_t` for every ui event that would arise from an externalizied ui element. For the moment I just added `(*event)(name, args)` for a generic event that external gui:s care about but not the tui, but it seems like a hack over the present model. (Ref disscussion in #4322 about the distinction of ui/non-ui events).\r\n\r\n* Similar question could be raised about ui requests like `remote_ui_try_resize`. Why don't we have `api/remote_ui.c` and just autogenerate the msgpack validation as for all other api requests? (**done** in #4817 )\r\n\r\n* If multiple uis (including the tui) are connected they might differ in which ui elements they implement themselves or should be drawn on the grid. The \"proper\" solution would be to have multiple \"layers\" of the grid that ui:s could show or not show but that looks too complicated at this point (it should probably wait until progress is made on the  [smart ui](http://tarruda.github.io/articles/neovim-smart-ui-protocol/) protocol). A reasonable heuristic for this case could just be: the ui that sends the keypress opening the pum determines the display mode. **solution:** only use external popupmenu if all connected clients support it.\r\n\r\nI made stupid test for the [python-gui](https://github.com/neovim/python-gui/compare/master...bfredl:pumtest?expand=1), it doesn't even draw anything but it echoes the events to stdout so one could see that they are correct.\r\n\r\nThe exposed ui events  are:\r\n```\r\npopupmenu_show(items, selected)\r\npopupmenu_select(selected)\r\npopupmenu_hide()\r\n```\r\nitems will be a list of tuples `[text, kind, extra, info]`. `selected` will either be a 0-based index or -1 if no element is selected.\r\nTo activate this mode, instead of using `ui_attach(row, cols, true)` use `ui_attach_options(rows, cols, {'rgb': true, 'popupmenu_external': true})`."},"comment":{"url":"https://api.github.com/repos/neovim/neovim/issues/comments/229864232","html_url":"https://github.com/neovim/neovim/pull/4432#issuecomment-229864232","issue_url":"https://api.github.com/repos/neovim/neovim/issues/4432","id":229864232,"user":{"login":"fmoralesc","id":221465,"avatar_url":"https://avatars.githubusercontent.com/u/221465?v=3","gravatar_id":"","url":"https://api.github.com/users/fmoralesc","html_url":"https://github.com/fmoralesc","followers_url":"https://api.github.com/users/fmoralesc/followers","following_url":"https://api.github.com/users/fmoralesc/following{/other_user}","gists_url":"https://api.github.com/users/fmoralesc/gists{/gist_id}","starred_url":"https://api.github.com/users/fmoralesc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fmoralesc/subscriptions","organizations_url":"https://api.github.com/users/fmoralesc/orgs","repos_url":"https://api.github.com/users/fmoralesc/repos","events_url":"https://api.github.com/users/fmoralesc/events{/privacy}","received_events_url":"https://api.github.com/users/fmoralesc/received_events","type":"User","site_admin":false},"created_at":"2016-07-01T06:26:13Z","updated_at":"2016-07-01T06:26:13Z","body":"> Shouldn't the position of the popup upon popupmenu_show be provided by the server?\r\n\r\nAs long as the client is allowed to override it -- it will be necessary when the clients escape the grid model (one can hope!) ;)"}}
{"actor":{"display_login":"fmoralesc"}}